diff --git a/include/wlr/types/wlr_linux_dmabuf_v1.h b/include/wlr/types/wlr_linux_dmabuf_v1.h index bfc024eb..07372fc8 100644 --- a/include/wlr/types/wlr_linux_dmabuf_v1.h +++ b/include/wlr/types/wlr_linux_dmabuf_v1.h @@ -77,7 +77,7 @@ struct wlr_linux_dmabuf_v1 { * The default DMA-BUF feedback is initialized from the struct wlr_renderer. */ struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create_with_renderer(struct wl_display *display, - struct wlr_renderer *renderer); + uint32_t version, struct wlr_renderer *renderer); /** * Set a surface's DMA-BUF feedback. diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index 3f0d56ac..f01c9345 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -232,7 +232,7 @@ bool wlr_renderer_init_wl_display(struct wlr_renderer *r, wlr_log(WLR_INFO, "Cannot get renderer DRM FD, disabling wl_drm"); } - if (wlr_linux_dmabuf_v1_create_with_renderer(wl_display, r) == NULL) { + if (wlr_linux_dmabuf_v1_create_with_renderer(wl_display, 4, r) == NULL) { return false; } } diff --git a/types/wlr_linux_dmabuf_v1.c b/types/wlr_linux_dmabuf_v1.c index e463d4d5..f0f619c7 100644 --- a/types/wlr_linux_dmabuf_v1.c +++ b/types/wlr_linux_dmabuf_v1.c @@ -927,7 +927,9 @@ static void handle_renderer_destroy(struct wl_listener *listener, void *data) { } struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create_with_renderer(struct wl_display *display, - struct wlr_renderer *renderer) { + uint32_t version, struct wlr_renderer *renderer) { + assert(version <= LINUX_DMABUF_VERSION); + struct wlr_linux_dmabuf_v1 *linux_dmabuf = calloc(1, sizeof(struct wlr_linux_dmabuf_v1)); if (linux_dmabuf == NULL) { @@ -939,9 +941,8 @@ struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create_with_renderer(struct wl_d wl_list_init(&linux_dmabuf->surfaces); wl_signal_init(&linux_dmabuf->events.destroy); - linux_dmabuf->global = - wl_global_create(display, &zwp_linux_dmabuf_v1_interface, - LINUX_DMABUF_VERSION, linux_dmabuf, linux_dmabuf_bind); + linux_dmabuf->global = wl_global_create(display, &zwp_linux_dmabuf_v1_interface, + version, linux_dmabuf, linux_dmabuf_bind); if (!linux_dmabuf->global) { wlr_log(WLR_ERROR, "could not create linux dmabuf v1 wl global"); free(linux_dmabuf);