@@ -883,3 +883,47 @@ int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
return 0;
}
EXPORT_SYMBOL(drm_crtc_create_scaling_filter_property);
+
+/**
+ * drm_mode_crtc_attach_vrr_enabled_property - attaches the vrr_enabled property
+ * @crtc: drm CRTC to attach the vrr_enabled property on.
+ *
+ * This is used by atomic drivers to add support for querying
+ * VRR enabled status for a crtc.
+ */
+void drm_mode_crtc_attach_vrr_enabled_property(struct drm_crtc *crtc)
+{
+ struct drm_device *dev = crtc->dev;
+ struct drm_mode_config *config = &dev->mode_config;
+
+ if (!config->prop_vrr_enabled)
+ return;
+
+ drm_object_attach_property(&crtc->base,
+ config->prop_vrr_enabled,
+ 0);
+}
+EXPORT_SYMBOL(drm_mode_crtc_attach_vrr_enabled_property);
+
+/**
+ * drm_mode_crtc_set_vrr_enabled_property - sets the vrr enabled property for
+ * a crtc.
+ * @crtc: drm CRTC
+ * @vrr_enabled: True to enable the VRR on CRTC
+ *
+ * Should be used by atomic drivers to update the VRR enabled status on a CRTC
+ */
+void drm_mode_crtc_set_vrr_enabled_property(struct drm_crtc *crtc,
+ bool vrr_enabled)
+{
+ struct drm_device *dev = crtc->dev;
+ struct drm_mode_config *config = &dev->mode_config;
+
+ if (!config->prop_vrr_enabled)
+ return;
+
+ drm_object_property_set_value(&crtc->base,
+ config->prop_vrr_enabled,
+ vrr_enabled);
+}
+EXPORT_SYMBOL(drm_mode_crtc_set_vrr_enabled_property);
@@ -1333,4 +1333,8 @@ static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
int drm_crtc_create_scaling_filter_property(struct drm_crtc *crtc,
unsigned int supported_filters);
+void drm_mode_crtc_attach_vrr_enabled_property(struct drm_crtc *crtc);
+void drm_mode_crtc_set_vrr_enabled_property(struct drm_crtc *crtc,
+ bool vrr_enabled);
+
#endif /* __DRM_CRTC_H__ */
Modern display hardware is capable of supporting variable refresh rates. This patch introduces helpers to attach and set "vrr_enabled" property on the crtc to allow userspace to query VRR enabled status on that crtc. Atomic drivers should attach this property to crtcs those are capable of driving variable refresh rates using drm_mode_crtc_attach_vrr_enabled_property(). The value should be updated based on driver and hardware capability by using drm_mode_crtc_set_vrr_enabled_property(). Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Cc: Manasi Navare <manasi.d.navare@intel.com> Cc: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com> --- drivers/gpu/drm/drm_crtc.c | 44 ++++++++++++++++++++++++++++++++++++++ include/drm/drm_crtc.h | 4 ++++ 2 files changed, 48 insertions(+)