From a1430933392aabc25040cb22e6e4a0d6517b39b5 Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Mon, 15 Nov 2021 13:24:55 -0500 Subject: [PATCH] backend/headless: don't store the parent renderer --- backend/headless/backend.c | 39 +++----------------------------------- include/backend/headless.h | 2 -- 2 files changed, 3 insertions(+), 38 deletions(-) diff --git a/backend/headless/backend.c b/backend/headless/backend.c index 49c2c8ba..886be276 100644 --- a/backend/headless/backend.c +++ b/backend/headless/backend.c @@ -51,7 +51,6 @@ static void backend_destroy(struct wlr_backend *wlr_backend) { } wl_list_remove(&backend->display_destroy.link); - wl_list_remove(&backend->parent_renderer_destroy.link); struct wlr_headless_output *output, *output_tmp; wl_list_for_each_safe(output, output_tmp, &backend->outputs, link) { @@ -70,17 +69,6 @@ static void backend_destroy(struct wlr_backend *wlr_backend) { free(backend); } -static struct wlr_renderer *backend_get_renderer( - struct wlr_backend *wlr_backend) { - struct wlr_headless_backend *backend = - headless_backend_from_backend(wlr_backend); - if (backend->parent_renderer != NULL) { - return backend->parent_renderer; - } else { - return wlr_backend->renderer; - } -} - static int backend_get_drm_fd(struct wlr_backend *wlr_backend) { struct wlr_headless_backend *backend = headless_backend_from_backend(wlr_backend); @@ -96,7 +84,6 @@ static uint32_t get_buffer_caps(struct wlr_backend *wlr_backend) { static const struct wlr_backend_impl backend_impl = { .start = backend_start, .destroy = backend_destroy, - .get_renderer = backend_get_renderer, .get_drm_fd = backend_get_drm_fd, .get_buffer_caps = get_buffer_caps, }; @@ -107,33 +94,13 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) { backend_destroy(&backend->backend); } -static void handle_renderer_destroy(struct wl_listener *listener, void *data) { - struct wlr_headless_backend *backend = - wl_container_of(listener, backend, parent_renderer_destroy); - backend_destroy(&backend->backend); -} - static bool backend_init(struct wlr_headless_backend *backend, - struct wl_display *display, struct wlr_renderer *renderer) { + struct wl_display *display) { wlr_backend_init(&backend->backend, &backend_impl); backend->display = display; wl_list_init(&backend->outputs); wl_list_init(&backend->input_devices); - wl_list_init(&backend->parent_renderer_destroy.link); - - if (renderer == NULL) { - renderer = wlr_renderer_autocreate(&backend->backend); - if (!renderer) { - wlr_log(WLR_ERROR, "Failed to create renderer"); - return false; - } - backend->backend.renderer = renderer; - } else { - backend->parent_renderer = renderer; - backend->parent_renderer_destroy.notify = handle_renderer_destroy; - wl_signal_add(&renderer->events.destroy, &backend->parent_renderer_destroy); - } backend->display_destroy.notify = handle_display_destroy; wl_display_add_destroy_listener(display, &backend->display_destroy); @@ -202,7 +169,7 @@ struct wlr_backend *wlr_headless_backend_create(struct wl_display *display) { wlr_log(WLR_ERROR, "Failed to open DRM render node"); } - if (!backend_init(backend, display, NULL)) { + if (!backend_init(backend, display)) { goto error_init; } @@ -236,7 +203,7 @@ struct wlr_backend *wlr_headless_backend_create_with_renderer( } } - if (!backend_init(backend, display, renderer)) { + if (!backend_init(backend, display)) { goto error_init; } diff --git a/include/backend/headless.h b/include/backend/headless.h index 42a07db8..09d5856b 100644 --- a/include/backend/headless.h +++ b/include/backend/headless.h @@ -14,8 +14,6 @@ struct wlr_headless_backend { size_t last_output_num; struct wl_list input_devices; struct wl_listener display_destroy; - struct wlr_renderer *parent_renderer; - struct wl_listener parent_renderer_destroy; bool started; };