[mutter] wayland/dma-buf: Always send modifiers if AddFB2() is supported



commit 34475e7e983aec72e1207ce4aacb36f7b81b246d
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Mon Aug 1 21:19:01 2022 +0200

    wayland/dma-buf: Always send modifiers if AddFB2() is supported
    
    To Wayland clients, it doesn't matter how we configure our onscreen
    buffers, since they don't necessarily have the same bandwidth issues
    related to mode setting, whichis the primary reason why we disable
    modifiers using the udev rule, so simply check whether importing with
    modifiers will work at all and advertise modifiers if so is the case.
    
    This might help avoid issues using legacy non-modifiers path in drivers.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>

 src/wayland/meta-wayland-dma-buf.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c
index cc95cf6871..67ebbec84e 100644
--- a/src/wayland/meta-wayland-dma-buf.c
+++ b/src/wayland/meta-wayland-dma-buf.c
@@ -56,6 +56,7 @@
 
 #ifdef HAVE_NATIVE_BACKEND
 #include "backends/native/meta-drm-buffer-gbm.h"
+#include "backends/native/meta-kms-device.h"
 #include "backends/native/meta-kms-utils.h"
 #include "backends/native/meta-onscreen-native.h"
 #include "backends/native/meta-renderer-native.h"
@@ -151,22 +152,18 @@ static GQuark quark_dma_buf_surface_feedback;
 static gboolean
 should_send_modifiers (MetaBackend *backend)
 {
-  MetaSettings *settings = meta_backend_get_settings (backend);
+  MetaRenderer *renderer = meta_backend_get_renderer (backend);
+  MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
+  MetaGpuKms *gpu_kms;
+  MetaKmsDevice *kms_device;
+  MetaKmsDeviceFlag flags;
 
-  if (meta_settings_is_experimental_feature_enabled (
-        settings, META_EXPERIMENTAL_FEATURE_KMS_MODIFIERS))
-    return TRUE;
+  gpu_kms = meta_renderer_native_get_primary_gpu (renderer_native);
+  kms_device = meta_gpu_kms_get_kms_device (gpu_kms);
 
-#ifdef HAVE_NATIVE_BACKEND
-  if (META_IS_BACKEND_NATIVE (backend))
-    {
-      MetaRenderer *renderer = meta_backend_get_renderer (backend);
-      MetaRendererNative *renderer_native = META_RENDERER_NATIVE (renderer);
-      return meta_renderer_native_use_modifiers (renderer_native);
-    }
-#endif
+  flags = meta_kms_device_get_flags (kms_device);
 
-  return FALSE;
+  return !!(flags & META_KMS_DEVICE_FLAG_HAS_ADDFB2);
 }
 
 static gint


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]