From b2ceb055d6c9f9f93a1894e8915c695e379ba722 Mon Sep 17 00:00:00 2001 From: Dor Askayo Date: Sun, 31 Jul 2022 14:04:01 +0300 Subject: [PATCH] backends/native: Add support to disable VRR using udev This can be used to disable VRR in specific drivers and hardware combinations where it is found to be problematic. No default rules are added for now to encourage testing. Part-of: --- src/backends/native/meta-backend-native.c | 3 +++ src/backends/native/meta-kms-types.h | 1 + src/backends/native/meta-udev.c | 7 +++++++ src/backends/native/meta-udev.h | 2 ++ 4 files changed, 13 insertions(+) diff --git a/src/backends/native/meta-backend-native.c b/src/backends/native/meta-backend-native.c index a31bb3ec5..7a8b89de0 100644 --- a/src/backends/native/meta-backend-native.c +++ b/src/backends/native/meta-backend-native.c @@ -537,6 +537,9 @@ add_drm_device (MetaBackendNative *backend_native, if (meta_is_udev_device_disable_modifiers (device)) flags |= META_KMS_DEVICE_FLAG_DISABLE_MODIFIERS; + if (meta_is_udev_device_disable_vrr (device)) + flags |= META_KMS_DEVICE_FLAG_DISABLE_VRR; + if (meta_is_udev_device_preferred_primary (device)) flags |= META_KMS_DEVICE_FLAG_PREFERRED_PRIMARY; diff --git a/src/backends/native/meta-kms-types.h b/src/backends/native/meta-kms-types.h index 3a093a1c4..f20464dcf 100644 --- a/src/backends/native/meta-kms-types.h +++ b/src/backends/native/meta-kms-types.h @@ -63,6 +63,7 @@ typedef enum _MetaKmsDeviceFlag META_KMS_DEVICE_FLAG_HAS_ADDFB2 = 1 << 5, META_KMS_DEVICE_FLAG_FORCE_LEGACY = 1 << 6, META_KMS_DEVICE_FLAG_DISABLE_CLIENT_MODIFIERS = 1 << 7, + META_KMS_DEVICE_FLAG_DISABLE_VRR = 1 << 8, } MetaKmsDeviceFlag; typedef enum _MetaKmsResourceChanges diff --git a/src/backends/native/meta-udev.c b/src/backends/native/meta-udev.c index 73dd92c3e..097e8a283 100644 --- a/src/backends/native/meta-udev.c +++ b/src/backends/native/meta-udev.c @@ -100,6 +100,13 @@ meta_is_udev_device_disable_modifiers (GUdevDevice *device) "mutter-device-disable-kms-modifiers"); } +gboolean +meta_is_udev_device_disable_vrr (GUdevDevice *device) +{ + return meta_has_udev_device_tag (device, + "mutter-device-disable-vrr"); +} + gboolean meta_is_udev_device_ignore (GUdevDevice *device) { diff --git a/src/backends/native/meta-udev.h b/src/backends/native/meta-udev.h index 7e19921b2..8cb5d0788 100644 --- a/src/backends/native/meta-udev.h +++ b/src/backends/native/meta-udev.h @@ -32,6 +32,8 @@ gboolean meta_is_udev_device_boot_vga (GUdevDevice *device); gboolean meta_is_udev_device_disable_modifiers (GUdevDevice *device); +gboolean meta_is_udev_device_disable_vrr (GUdevDevice *device); + gboolean meta_is_udev_device_ignore (GUdevDevice *device); gboolean meta_is_udev_test_device (GUdevDevice *device);