intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: ville.syrjala@linux.intel.com,
	Ankit Nautiyal <ankit.k.nautiyal@intel.com>,
	Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
Subject: [PATCH 07/12] drm/i915/vrr: Use vrr.sync_start for getting vtotal
Date: Mon, 25 Aug 2025 18:05:43 +0530	[thread overview]
Message-ID: <20250825123548.3022474-8-ankit.k.nautiyal@intel.com> (raw)
In-Reply-To: <20250825123548.3022474-1-ankit.k.nautiyal@intel.com>

Currently, in intel_vrr_get_config() crtc_vtotal is computed from
vrr.vmin vtotal, since the VTOTAL.Vtotal bits are deprecated.
Since vmin is currently set to crtc_vtotal, this gives us the vtotal.
However, as we move to optimized guardband, vmin will be modified to set
to the minimum Vtotal for highest refresh rate supported.

Instead of depending on vmin, compute vtotal from crtc_vsync_start and
vrr.vsync_start. This works since vrr.vsync_start is measured from the
end of vblank, and crtc_vsync_start is measured from start of the
scanline. Together their sum is equal to the crtc_vtotal.

Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Reviewed-by: Mitul Golani <mitulkumar.ajitkumar.golani@intel.com>
---
 drivers/gpu/drm/i915/display/intel_vrr.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_vrr.c b/drivers/gpu/drm/i915/display/intel_vrr.c
index 1cd15c9ddd7f..862adddcfebb 100644
--- a/drivers/gpu/drm/i915/display/intel_vrr.c
+++ b/drivers/gpu/drm/i915/display/intel_vrr.c
@@ -735,17 +735,6 @@ void intel_vrr_get_config(struct intel_crtc_state *crtc_state)
 						     TRANS_VRR_VMAX(display, cpu_transcoder)) + 1;
 		crtc_state->vrr.vmin = intel_de_read(display,
 						     TRANS_VRR_VMIN(display, cpu_transcoder)) + 1;
-
-		/*
-		 * For platforms that always use VRR Timing Generator, the VTOTAL.Vtotal
-		 * bits are not filled. Since for these platforms TRAN_VMIN is always
-		 * filled with crtc_vtotal, use TRAN_VRR_VMIN to get the vtotal for
-		 * adjusted_mode.
-		 */
-		if (intel_vrr_always_use_vrr_tg(display))
-			crtc_state->hw.adjusted_mode.crtc_vtotal =
-				intel_vrr_vmin_vtotal(crtc_state);
-
 		if (HAS_AS_SDP(display)) {
 			trans_vrr_vsync =
 				intel_de_read(display,
@@ -755,6 +744,16 @@ void intel_vrr_get_config(struct intel_crtc_state *crtc_state)
 			crtc_state->vrr.vsync_end =
 				REG_FIELD_GET(VRR_VSYNC_END_MASK, trans_vrr_vsync);
 		}
+		/*
+		 * For platforms that always use VRR Timing Generator, the VTOTAL.Vtotal
+		 * bits are not filled. Since vrr.vsync_start is computed as:
+		 * crtc_vtotal - crtc_vsync_start, we can derive vtotal from
+		 * vrr.vsync_start and crtc_vsync_start.
+		 */
+		if (intel_vrr_always_use_vrr_tg(display))
+			crtc_state->hw.adjusted_mode.crtc_vtotal =
+				crtc_state->hw.adjusted_mode.crtc_vsync_start +
+				crtc_state->vrr.vsync_start;
 	}
 
 	vrr_enable = trans_vrr_ctl & VRR_CTL_VRR_ENABLE;
-- 
2.45.2


  parent reply	other threads:[~2025-08-25 12:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25 12:35 [PATCH 00/12] Optimize vrr.guardband and fix LRR Ankit Nautiyal
2025-08-25 12:35 ` [PATCH 01/12] drm/i915/skl_watermark: Fix the scaling factor for chroma subsampling Ankit Nautiyal
2025-08-25 12:35 ` [PATCH 02/12] drm/i915/skl_watermark: Pass linetime as argument to latency helpers Ankit Nautiyal
2025-08-25 12:35 ` [PATCH 03/12] drm/i915/skl_scaler: Introduce helper for chroma downscale factor Ankit Nautiyal
2025-08-25 12:35 ` [PATCH 04/12] drm/i915/display: Extract helpers to set dsc/scaler prefill latencies Ankit Nautiyal
2025-08-25 12:35 ` [PATCH 05/12] drm/i915/dp: Add SDP latency computation helper Ankit Nautiyal
2025-08-25 12:35 ` [PATCH 06/12] drm/i915/alpm: Add function to compute max link-wake latency Ankit Nautiyal
2025-08-25 12:35 ` Ankit Nautiyal [this message]
2025-08-25 12:35 ` [PATCH 08/12] drm/i915/display: Add guardband check for feature latencies Ankit Nautiyal
2025-08-25 12:35 ` [PATCH 09/12] drm/i915/skl_watermark: Remove redundant latency checks from vblank validation Ankit Nautiyal
2025-08-25 12:35 ` [PATCH 10/12] drm/i915/vrr: Use static guardband to support seamless LRR switching Ankit Nautiyal
2025-08-25 12:35 ` [PATCH 11/12] drm/i915/panel: Refactor helper to get highest fixed mode Ankit Nautiyal
2025-08-25 12:35 ` [PATCH 12/12] drm/i915/vrr: Fix seamless_mn drrs for PTL Ankit Nautiyal
2025-08-25 14:31 ` ✓ i915.CI.BAT: success for Optimize vrr.guardband and fix LRR (rev7) Patchwork
2025-08-25 16:45 ` ✓ i915.CI.Full: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-08-20  8:04 [PATCH 00/12] Optimize vrr.guardband and fix LRR Ankit Nautiyal
2025-08-20  8:04 ` [PATCH 07/12] drm/i915/vrr: Use vrr.sync_start for getting vtotal Ankit Nautiyal
2025-08-18  7:31 [PATCH 00/12] Optimize vrr.guardband and fix LRR Ankit Nautiyal
2025-08-18  7:31 ` [PATCH 07/12] drm/i915/vrr: Use vrr.sync_start for getting vtotal Ankit Nautiyal
2025-08-07 11:15 [PATCH 00/12] Optimize vrr.guardband and fix LRR Ankit Nautiyal
2025-08-07 11:15 ` [PATCH 07/12] drm/i915/vrr: Use vrr.sync_start for getting vtotal Ankit Nautiyal
2025-08-07 17:01   ` Golani, Mitulkumar Ajitkumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250825123548.3022474-8-ankit.k.nautiyal@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=mitulkumar.ajitkumar.golani@intel.com \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).