[mutter] kms/device: Differentiate between lack of AddFb2() and udev rule



commit 50396fc00e3c90c091bd613ad16278c4ac2c412b
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Mon Aug 1 21:15:12 2022 +0200

    kms/device: Differentiate between lack of AddFb2() and udev rule
    
    We disable modifiers for two reasons: an udev rule saying so, or the
    lack of a working drmModeAddFB2(). However, to the users, this is not
    granular enough. While the current user, whether to enable modifiers in
    MetaRendererNative, doesn't need more granularity, we want to send
    modifiers to Wayland clients even if the onscreen framebuffers should
    still be allocated without modifiers.
    
    Prepare for differentiating between how Wayland DMA buffers work and how
    onscreen buffer allocation work by separating the relevant device flags.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2546>

 src/backends/native/meta-gpu-kms.c         | 9 ---------
 src/backends/native/meta-gpu-kms.h         | 1 -
 src/backends/native/meta-kms-device.c      | 4 ++--
 src/backends/native/meta-kms-types.h       | 1 +
 src/backends/native/meta-renderer-native.c | 8 +++++++-
 5 files changed, 10 insertions(+), 13 deletions(-)
---
diff --git a/src/backends/native/meta-gpu-kms.c b/src/backends/native/meta-gpu-kms.c
index 97b47f9f9c..84ea6baa2b 100644
--- a/src/backends/native/meta-gpu-kms.c
+++ b/src/backends/native/meta-gpu-kms.c
@@ -134,15 +134,6 @@ meta_gpu_kms_is_platform_device (MetaGpuKms *gpu_kms)
   return !!(flags & META_KMS_DEVICE_FLAG_PLATFORM_DEVICE);
 }
 
-gboolean
-meta_gpu_kms_disable_modifiers (MetaGpuKms *gpu_kms)
-{
-  MetaKmsDeviceFlag flags;
-
-  flags = meta_kms_device_get_flags (gpu_kms->kms_device);
-  return !!(flags & META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS);
-}
-
 static int
 compare_outputs (gconstpointer one,
                  gconstpointer two)
diff --git a/src/backends/native/meta-gpu-kms.h b/src/backends/native/meta-gpu-kms.h
index e6f8b3e879..7a890c8454 100644
--- a/src/backends/native/meta-gpu-kms.h
+++ b/src/backends/native/meta-gpu-kms.h
@@ -47,7 +47,6 @@ gboolean meta_gpu_kms_is_crtc_active (MetaGpuKms *gpu_kms,
 
 gboolean meta_gpu_kms_is_boot_vga (MetaGpuKms *gpu_kms);
 gboolean meta_gpu_kms_is_platform_device (MetaGpuKms *gpu_kms);
-gboolean meta_gpu_kms_disable_modifiers (MetaGpuKms *gpu_kms);
 
 MetaKmsDevice * meta_gpu_kms_get_kms_device (MetaGpuKms *gpu_kms);
 
diff --git a/src/backends/native/meta-kms-device.c b/src/backends/native/meta-kms-device.c
index afc264dfe3..15ae92a262 100644
--- a/src/backends/native/meta-kms-device.c
+++ b/src/backends/native/meta-kms-device.c
@@ -550,8 +550,8 @@ meta_kms_device_new (MetaKms            *kms,
   free (device->path);
   device->path = data.out_path;
 
-  if (!device->caps.addfb2_modifiers)
-    device->flags |= META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS;
+  if (device->caps.addfb2_modifiers)
+    device->flags |= META_KMS_DEVICE_FLAG_HAS_ADDFB2;
 
   return device;
 }
diff --git a/src/backends/native/meta-kms-types.h b/src/backends/native/meta-kms-types.h
index 37595c6120..a2e2f8ded3 100644
--- a/src/backends/native/meta-kms-types.h
+++ b/src/backends/native/meta-kms-types.h
@@ -62,6 +62,7 @@ typedef enum _MetaKmsDeviceFlag
   META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS = 1 << 2,
   META_KMS_DEVICE_FLAG_PREFERRED_PRIMARY = 1 << 3,
   META_KMS_DEVICE_FLAG_NO_MODE_SETTING = 1 << 4,
+  META_KMS_DEVICE_FLAG_HAS_ADDFB2 = 1 << 5,
 } MetaKmsDeviceFlag;
 
 typedef enum _MetaKmsResourceChanges
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index f5f22c7b1e..76169d5107 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -2125,8 +2125,14 @@ meta_renderer_native_initable_init (GInitable     *initable,
         }
       else
         {
+          MetaKmsDevice *kms_device =
+            meta_gpu_kms_get_kms_device (renderer_native->primary_gpu_kms);
+          MetaKmsDeviceFlag flags;
+
+          flags = meta_kms_device_get_flags (kms_device);
           renderer_native->use_modifiers =
-            !meta_gpu_kms_disable_modifiers (renderer_native->primary_gpu_kms);
+            !(flags & META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS) &&
+            flags & META_KMS_DEVICE_FLAG_HAS_ADDFB2;
         }
 
       meta_topic (META_DEBUG_KMS, "Usage of KMS modifiers is %s",


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