From 4fa90b05119720a67ccb63cd89246abdb4abf4ea Mon Sep 17 00:00:00 2001 From: emersion Date: Tue, 23 Jan 2018 22:06:54 +0100 Subject: Backport screenshooter fixes from the renderer redesign v1 This backports some changes to #319 to fix the screenshooter data format. This also adds wlr_backend_get_renderer which will be useful to support multiple renderers. --- backend/headless/backend.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'backend/headless') diff --git a/backend/headless/backend.c b/backend/headless/backend.c index cef8eec4..61409d41 100644 --- a/backend/headless/backend.c +++ b/backend/headless/backend.c @@ -1,6 +1,6 @@ #include -#include -#include +#include +#include #include #include #include @@ -61,10 +61,18 @@ static struct wlr_egl *backend_get_egl(struct wlr_backend *wlr_backend) { return &backend->egl; } +static struct wlr_renderer *backend_get_renderer( + struct wlr_backend *wlr_backend) { + struct wlr_headless_backend *backend = + (struct wlr_headless_backend *)wlr_backend; + return backend->renderer; +} + static const struct wlr_backend_impl backend_impl = { .start = backend_start, .destroy = backend_destroy, .get_egl = backend_get_egl, + .get_renderer = backend_get_renderer, }; static void handle_display_destroy(struct wl_listener *listener, void *data) { @@ -103,6 +111,11 @@ struct wlr_backend *wlr_headless_backend_create(struct wl_display *display) { return NULL; } + backend->renderer = wlr_gles2_renderer_create(&backend->backend); + if (backend->renderer == NULL) { + wlr_log(L_ERROR, "Failed to create renderer"); + } + backend->display_destroy.notify = handle_display_destroy; wl_display_add_destroy_listener(display, &backend->display_destroy); -- cgit v1.2.3