diff options
author | Simon Ser <contact@emersion.fr> | 2020-11-18 14:16:22 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-11-30 11:08:44 +0100 |
commit | 5d008d90309defd2ed15f1b9525c551ecb38e21d (patch) | |
tree | 54e27d79cc93ec87646207a07de690371302b24f /render | |
parent | 61612ecb3688431b85a55d046a49b3700826990d (diff) |
render: introduce wlr_renderer_get_dmabuf_render_formats
It describes which DMA-BUF formats can be used to render.
Diffstat (limited to 'render')
-rw-r--r-- | render/egl.c | 12 | ||||
-rw-r--r-- | render/gles2/renderer.c | 7 | ||||
-rw-r--r-- | render/wlr_renderer.c | 8 |
3 files changed, 27 insertions, 0 deletions
diff --git a/render/egl.c b/render/egl.c index 6382c0c3..2180c7a1 100644 --- a/render/egl.c +++ b/render/egl.c @@ -158,10 +158,16 @@ static void init_dmabuf_formats(struct wlr_egl *egl) { if (modifiers_len == 0) { wlr_drm_format_set_add(&egl->dmabuf_formats, fmt, DRM_FORMAT_MOD_INVALID); + wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt, + DRM_FORMAT_MOD_INVALID); } for (int j = 0; j < modifiers_len; j++) { wlr_drm_format_set_add(&egl->dmabuf_formats, fmt, modifiers[j]); + if (!external_only[j]) { + wlr_drm_format_set_add(&egl->dmabuf_render_formats, fmt, + modifiers[j]); + } } free(modifiers); @@ -397,6 +403,7 @@ void wlr_egl_finish(struct wlr_egl *egl) { } free(egl->external_only_dmabuf_formats); + wlr_drm_format_set_finish(&egl->dmabuf_render_formats); wlr_drm_format_set_finish(&egl->dmabuf_formats); eglMakeCurrent(egl->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); @@ -809,6 +816,11 @@ const struct wlr_drm_format_set *wlr_egl_get_dmabuf_formats(struct wlr_egl *egl) return &egl->dmabuf_formats; } +const struct wlr_drm_format_set *wlr_egl_get_dmabuf_render_formats( + struct wlr_egl *egl) { + return &egl->dmabuf_render_formats; +} + bool wlr_egl_export_image_to_dmabuf(struct wlr_egl *egl, EGLImageKHR image, int32_t width, int32_t height, uint32_t flags, struct wlr_dmabuf_attributes *attribs) { diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c index fbf27e49..e5bdcd75 100644 --- a/render/gles2/renderer.c +++ b/render/gles2/renderer.c @@ -435,6 +435,12 @@ static const struct wlr_drm_format_set *gles2_get_dmabuf_formats( return wlr_egl_get_dmabuf_formats(renderer->egl); } +static const struct wlr_drm_format_set *gles2_get_dmabuf_render_formats( + struct wlr_renderer *wlr_renderer) { + struct wlr_gles2_renderer *renderer = gles2_get_renderer(wlr_renderer); + return wlr_egl_get_dmabuf_render_formats(renderer->egl); +} + static enum wl_shm_format gles2_preferred_read_format( struct wlr_renderer *wlr_renderer) { struct wlr_gles2_renderer *renderer = @@ -703,6 +709,7 @@ static const struct wlr_renderer_impl renderer_impl = { .resource_is_wl_drm_buffer = gles2_resource_is_wl_drm_buffer, .wl_drm_buffer_get_size = gles2_wl_drm_buffer_get_size, .get_dmabuf_formats = gles2_get_dmabuf_formats, + .get_dmabuf_render_formats = gles2_get_dmabuf_render_formats, .preferred_read_format = gles2_preferred_read_format, .read_pixels = gles2_read_pixels, .texture_from_pixels = gles2_texture_from_pixels, diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c index 0fb7fbda..f366f80f 100644 --- a/render/wlr_renderer.c +++ b/render/wlr_renderer.c @@ -173,6 +173,14 @@ const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_formats( return r->impl->get_dmabuf_formats(r); } +const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_render_formats( + struct wlr_renderer *r) { + if (!r->impl->get_dmabuf_render_formats) { + return NULL; + } + return r->impl->get_dmabuf_render_formats(r); +} + bool wlr_renderer_read_pixels(struct wlr_renderer *r, enum wl_shm_format fmt, uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height, uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, |