[Intel-gfx] [RFC 2/2] drm/i915/vrr: Attach and set drm crtc vrr_enabled property

Bhanuprakash Modem bhanuprakash.modem at intel.com
Fri Apr 22 07:55:36 UTC 2022


This function attaches & sets the vrr_enabled property for crtc
based on the platform support and the request from userspace.

Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Cc: Manasi Navare <manasi.d.navare at intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 drivers/gpu/drm/i915/display/intel_crtc.c | 3 +++
 drivers/gpu/drm/i915/display/intel_vrr.c  | 7 ++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c
index 4442aa355f86..36deaca9af66 100644
--- a/drivers/gpu/drm/i915/display/intel_crtc.c
+++ b/drivers/gpu/drm/i915/display/intel_crtc.c
@@ -366,6 +366,9 @@ int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 						BIT(DRM_SCALING_FILTER_DEFAULT) |
 						BIT(DRM_SCALING_FILTER_NEAREST_NEIGHBOR));
 
+	if (HAS_VRR(dev_priv))
+		drm_mode_crtc_attach_vrr_enabled_property(&crtc->base);
+
 	intel_color_init(crtc);
 
 	intel_crtc_drrs_init(crtc);
diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
index 396f2f994fa0..6cb8410bd4a0 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.c
+++ b/drivers/gpu/drm/i915/display/intel_vrr.c
@@ -160,8 +160,11 @@ void intel_vrr_enable(struct intel_encoder *encoder,
 	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
 	u32 trans_vrr_ctl;
 
-	if (!crtc_state->vrr.enable)
+	if (!crtc_state->vrr.enable) {
+		drm_mode_crtc_set_vrr_enabled_property(crtc_state->uapi.crtc, false);
 		return;
+	}
+	drm_mode_crtc_set_vrr_enabled_property(crtc_state->uapi.crtc, true);
 
 	if (DISPLAY_VER(dev_priv) >= 13)
 		trans_vrr_ctl = VRR_CTL_VRR_ENABLE |
@@ -211,6 +214,8 @@ void intel_vrr_disable(const struct intel_crtc_state *old_crtc_state)
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder;
 
+	drm_mode_crtc_set_vrr_enabled_property(old_crtc_state->uapi.crtc, false);
+
 	if (!old_crtc_state->vrr.enable)
 		return;
 
-- 
2.35.1



More information about the Intel-gfx mailing list