Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 13/16] drm/i915/display: Add vblank_start adjustment logic for always-on VRR TG
Date: Mon, 6 Oct 2025 22:56:33 +0300	[thread overview]
Message-ID: <aOQe8QaVZBLIquzM@intel.com> (raw)
In-Reply-To: <20251006042852.263249-14-ankit.k.nautiyal@intel.com>

On Mon, Oct 06, 2025 at 09:58:49AM +0530, Ankit Nautiyal wrote:
> As we move towards using a shorter, optimized guardband, we need to adjust
> how the delayed vblank start is computed.
> 
> Introduce intel_crtc_compute_vrr_guardband() to handle guardband
> computation and apply vblank_start adjustment for platforms that always use
> the VRR timing generator.
> 
> This function wraps the existing intel_vrr_compute_guardband() and adjusts
> crtc_vblank_start using (vblank_length - guardband) only when
> intel_vrr_always_use_vrr_tg() is true. Since the guardband is not yet
> optimized, the adjustment currently evaluates to zero, preserving existing
> behavior.
> 
> This paves way for guardband optimization, by handling the movement of
> the crtc_vblank_start for platforms that have VRR TG always active.
> 
> Also update allow_vblank_delay_fastset() to permit vblank delay adjustments
> during fastboot when VRR TG is always active, even without inherited state.
> 
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 33 ++++++++++++++++++--
>  1 file changed, 30 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index b2d4e24fd7c6..1964e41b5704 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -2403,6 +2403,27 @@ static int intel_crtc_compute_set_context_latency(struct intel_atomic_state *sta
>  	return 0;
>  }
>  
> +static void intel_crtc_compute_vrr_guardband(struct intel_atomic_state *state,
> +					     struct intel_crtc *crtc)

Why this wrapper? You could just stick the adjustemnt into
intel_vrr_compute_guardband().

> +{
> +	struct intel_display *display = to_intel_display(state);
> +	struct intel_crtc_state *crtc_state =
> +		intel_atomic_get_new_crtc_state(state, crtc);
> +	struct drm_display_mode *adjusted_mode =
> +		&crtc_state->hw.adjusted_mode;
> +
> +	intel_vrr_compute_guardband(crtc_state);
> +
> +	if (intel_vrr_always_use_vrr_tg(display)) {
> +		int vblank_length = adjusted_mode->crtc_vtotal -
> +				    (crtc_state->set_context_latency +
> +				     adjusted_mode->crtc_vdisplay);
> +
> +		adjusted_mode->crtc_vblank_start +=
> +			vblank_length - crtc_state->vrr.guardband;

Why aren't you using the same 'vblank_start = vtotal-guardband' here as
during readout?

> +	}
> +}
> +
>  static int intel_crtc_compute_config(struct intel_atomic_state *state,
>  				     struct intel_crtc *crtc)
>  {
> @@ -2414,7 +2435,7 @@ static int intel_crtc_compute_config(struct intel_atomic_state *state,
>  	if (ret)
>  		return ret;
>  
> -	intel_vrr_compute_guardband(crtc_state);
> +	intel_crtc_compute_vrr_guardband(state, crtc);
>  
>  	ret = intel_dpll_crtc_compute_clock(state, crtc);
>  	if (ret)
> @@ -5105,9 +5126,15 @@ static bool allow_vblank_delay_fastset(const struct intel_crtc_state *old_crtc_s
>  	 * Allow fastboot to fix up vblank delay (handled via LRR
>  	 * codepaths), a bit dodgy as the registers aren't
>  	 * double buffered but seems to be working more or less...
> +	 *
> +	 * Also allow this when the VRR timing generator is always on,
> +	 * which implies optimized guardband is used. In such cases,
> +	 * vblank delay may vary even without inherited state, but it's
> +	 * still safe as VRR guardband is still same.
>  	 */
> -	return HAS_LRR(display) && old_crtc_state->inherited &&
> -		!intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_DSI);
> +	return HAS_LRR(display) &&
> +	       (old_crtc_state->inherited || intel_vrr_always_use_vrr_tg(display)) &&
> +	       !intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_DSI);

This part doesn't seem directly related to the making crtc_vblank_start
correct. We still use the non-optimzied guardband so crtc_vblank_start
should not be changing during normal runtime operation.

>  }
>  
>  bool
> -- 
> 2.45.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2025-10-06 19:56 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-06  4:28 [PATCH 00/16] Optimize vrr.guardband and fix LRR Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 01/16] drm/i915/vrr: Use crtc_vsync_start/end for computing vrr.vsync_start/end Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 02/16] drm/i915/skl_watermark: Fix the scaling factor for chroma subsampling Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 03/16] drm/i915/skl_watermark: Pass linetime as argument to latency helpers Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 04/16] drm/i915/skl_scaler: Introduce helper for chroma downscale factor Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 05/16] drm/i915/display: Extract helpers to set dsc/scaler prefill latencies Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 06/16] drm/i915/dp: Add SDP latency computation helper Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 07/16] drm/i915/alpm: Add function to compute max link-wake latency Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 08/16] drm/i915/display: Add guardband check for feature latencies Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 09/16] drm/i915/skl_watermark: Remove redundant latency checks from vblank validation Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 10/16] drm/i915/vrr: s/intel_vrr_compute_config_late/intel_vrr_compute_guardband Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 11/16] drm/i915/vblank: Add helper to get correct vblank length Ankit Nautiyal
2025-10-06 19:56   ` Ville Syrjälä
2025-10-07  5:52     ` Nautiyal, Ankit K
2025-10-07 15:16       ` Ville Syrjälä
2025-10-07 17:30         ` Ville Syrjälä
2025-10-08  6:34           ` Nautiyal, Ankit K
2025-10-06  4:28 ` [PATCH 12/16] drm/i915/vrr: Recompute vblank_start for platforms with always-on VRR TG Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 13/16] drm/i915/display: Add vblank_start adjustment logic for " Ankit Nautiyal
2025-10-06 19:56   ` Ville Syrjälä [this message]
2025-10-07  6:30     ` Nautiyal, Ankit K
2025-10-07 15:19       ` Ville Syrjälä
2025-10-06  4:28 ` [PATCH 14/16] drm/i915/vrr: Introduce helper to compute min static guardband Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 15/16] drm/i915/display: Use optimized guardband for always-on VRR TG Ankit Nautiyal
2025-10-06  4:28 ` [PATCH 16/16] drm/i915/vrr: Use optimized guardband when VRR TG is active Ankit Nautiyal
2025-10-06  9:56 ` ✓ i915.CI.BAT: success for Optimize vrr.guardband and fix LRR (rev13) Patchwork
2025-10-06 11:54 ` ✗ i915.CI.Full: failure " Patchwork
2025-10-06 22:50 ` [PATCH 00/16] Optimize vrr.guardband and fix LRR Ville Syrjälä
2025-10-07  6:33   ` Nautiyal, Ankit K
2025-10-07 15:22     ` Ville Syrjälä

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=aOQe8QaVZBLIquzM@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    /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