[PATCH] drm/i915/vrr: Reject the commit if panel is non-VRR

Bhanuprakash Modem bhanuprakash.modem at intel.com
Sat Sep 17 12:20:30 UTC 2022


Test-with: 20220916070834.1475791-2-bhanuprakash.modem at intel.com

Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp.c  |  5 ++++-
 drivers/gpu/drm/i915/display/intel_vrr.c | 19 +++++++++++--------
 drivers/gpu/drm/i915/display/intel_vrr.h |  2 +-
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index c9be61d2348e..cb18f21927d9 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -2105,7 +2105,10 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 	if (!HAS_DDI(dev_priv))
 		g4x_dp_set_clock(encoder, pipe_config);
 
-	intel_vrr_compute_config(pipe_config, conn_state);
+	ret = intel_vrr_compute_config(pipe_config, conn_state);
+	if (ret)
+		return ret;
+
 	intel_psr_compute_config(intel_dp, pipe_config, conn_state);
 	intel_dp_drrs_compute_config(connector, pipe_config, output_bpp);
 	intel_dp_compute_vsc_sdp(intel_dp, pipe_config, conn_state);
diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
index 5eac99021875..8828f3bb8043 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.c
+++ b/drivers/gpu/drm/i915/display/intel_vrr.c
@@ -95,7 +95,7 @@ int intel_vrr_vmax_vblank_start(const struct intel_crtc_state *crtc_state)
 	return crtc_state->vrr.vmax - intel_vrr_vblank_exit_length(crtc_state);
 }
 
-void
+int
 intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
 			 struct drm_connector_state *conn_state)
 {
@@ -107,14 +107,15 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
 	const struct drm_display_info *info = &connector->base.display_info;
 	int vmin, vmax;
 
-	if (!intel_vrr_is_capable(connector))
-		return;
+	if (!crtc_state->uapi.vrr_enabled)
+		return 0;
 
-	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
-		return;
+	if (crtc_state->uapi.vrr_enabled && (!intel_vrr_is_capable(connector) ||
+					     !crtc_state->uapi.connector_mask))
+		return -EINVAL;
 
-	if (!crtc_state->uapi.vrr_enabled)
-		return;
+	if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
+		return -EINVAL;
 
 	vmin = DIV_ROUND_UP(adjusted_mode->crtc_clock * 1000,
 			    adjusted_mode->crtc_htotal * info->monitor_range.max_vfreq);
@@ -125,7 +126,7 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
 	vmax = max_t(int, vmax, adjusted_mode->crtc_vtotal);
 
 	if (vmin >= vmax)
-		return;
+		return -EINVAL;
 
 	/*
 	 * flipline determines the min vblank length the hardware will
@@ -167,6 +168,8 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
 	}
 
 	crtc_state->mode_flags |= I915_MODE_FLAG_VRR;
+
+	return 0;
 }
 
 void intel_vrr_enable(struct intel_encoder *encoder,
diff --git a/drivers/gpu/drm/i915/display/intel_vrr.h b/drivers/gpu/drm/i915/display/intel_vrr.h
index 9fda1135b0dd..dd7701fd1df8 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.h
+++ b/drivers/gpu/drm/i915/display/intel_vrr.h
@@ -18,7 +18,7 @@ struct intel_encoder;
 
 bool intel_vrr_is_capable(struct intel_connector *connector);
 void intel_vrr_check_modeset(struct intel_atomic_state *state);
-void intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
+int intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
 			      struct drm_connector_state *conn_state);
 void intel_vrr_enable(struct intel_encoder *encoder,
 		      const struct intel_crtc_state *crtc_state);
-- 
2.37.3



More information about the Intel-gfx-trybot mailing list