From 5d008d90309defd2ed15f1b9525c551ecb38e21d Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 18 Nov 2020 14:16:22 +0100 Subject: render: introduce wlr_renderer_get_dmabuf_render_formats It describes which DMA-BUF formats can be used to render. --- include/render/wlr_renderer.h | 6 ++++++ include/wlr/render/egl.h | 6 ++++++ include/wlr/render/interface.h | 2 ++ 3 files changed, 14 insertions(+) (limited to 'include') diff --git a/include/render/wlr_renderer.h b/include/render/wlr_renderer.h index 0ef1ef82..8e113ac8 100644 --- a/include/render/wlr_renderer.h +++ b/include/render/wlr_renderer.h @@ -4,5 +4,11 @@ #include bool wlr_renderer_bind_buffer(struct wlr_renderer *r, struct wlr_buffer *buffer); +/** + * Get the DMA-BUF formats supporting rendering usage. Buffers allocated with + * a format from this list may be attached via wlr_renderer_bind_buffer. + */ +const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_render_formats( + struct wlr_renderer *renderer); #endif diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index 4ab672d3..f2d04049 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -78,6 +78,7 @@ struct wlr_egl { struct wl_display *wl_display; struct wlr_drm_format_set dmabuf_formats; + struct wlr_drm_format_set dmabuf_render_formats; EGLBoolean **external_only_dmabuf_formats; }; @@ -126,6 +127,11 @@ EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl, * Get DMA-BUF formats suitable for sampling usage. */ const struct wlr_drm_format_set *wlr_egl_get_dmabuf_formats(struct wlr_egl *egl); +/** + * Get DMA-BUF formats suitable for rendering usage. + */ +const struct wlr_drm_format_set *wlr_egl_get_dmabuf_render_formats( + struct wlr_egl *egl); bool wlr_egl_export_image_to_dmabuf(struct wlr_egl *egl, EGLImageKHR image, int32_t width, int32_t height, uint32_t flags, diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index 625ab198..44b5a48c 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -52,6 +52,8 @@ struct wlr_renderer_impl { struct wl_resource *buffer, int *width, int *height); const struct wlr_drm_format_set *(*get_dmabuf_formats)( struct wlr_renderer *renderer); + const struct wlr_drm_format_set *(*get_dmabuf_render_formats)( + struct wlr_renderer *renderer); enum wl_shm_format (*preferred_read_format)(struct wlr_renderer *renderer); bool (*read_pixels)(struct wlr_renderer *renderer, enum wl_shm_format fmt, uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height, -- cgit v1.2.3