On 9/15/25 5:01 AM, Michel Dänzer wrote:
On 12.09.25 15:45, Derek Foreman wrote:
On 9/12/25 2:33 AM, Chuanyu Tseng wrote:
Introduce a DRM interface for DRM clients to further restrict the
VRR Range within the panel supported VRR range on a per-commit
basis.

The goal is to give DRM client the ability to do frame-doubling/
ramping themselves, or to set lower static refresh rates for power
savings.
I'm interested in limiting the range of VRR to enable HDMI's QMS/CinemaVRR features - ie: 
switching to a fixed rate for media playback without incurring screen 
blackouts/resyncs/"bonks" during the switch.

I could see using an interface such as this to do the frame rate limiting, by 
setting the lower and upper bounds both to a media file's framerate. However 
for that use case it's not precise enough, as video may have a rate like 
23.9760239... FPS.

Would it be better to expose the limits as a numerator/denominator pair so a 
rate can be something like 24000/1001fps?
I was thinking the properties could allow directly specifying the minimum and 
maximum number of total scanlines per refresh cycle, based on the assumption 
the driver needs to program something along those lines.

Surprisingly, this would also not be precise enough for exact media playback, as the exact intended framerate might not result in an integer number of scan lines. When that happens a QMS/CinemaVRR capable HDMI source is expected to periodically post a frame with a single extra scan line to minimize the error.

But I don't really know if these new properties are intended to express such a faux-constant rate (where the short term average rate is constant but frame to frame may be +1) , or if another new not-quite-orthogonal property would be required instead. Would I need a separate property for that?


This is done through 2 new CRTC properties, along with a client
cap. See the docstrings in patch for details.
Not sure why a client cap would be needed for this. Not sure even a DRM_CAP is 
needed, the properties could simply be added only if the driver supports them.


diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
index 272d6254ea47..dc4b50ff5fe0 100644
--- a/drivers/gpu/drm/drm_connector.c
+++ b/drivers/gpu/drm/drm_connector.c
@@ -2866,6 +2866,31 @@ int 
drm_connector_attach_hdr_output_metadata_property(struct drm_connector *conn
   }
   EXPORT_SYMBOL(drm_connector_attach_hdr_output_metadata_property);
   +/**
+ * drm_connector_attach_vrr_range_control_property - attach 
"VRR_RANGE_CONTROL_MIN" and
+ * "VRR_RANGE_CONTROL_MAX" property
+ *
+ * @connector: connector to attach the property on.
+ *
+ * This is used to allow the userspace to send VRR range control min and max 
value to the
+ * driver.
+ *
+ * Returns:
+ * Zero on success, negative errno on failure.
+ */
+int drm_connector_attach_vrr_range_control_property(struct drm_connector 
*connector)
+{
+    struct drm_device *dev = connector->dev;
+    struct drm_property *prop_min = 
dev->mode_config.prop_vrr_range_control_min;
+    struct drm_property *prop_max = 
dev->mode_config.prop_vrr_range_control_max;
+
+    drm_object_attach_property(&connector->base, prop_min, 0);
+    drm_object_attach_property(&connector->base, prop_max, 0);
+
+    return 0;
+}
+EXPORT_SYMBOL(drm_connector_attach_vrr_range_control_property);
To me it would make more sense for these to be CRTC properties, same as 
VRR_ENABLED.


diff --git a/drivers/gpu/drm/drm_mode_config.c 
b/drivers/gpu/drm/drm_mode_config.c
index 25f376869b3a..1f74284208c6 100644
--- a/drivers/gpu/drm/drm_mode_config.c
+++ b/drivers/gpu/drm/drm_mode_config.c
@@ -340,6 +340,20 @@ static int drm_mode_create_standard_properties(struct 
drm_device *dev)
           return -ENOMEM;
       dev->mode_config.prop_vrr_enabled = prop;
   +    prop = drm_property_create_range(dev,
+            DRM_MODE_PROP_ATOMIC | DRM_MODE_PROP_RANGE,
+            "VRR-RANGE-CONTROL-MIN", 0, UINT_MAX);
+    if (!prop)
+        return -ENOMEM;
+    dev->mode_config.prop_vrr_range_control_min = prop;
+
+    prop = drm_property_create_range(dev,
+            DRM_MODE_PROP_ATOMIC | DRM_MODE_PROP_RANGE,
+            "VRR-RANGE-CONTROL-MAX", 0, UINT_MAX);
+    if (!prop)
+        return -ENOMEM;
+    dev->mode_config.prop_vrr_range_control_max = prop;
Property names use underscores, not dashes.


Reply via email to