From ebe636d881e15d0328f2fd5dadaf4f0de97dd0cf Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Mon, 13 Sep 2021 16:34:29 -0400 Subject: [PATCH] backend: don't create renderer if none is available --- backend/backend.c | 26 -------------------------- include/wlr/backend.h | 2 -- 2 files changed, 28 deletions(-) diff --git a/backend/backend.c b/backend/backend.c index 00d77cd2f2..3fa8e1ed4f 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -47,9 +47,6 @@ void wlr_backend_init(struct wlr_backend *backend, void wlr_backend_finish(struct wlr_backend *backend) { wlr_signal_emit_safe(&backend->events.destroy, backend); wlr_allocator_destroy(backend->allocator); - if (backend->has_own_renderer) { - wlr_renderer_destroy(backend->renderer); - } } bool wlr_backend_start(struct wlr_backend *backend) { @@ -71,33 +68,10 @@ void wlr_backend_destroy(struct wlr_backend *backend) { } } -static bool backend_create_renderer(struct wlr_backend *backend) { - if (backend->renderer != NULL) { - return true; - } - - backend->renderer = wlr_renderer_autocreate(backend); - if (backend->renderer == NULL) { - return false; - } - - backend->has_own_renderer = true; - return true; -} - struct wlr_renderer *wlr_backend_get_renderer(struct wlr_backend *backend) { if (backend->impl->get_renderer) { return backend->impl->get_renderer(backend); } - if (backend_get_buffer_caps(backend) != 0) { - // If the backend is capable of presenting buffers, automatically create - // the renderer if necessary. - if (!backend_create_renderer(backend)) { - wlr_log(WLR_ERROR, "Failed to create backend renderer"); - return NULL; - } - return backend->renderer; - } return NULL; } diff --git a/include/wlr/backend.h b/include/wlr/backend.h index d616fa1db9..f1e6a3cd14 100644 --- a/include/wlr/backend.h +++ b/include/wlr/backend.h @@ -28,8 +28,6 @@ struct wlr_backend { // Private state - bool has_own_renderer; - struct wlr_renderer *renderer; struct wlr_allocator *allocator; };