From 4cd556ea20d4a598a36e4e2349acb45cc4246383 Mon Sep 17 00:00:00 2001 From: Austin Shafer Date: Fri, 2 Feb 2024 16:15:25 -0500 Subject: linux_dmabuf_v1: allow callbacks for checking dmabuf import --- include/wlr/types/wlr_linux_dmabuf_v1.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_linux_dmabuf_v1.h b/include/wlr/types/wlr_linux_dmabuf_v1.h index d25da3af..cf967f95 100644 --- a/include/wlr/types/wlr_linux_dmabuf_v1.h +++ b/include/wlr/types/wlr_linux_dmabuf_v1.h @@ -64,6 +64,9 @@ struct wlr_linux_dmabuf_v1 { int main_device_fd; // to sanity check FDs sent by clients, -1 if unavailable struct wl_listener display_destroy; + + bool (*check_dmabuf_callback)(struct wlr_dmabuf_attributes *attribs, void *data); + void *check_dmabuf_callback_data; }; /** @@ -83,6 +86,15 @@ struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *displa struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create_with_renderer(struct wl_display *display, uint32_t version, struct wlr_renderer *renderer); +/** + * Set the dmabuf import check callback + * + * This can be used by consumers who want to implement specific dmabuf checks. Useful for + * users such as gamescope who do not use the rendering logic of wlroots. + */ +void wlr_linux_dmabuf_v1_set_check_dmabuf_callback(struct wlr_linux_dmabuf_v1 *linux_dmabuf, + bool (*callback)(struct wlr_dmabuf_attributes *attribs, void *data), void *data); + /** * Set a surface's DMA-BUF feedback. * -- cgit v1.2.3