From f1eaf26845e12dc1abe06d66a159f557f2450425 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Fri, 13 Oct 2023 14:49:21 +0200 Subject: [PATCH] wayland/dma-buf: Advertise INVALID modifier without AddFb2 If DRM_CAP_ADDFB2_MODIFIERS isn't supported, scanout tranches should advertise only DRM_FORMAT_MOD_INVALID if supported by EGL. Part-of: --- src/wayland/meta-wayland-dma-buf.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c index eacf597fc..79a0f1409 100644 --- a/src/wayland/meta-wayland-dma-buf.c +++ b/src/wayland/meta-wayland-dma-buf.c @@ -176,6 +176,18 @@ should_send_modifiers (MetaBackend *backend) return meta_renderer_native_send_modifiers (renderer_native); } +static gboolean +should_send_modifiers_scanout_tranches (MetaBackend *backend) +{ + MetaRendererNative *renderer_native; + + if (!META_IS_BACKEND_NATIVE (backend) || !should_send_modifiers (backend)) + return FALSE; + + renderer_native = META_RENDERER_NATIVE (meta_backend_get_renderer (backend)); + return meta_renderer_native_has_addfb2 (renderer_native); +} + static gint compare_tranches (gconstpointer a, gconstpointer b) @@ -1251,7 +1263,7 @@ ensure_scanout_tranche (MetaWaylandDmaBufSurfaceFeedback *surface_feedback, } formats = g_array_new (FALSE, FALSE, sizeof (MetaWaylandDmaBufFormat)); - if (should_send_modifiers (backend)) + if (should_send_modifiers_scanout_tranches (backend)) { for (i = 0; i < dma_buf_manager->formats->len; i++) {