From 27bf066c81ff597c850e156209229c1b802b8e88 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Wed, 8 May 2024 10:40:17 -0500 Subject: renderer: Move dmabuf setup into renderer init We've forgotten to set this up in some backends, so let's just do it in weston_compositor_init_renderer(). The headless backend used to fail out if linux_dmabuf_setup() failed, but had no reason to do so, so just remove that to make the code common. Suggested by cwabbott on irc. Signed-off-by: Derek Foreman --- libweston/backend-drm/drm.c | 3 --- libweston/backend-headless/headless.c | 7 ------- libweston/backend-wayland/wayland.c | 6 ------ libweston/backend-x11/x11.c | 6 ------ libweston/compositor.c | 4 ++++ 5 files changed, 4 insertions(+), 22 deletions(-) diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index 62f73d00..9cbc3ffd 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -4084,9 +4084,6 @@ drm_backend_create(struct weston_compositor *compositor, recorder_binding, b); if (compositor->renderer->import_dmabuf) { - if (linux_dmabuf_setup(compositor) < 0) - weston_log("Error: initializing dmabuf " - "support failed.\n"); if (compositor->default_dmabuf_feedback) { /* We were able to create the compositor's default * dma-buf feedback in the renderer, that means that the diff --git a/libweston/backend-headless/headless.c b/libweston/backend-headless/headless.c index c4ee3b39..63f26924 100644 --- a/libweston/backend-headless/headless.c +++ b/libweston/backend-headless/headless.c @@ -627,13 +627,6 @@ headless_backend_create(struct weston_compositor *compositor, if (ret < 0) goto err_input; - if (compositor->renderer->import_dmabuf) { - if (linux_dmabuf_setup(compositor) < 0) { - weston_log("Error: dmabuf protocol setup failed.\n"); - goto err_input; - } - } - /* Support zwp_linux_explicit_synchronization_unstable_v1 to enable * testing. */ if (linux_explicit_synchronization_setup(compositor) < 0) diff --git a/libweston/backend-wayland/wayland.c b/libweston/backend-wayland/wayland.c index c2ba3476..245dd8ef 100644 --- a/libweston/backend-wayland/wayland.c +++ b/libweston/backend-wayland/wayland.c @@ -2989,12 +2989,6 @@ wayland_backend_create(struct weston_compositor *compositor, wl_event_source_check(b->parent.wl_source); - if (compositor->renderer->import_dmabuf) { - if (linux_dmabuf_setup(compositor) < 0) - weston_log("Error: initializing dmabuf " - "support failed.\n"); - } - return b; err_renderer: compositor->renderer->destroy(compositor); diff --git a/libweston/backend-x11/x11.c b/libweston/backend-x11/x11.c index eb9a82c5..a35b5c8a 100644 --- a/libweston/backend-x11/x11.c +++ b/libweston/backend-x11/x11.c @@ -1974,12 +1974,6 @@ x11_backend_create(struct weston_compositor *compositor, x11_backend_handle_event, b); wl_event_source_check(b->xcb_source); - if (compositor->renderer->import_dmabuf) { - if (linux_dmabuf_setup(compositor) < 0) - weston_log("Error: initializing dmabuf " - "support failed.\n"); - } - if (compositor->capabilities & WESTON_CAP_EXPLICIT_SYNC) { if (linux_explicit_synchronization_setup(compositor) < 0) weston_log("Error: initializing explicit " diff --git a/libweston/compositor.c b/libweston/compositor.c index 01810407..018bd0d5 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -10027,6 +10027,10 @@ weston_compositor_init_renderer(struct weston_compositor *compositor, ret = -1; } + if (compositor->renderer->import_dmabuf) + if (linux_dmabuf_setup(compositor) < 0) + weston_log("Error: dmabuf protocol setup failed.\n"); + return ret; } -- cgit v1.2.3