diff options
Diffstat (limited to 'render')
-rw-r--r-- | render/gles2/renderer.c | 10 | ||||
-rw-r--r-- | render/wlr_renderer.c | 13 |
2 files changed, 19 insertions, 4 deletions
diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index 8360c5fb..5cea5c3b 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -304,6 +304,15 @@ static struct wlr_texture *gles2_texture_from_dmabuf( return wlr_gles2_texture_from_dmabuf(renderer->egl, attribs); } +static void gles2_init_wl_display(struct wlr_renderer *wlr_renderer, + struct wl_display *wl_display) { + struct wlr_gles2_renderer *renderer = + gles2_get_renderer_in_context(wlr_renderer); + if (!wlr_egl_bind_display(renderer->egl, wl_display)) { + wlr_log(L_INFO, "failed to bind wl_display to EGL"); + } +} + static void gles2_destroy(struct wlr_renderer *wlr_renderer) { struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); @@ -345,6 +354,7 @@ static const struct wlr_renderer_impl renderer_impl = { .texture_from_pixels = gles2_texture_from_pixels, .texture_from_wl_drm = gles2_texture_from_wl_drm, .texture_from_dmabuf = gles2_texture_from_dmabuf, + .init_wl_display = gles2_init_wl_display, }; void push_gles2_marker(const char *file, const char *func) { diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index 39006b58..aed821c9 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -159,9 +159,9 @@ bool wlr_renderer_format_supported(struct wlr_renderer *r, return r->impl->format_supported(r, fmt); } -void wlr_renderer_init_wl_shm(struct wlr_renderer *r, - struct wl_display *display) { - if (wl_display_init_shm(display)) { +void wlr_renderer_init_wl_display(struct wlr_renderer *r, + struct wl_display *wl_display) { + if (wl_display_init_shm(wl_display)) { wlr_log(L_ERROR, "Failed to initialize shm"); return; } @@ -174,11 +174,16 @@ void wlr_renderer_init_wl_shm(struct wlr_renderer *r, } for (size_t i = 0; i < len; ++i) { + // These formats are already added by default if (formats[i] != WL_SHM_FORMAT_ARGB8888 && formats[i] != WL_SHM_FORMAT_XRGB8888) { - wl_display_add_shm_format(display, formats[i]); + wl_display_add_shm_format(wl_display, formats[i]); } } + + if (r->impl->init_wl_display) { + r->impl->init_wl_display(r, wl_display); + } } struct wlr_renderer *wlr_renderer_autocreate(struct wlr_egl *egl, |