diff options
author | Leonardo Hernández Hernández <leohdz172@proton.me> | 2023-03-07 22:04:32 -0600 |
---|---|---|
committer | Leonardo Hernández Hernández <leohdz172@proton.me> | 2023-03-07 22:04:32 -0600 |
commit | eaf6dd2cd2f8c25a8cbce0e57221f73168a2bdc8 (patch) | |
tree | af1e7ca3813d3665392c70d4ee1c41139fba6b68 | |
parent | d1b36925c9e08aa26f72c4199c4046b0800c2266 (diff) |
do not call dmabuf_create twice
it is called automatically by `wlr_renderer_init_wl_display()` but since we
need a pointer to wlr_linux_dmabuf_v1 to integrate it with scene API we need
to recreate that function.
Bug: https://github.com/emersion/xdg-desktop-portal-wlr/issues/216
Fixes: https://github.com/djpohly/dwl/issues/398
-rw-r--r-- | dwl.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -20,6 +20,7 @@ #include <wlr/types/wlr_cursor.h> #include <wlr/types/wlr_data_control_v1.h> #include <wlr/types/wlr_data_device.h> +#include <wlr/types/wlr_drm.h> #include <wlr/types/wlr_linux_dmabuf_v1.h> #include <wlr/types/wlr_export_dmabuf_v1.h> #include <wlr/types/wlr_fractional_scale_v1.h> @@ -2174,7 +2175,19 @@ setup(void) /* Create a renderer with the default implementation */ if (!(drw = wlr_renderer_autocreate(backend))) die("couldn't create renderer"); - wlr_renderer_init_wl_display(drw, dpy); + + /* Create shm, drm and linux_dmabuf interfaces by ourselves. + * The simplest way is call: + * wlr_renderer_init_wl_display(drw); + * but we need to create manually the linux_dmabuf interface to integrate it + * with wlr_scene. */ + wlr_renderer_init_wl_shm(drw, dpy); + + if (wlr_renderer_get_dmabuf_texture_formats(drw)) { + wlr_drm_create(dpy, drw); + wlr_scene_set_linux_dmabuf_v1(scene, + wlr_linux_dmabuf_v1_create_with_renderer(dpy, 4, drw)); + } /* Create a default allocator */ if (!(alloc = wlr_allocator_autocreate(backend, drw))) @@ -2303,9 +2316,6 @@ setup(void) wl_signal_add(&output_mgr->events.test, &output_mgr_test); wlr_scene_set_presentation(scene, wlr_presentation_create(dpy, backend)); - wlr_scene_set_linux_dmabuf_v1(scene, - wlr_linux_dmabuf_v1_create_with_renderer(dpy, 4, drw)); - #ifdef XWAYLAND /* |