backend: remove backend ensure renderer and allocator check

This commit is contained in:
Simon Zeni 2021-11-15 12:10:57 -05:00
parent a6538ced35
commit 0c76aef202

View file

@ -208,21 +208,6 @@ static size_t parse_outputs_env(const char *name) {
return outputs; return outputs;
} }
static struct wlr_backend *ensure_backend_renderer_and_allocator(
struct wlr_backend *backend) {
struct wlr_renderer *renderer = wlr_backend_get_renderer(backend);
if (renderer == NULL) {
wlr_backend_destroy(backend);
return NULL;
}
struct wlr_allocator *allocator = backend_get_allocator(backend);
if (allocator == NULL) {
wlr_backend_destroy(backend);
return NULL;
}
return backend;
}
static struct wlr_backend *attempt_wl_backend(struct wl_display *display) { static struct wlr_backend *attempt_wl_backend(struct wl_display *display) {
struct wlr_backend *backend = wlr_wl_backend_create(display, NULL); struct wlr_backend *backend = wlr_wl_backend_create(display, NULL);
if (backend == NULL) { if (backend == NULL) {
@ -234,7 +219,7 @@ static struct wlr_backend *attempt_wl_backend(struct wl_display *display) {
wlr_wl_output_create(backend); wlr_wl_output_create(backend);
} }
return ensure_backend_renderer_and_allocator(backend); return backend;
} }
#if WLR_HAS_X11_BACKEND #if WLR_HAS_X11_BACKEND
@ -250,7 +235,7 @@ static struct wlr_backend *attempt_x11_backend(struct wl_display *display,
wlr_x11_output_create(backend); wlr_x11_output_create(backend);
} }
return ensure_backend_renderer_and_allocator(backend); return backend;
} }
#endif #endif
@ -266,7 +251,7 @@ static struct wlr_backend *attempt_headless_backend(
wlr_headless_add_output(backend, 1280, 720); wlr_headless_add_output(backend, 1280, 720);
} }
return ensure_backend_renderer_and_allocator(backend); return backend;
} }
static struct wlr_backend *attempt_noop_backend(struct wl_display *display) { static struct wlr_backend *attempt_noop_backend(struct wl_display *display) {
@ -320,7 +305,7 @@ static struct wlr_backend *attempt_drm_backend(struct wl_display *display,
return NULL; return NULL;
} }
return ensure_backend_renderer_and_allocator(primary_drm); return backend;
} }
#endif #endif