[PATCH 22/23] drm/i915/vrr: Always use VRR timing generator for XE2LPD+
Ankit Nautiyal
ankit.k.nautiyal at intel.com
Mon Nov 11 04:13:24 UTC 2024
Currently VRR timing generator is used only when VRR is enabled by
userspace. From XE2LPD+, gradually move away from older timing
generator and use VRR timing generator for fixed refresh rate also.
In such a case, Flipline VMin and VMax all are set to the Vtotal of the
mode, which effectively makes the VRR timing generator work in
fixed refresh rate mode
Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal at intel.com>
---
drivers/gpu/drm/i915/display/intel_vrr.c | 70 +++++++++++++++++++++---
1 file changed, 62 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
index 25fb63ca3ef2..443d0d26d581 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.c
+++ b/drivers/gpu/drm/i915/display/intel_vrr.c
@@ -235,9 +235,20 @@ void intel_vrr_compute_vrr_timings(struct intel_crtc_state *crtc_state, int vmin
crtc_state->mode_flags |= I915_MODE_FLAG_VRR;
}
-void
-intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
- struct drm_connector_state *conn_state)
+static
+void intel_vrr_compute_fixed_rr_timings(struct intel_crtc_state *crtc_state)
+{
+ crtc_state->vrr.vmax = crtc_state->hw.adjusted_mode.vtotal - 1;
+ crtc_state->vrr.vmin = crtc_state->vrr.vmax;
+ crtc_state->vrr.flipline = crtc_state->vrr.vmax;
+ crtc_state->vrr.tg_enable = true;
+ crtc_state->vrr.mode = INTEL_VRRTG_MODE_FIXED_RR;
+ crtc_state->mode_flags |= I915_MODE_FLAG_VRR;
+}
+
+static
+void intel_vrr_compute_xe2lpd_timings(struct intel_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
{
struct intel_display *display = to_intel_display(crtc_state);
struct intel_connector *connector =
@@ -245,13 +256,35 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
struct intel_dp *intel_dp = intel_attached_dp(connector);
bool is_edp = intel_dp_is_edp(intel_dp);
struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
- int vmin, vmax;
+ int vmin = 0, vmax = 0;
- if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
- return;
+ if (crtc_state->vrr.in_range) {
+ vmin = intel_vrr_compute_vmin(connector, adjusted_mode);
+ vmax = intel_vrr_compute_vmax(connector, adjusted_mode);
+ if (HAS_LRR(display))
+ crtc_state->update_lrr = true;
+ }
+
+ if (crtc_state->vrr.in_range && vmin < vmax && crtc_state->uapi.vrr_enabled)
+ intel_vrr_compute_vrr_timings(crtc_state, vmin, vmax);
+ else if (crtc_state->vrr.in_range && vmin < vmax && is_cmrr_frac_required(crtc_state) && is_edp)
+ intel_vrr_compute_cmrr_timings(crtc_state);
+ else
+ intel_vrr_compute_fixed_rr_timings(crtc_state);
+}
+
+static
+void intel_vrr_compute_xelpd_timings(struct intel_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
+{
+ struct intel_display *display = to_intel_display(crtc_state);
+ struct intel_connector *connector =
+ to_intel_connector(conn_state->connector);
+ struct intel_dp *intel_dp = intel_attached_dp(connector);
+ bool is_edp = intel_dp_is_edp(intel_dp);
+ struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
+ int vmin, vmax;
- crtc_state->vrr.in_range =
- intel_vrr_is_in_range(connector, drm_mode_vrefresh(adjusted_mode));
if (!crtc_state->vrr.in_range)
return;
@@ -270,6 +303,27 @@ intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
intel_vrr_compute_cmrr_timings(crtc_state);
else
intel_vrr_prepare_vrr_timings(crtc_state, vmin, vmax);
+}
+
+void
+intel_vrr_compute_config(struct intel_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
+{
+ struct intel_display *display = to_intel_display(crtc_state);
+ struct intel_connector *connector =
+ to_intel_connector(conn_state->connector);
+ struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
+
+ if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
+ return;
+
+ crtc_state->vrr.in_range =
+ intel_vrr_is_in_range(connector, drm_mode_vrefresh(adjusted_mode));
+
+ if (DISPLAY_VER(display) >= 20)
+ intel_vrr_compute_xe2lpd_timings(crtc_state, conn_state);
+ else
+ intel_vrr_compute_xelpd_timings(crtc_state, conn_state);
if (HAS_AS_SDP(display)) {
crtc_state->vrr.vsync_start =
--
2.45.2
More information about the Intel-gfx-trybot
mailing list