diff options
author | Simon Ser <contact@emersion.fr> | 2022-11-24 10:07:19 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-11-30 14:14:04 +0100 |
commit | c99c60090cdc78f29c3f545e6f51b1b650486813 (patch) | |
tree | 22d8cc91f0036372fbe40f320e1a823295fcc19b | |
parent | 444d94ef89b74500610f36c89a31f668e35a0f03 (diff) |
linux-dmabuf-v1: add version arg to create()
To be able to add support for newer versions without breaking
changes.
-rw-r--r-- | include/wlr/types/wlr_linux_dmabuf_v1.h | 2 | ||||
-rw-r--r-- | render/wlr_renderer.c | 2 | ||||
-rw-r--r-- | types/wlr_linux_dmabuf_v1.c | 9 |
3 files changed, 7 insertions, 6 deletions
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); |