[mutter] kms-impl-device: Remember the min/max values for a DRM_MODE_PROP_RANGE



commit f760b47a3cda90ff8290925401ebb70a9469bdb9
Author: Daniel van Vugt <daniel van vugt canonical com>
Date:   Tue Jun 14 16:27:53 2022 +0800

    kms-impl-device: Remember the min/max values for a DRM_MODE_PROP_RANGE
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2412>

 src/backends/native/meta-kms-impl-device.c | 14 ++++++++++++++
 src/backends/native/meta-kms-impl-device.h |  3 +++
 2 files changed, 17 insertions(+)
---
diff --git a/src/backends/native/meta-kms-impl-device.c b/src/backends/native/meta-kms-impl-device.c
index dc2ac31ef4..b1dd321a7f 100644
--- a/src/backends/native/meta-kms-impl-device.c
+++ b/src/backends/native/meta-kms-impl-device.c
@@ -690,6 +690,20 @@ meta_kms_impl_device_update_prop_table (MetaKmsImplDevice *impl_device,
 
       update_prop_value (prop, prop_value);
 
+      if (prop->type == DRM_MODE_PROP_RANGE)
+        {
+          if (drm_prop->count_values == 2)
+            {
+              prop->range_min = drm_prop->values[0];
+              prop->range_max = drm_prop->values[1];
+            }
+          else
+            {
+              g_warning ("DRM property '%s' is a range with %d values, ignoring",
+                         drm_prop->name, drm_prop->count_values);
+            }
+        }
+
       drmModeFreeProperty (drm_prop);
     }
 }
diff --git a/src/backends/native/meta-kms-impl-device.h b/src/backends/native/meta-kms-impl-device.h
index c5ac131cc2..a45d24bedb 100644
--- a/src/backends/native/meta-kms-impl-device.h
+++ b/src/backends/native/meta-kms-impl-device.h
@@ -64,6 +64,9 @@ struct _MetaKmsProp
   MetaKmsEnum *enum_values;
   uint64_t default_value;
 
+  uint64_t range_min;
+  uint64_t range_max;
+
   uint32_t prop_id;
   uint64_t value;
 };


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