aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/wayland/backend.c42
-rw-r--r--backend/wayland/output.c75
-rw-r--r--include/backend/wayland.h4
3 files changed, 5 insertions, 116 deletions
diff --git a/backend/wayland/backend.c b/backend/wayland/backend.c
index e8c0d191..771f4405 100644
--- a/backend/wayland/backend.c
+++ b/backend/wayland/backend.c
@@ -452,48 +452,6 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
goto error_drm_fd;
}
- const struct wlr_drm_format_set *remote_formats;
- if ((allocator->buffer_caps & WLR_BUFFER_CAP_DMABUF) && wl->zwp_linux_dmabuf_v1) {
- remote_formats = &wl->linux_dmabuf_v1_formats;
- } else if ((allocator->buffer_caps & WLR_BUFFER_CAP_SHM) && wl->shm) {
- remote_formats = &wl->shm_formats;
- } else {
- wlr_log(WLR_ERROR,
- "Failed to get remote formats (DRI3 and SHM unavailable)");
- goto error_drm_fd;
- }
-
- const struct wlr_drm_format_set *render_formats =
- wlr_renderer_get_render_formats(renderer);
- if (render_formats == NULL) {
- wlr_log(WLR_ERROR, "Failed to get available render-capable formats");
- goto error_drm_fd;
- }
-
- uint32_t fmt = DRM_FORMAT_ARGB8888;
-
- const struct wlr_drm_format *remote_format =
- wlr_drm_format_set_get(remote_formats, fmt);
- if (remote_format == NULL) {
- wlr_log(WLR_ERROR, "Remote compositor doesn't support DRM format "
- "0x%"PRIX32, fmt);
- goto error_drm_fd;
- }
-
- const struct wlr_drm_format *render_format =
- wlr_drm_format_set_get(render_formats, fmt);
- if (render_format == NULL) {
- wlr_log(WLR_ERROR, "Renderer doesn't support DRM format 0x%"PRIX32, fmt);
- goto error_drm_fd;
- }
-
- wl->format = wlr_drm_format_intersect(remote_format, render_format);
- if (wl->format == NULL) {
- wlr_log(WLR_ERROR, "Failed to intersect remote and render modifiers "
- "for format 0x%"PRIX32, fmt);
- goto error_drm_fd;
- }
-
wl->local_display_destroy.notify = handle_display_destroy;
wl_display_add_destroy_listener(display, &wl->local_display_destroy);
diff --git a/backend/wayland/output.c b/backend/wayland/output.c
index f4b40698..c8730cd0 100644
--- a/backend/wayland/output.c
+++ b/backend/wayland/output.c
@@ -15,7 +15,6 @@
#include <wlr/types/wlr_matrix.h>
#include <wlr/util/log.h>
-#include "backend/backend.h"
#include "backend/wayland.h"
#include "render/pixel_format.h"
#include "render/swapchain.h"
@@ -100,40 +99,7 @@ static const struct wp_presentation_feedback_listener
static bool output_set_custom_mode(struct wlr_output *wlr_output,
int32_t width, int32_t height, int32_t refresh) {
- struct wlr_wl_output *output = get_wl_output_from_output(wlr_output);
- struct wlr_allocator *allocator = backend_get_allocator(wlr_output->backend);
-
- if (wlr_output->width != width || wlr_output->height != height) {
- struct wlr_swapchain *swapchain = wlr_swapchain_create(allocator,
- width, height, output->backend->format);
- if (swapchain == NULL) {
- return false;
- }
- wlr_swapchain_destroy(output->swapchain);
- output->swapchain = swapchain;
- }
-
- wlr_output_update_custom_mode(&output->wlr_output, width, height, 0);
- return true;
-}
-
-static bool output_attach_render(struct wlr_output *wlr_output,
- int *buffer_age) {
- struct wlr_wl_output *output = get_wl_output_from_output(wlr_output);
- struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend);
-
- wlr_buffer_unlock(output->back_buffer);
- output->back_buffer = wlr_swapchain_acquire(output->swapchain, buffer_age);
- if (!output->back_buffer) {
- wlr_log(WLR_ERROR, "Failed to acquire swapchain buffer");
- return false;
- }
-
- if (!wlr_renderer_bind_buffer(renderer, output->back_buffer)) {
- wlr_log(WLR_ERROR, "Failed to bind buffer to renderer");
- return false;
- }
-
+ wlr_output_update_custom_mode(wlr_output, width, height, 0);
return true;
}
@@ -299,7 +265,6 @@ static bool output_test(struct wlr_output *wlr_output) {
static bool output_commit(struct wlr_output *wlr_output) {
struct wlr_wl_output *output =
get_wl_output_from_output(wlr_output);
- struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend);
if (!output_test(wlr_output)) {
return false;
@@ -315,6 +280,9 @@ static bool output_commit(struct wlr_output *wlr_output) {
}
if (wlr_output->pending.committed & WLR_OUTPUT_STATE_BUFFER) {
+ assert(wlr_output->pending.buffer_type ==
+ WLR_OUTPUT_STATE_BUFFER_SCANOUT);
+
struct wp_presentation_feedback *wp_feedback = NULL;
if (output->backend->presentation != NULL) {
wp_feedback = wp_presentation_feedback(output->backend->presentation,
@@ -334,19 +302,7 @@ static bool output_commit(struct wlr_output *wlr_output) {
output->frame_callback = wl_surface_frame(output->surface);
wl_callback_add_listener(output->frame_callback, &frame_listener, output);
- struct wlr_buffer *wlr_buffer = NULL;
- switch (wlr_output->pending.buffer_type) {
- case WLR_OUTPUT_STATE_BUFFER_RENDER:
- assert(output->back_buffer != NULL);
- wlr_buffer = output->back_buffer;
-
- wlr_renderer_bind_buffer(renderer, NULL);
- break;
- case WLR_OUTPUT_STATE_BUFFER_SCANOUT:;
- wlr_buffer = wlr_output->pending.buffer;
- break;
- }
-
+ struct wlr_buffer *wlr_buffer = wlr_output->pending.buffer;
struct wlr_wl_buffer *buffer =
get_or_create_wl_buffer(output->backend, wlr_buffer);
if (buffer == NULL) {
@@ -371,11 +327,6 @@ static bool output_commit(struct wlr_output *wlr_output) {
wl_surface_commit(output->surface);
- wlr_buffer_unlock(output->back_buffer);
- output->back_buffer = NULL;
-
- wlr_swapchain_set_buffer_submitted(output->swapchain, wlr_buffer);
-
if (wp_feedback != NULL) {
struct wlr_wl_presentation_feedback *feedback =
calloc(1, sizeof(*feedback));
@@ -400,11 +351,6 @@ static bool output_commit(struct wlr_output *wlr_output) {
return true;
}
-static void output_rollback_render(struct wlr_output *wlr_output) {
- struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend);
- wlr_renderer_bind_buffer(renderer, NULL);
-}
-
static bool output_set_cursor(struct wlr_output *wlr_output,
struct wlr_buffer *wlr_buffer, int hotspot_x, int hotspot_y) {
struct wlr_wl_output *output = get_wl_output_from_output(wlr_output);
@@ -472,8 +418,6 @@ static void output_destroy(struct wlr_output *wlr_output) {
presentation_feedback_destroy(feedback);
}
- wlr_buffer_unlock(output->back_buffer);
- wlr_swapchain_destroy(output->swapchain);
if (output->zxdg_toplevel_decoration_v1) {
zxdg_toplevel_decoration_v1_destroy(output->zxdg_toplevel_decoration_v1);
}
@@ -502,10 +446,8 @@ static bool output_move_cursor(struct wlr_output *_output, int x, int y) {
static const struct wlr_output_impl output_impl = {
.destroy = output_destroy,
- .attach_render = output_attach_render,
.test = output_test,
.commit = output_commit,
- .rollback_render = output_rollback_render,
.set_cursor = output_set_cursor,
.move_cursor = output_move_cursor,
.get_cursor_formats = output_get_formats,
@@ -626,13 +568,6 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *wlr_backend) {
&xdg_toplevel_listener, output);
wl_surface_commit(output->surface);
- struct wlr_allocator *allocator = backend_get_allocator(&backend->backend);
- output->swapchain = wlr_swapchain_create(allocator,
- wlr_output->width, wlr_output->height, output->backend->format);
- if (output->swapchain == NULL) {
- goto error;
- }
-
wl_display_roundtrip(output->backend->remote_display);
wl_list_insert(&backend->outputs, &output->link);
diff --git a/include/backend/wayland.h b/include/backend/wayland.h
index 923bfe72..5d69c248 100644
--- a/include/backend/wayland.h
+++ b/include/backend/wayland.h
@@ -21,7 +21,6 @@ struct wlr_wl_backend {
struct wl_list devices;
struct wl_list outputs;
int drm_fd;
- struct wlr_drm_format *format;
struct wl_list buffers; // wlr_wl_buffer.link
size_t requested_outputs;
size_t last_output_num;
@@ -75,9 +74,6 @@ struct wlr_wl_output {
struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1;
struct wl_list presentation_feedbacks;
- struct wlr_swapchain *swapchain;
- struct wlr_buffer *back_buffer;
-
uint32_t enter_serial;
struct {