All of 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 3/8] drm/i915/vblank: Add helper to get correct vblank length
Date: Fri, 10 Oct 2025 17:54:37 +0300	[thread overview]
Message-ID: <aOkeLTN3EO7AVq6u@intel.com> (raw)
In-Reply-To: <20251009090102.850344-4-ankit.k.nautiyal@intel.com>

On Thu, Oct 09, 2025 at 02:30:57PM +0530, Ankit Nautiyal wrote:
> Currently crtc_vblank_start is assumed to be the vblank_start for the fixed
> refresh rate case. That value can be different from the variable refresh
> rate case whenever always_use_vrr_tg()==false. On icl/tgl it's always
> different due to the extra vblank delay, and also on adl+ it could be
> different if we were to use an optimized guardband.
> 
> So places where crtc_vblank_start is used to compute vblank length needs
> change so as to account for cases where vrr is enabled. Specifically
> with vrr.enable the effective vblank length is actually guardband.
> 
> Add a helper to get the correct vblank length for both vrr and fixed
> refresh rate cases. Use this helper where vblank_start is used to
> compute the vblank length.
> 
> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_vblank.c  | 10 ++++++++++
>  drivers/gpu/drm/i915/display/intel_vblank.h  |  2 ++
>  drivers/gpu/drm/i915/display/skl_watermark.c |  3 ++-
>  3 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_vblank.c b/drivers/gpu/drm/i915/display/intel_vblank.c
> index 0b7fcc05e64c..2fc0c1c0bb87 100644
> --- a/drivers/gpu/drm/i915/display/intel_vblank.c
> +++ b/drivers/gpu/drm/i915/display/intel_vblank.c
> @@ -767,3 +767,13 @@ int intel_vblank_evade(struct intel_vblank_evade_ctx *evade)
>  
>  	return scanline;
>  }
> +
> +int intel_crtc_vblank_length(const struct intel_crtc_state *crtc_state)
> +{
> +	const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
> +
> +	if (crtc_state->vrr.enable)
> +		return crtc_state->vrr.guardband;
> +	else
> +		return adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vblank_start;
> +}
> diff --git a/drivers/gpu/drm/i915/display/intel_vblank.h b/drivers/gpu/drm/i915/display/intel_vblank.h
> index 21fbb08d61d5..98d04cacd65f 100644
> --- a/drivers/gpu/drm/i915/display/intel_vblank.h
> +++ b/drivers/gpu/drm/i915/display/intel_vblank.h
> @@ -48,4 +48,6 @@ const struct intel_crtc_state *
>  intel_pre_commit_crtc_state(struct intel_atomic_state *state,
>  			    struct intel_crtc *crtc);
>  
> +int intel_crtc_vblank_length(const struct intel_crtc_state *crtc_state);
> +
>  #endif /* __INTEL_VBLANK_H__ */
> diff --git a/drivers/gpu/drm/i915/display/skl_watermark.c b/drivers/gpu/drm/i915/display/skl_watermark.c
> index 9df9ee137bf9..06e5e6c77d2e 100644
> --- a/drivers/gpu/drm/i915/display/skl_watermark.c
> +++ b/drivers/gpu/drm/i915/display/skl_watermark.c
> @@ -28,6 +28,7 @@
>  #include "intel_flipq.h"
>  #include "intel_pcode.h"
>  #include "intel_plane.h"
> +#include "intel_vblank.h"
>  #include "intel_wm.h"
>  #include "skl_universal_plane_regs.h"
>  #include "skl_watermark.h"
> @@ -2241,7 +2242,7 @@ skl_is_vblank_too_short(const struct intel_crtc_state *crtc_state,
>  		scaler_prefill_latency(crtc_state) +
>  		dsc_prefill_latency(crtc_state) +
>  		wm0_lines >
> -		adjusted_mode->crtc_vtotal - adjusted_mode->crtc_vblank_start;
> +		intel_crtc_vblank_length(crtc_state);
>  }
>  
>  static int skl_max_wm0_lines(const struct intel_crtc_state *crtc_state)
> -- 
> 2.45.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2025-10-10 14:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09  9:00 [PATCH 0/8] Preparatory patches for guardband optimization Ankit Nautiyal
2025-10-09  9:00 ` [PATCH 1/8] drm/i915/vrr: Use crtc_vsync_start/end for computing vrr.vsync_start/end Ankit Nautiyal
2025-10-09  9:00 ` [PATCH 2/8] drm/i915/vrr: s/intel_vrr_compute_config_late/intel_vrr_compute_guardband Ankit Nautiyal
2025-10-10 14:53   ` Ville Syrjälä
2025-10-13  2:31     ` Nautiyal, Ankit K
2025-10-09  9:00 ` [PATCH 3/8] drm/i915/vblank: Add helper to get correct vblank length Ankit Nautiyal
2025-10-10 14:54   ` Ville Syrjälä [this message]
2025-10-09  9:00 ` [PATCH 4/8] drm/i915/psr: Consider SCL lines when validating vblank for wake latency Ankit Nautiyal
2025-10-10  6:40   ` Hogander, Jouni
2025-10-10 13:01     ` Nautiyal, Ankit K
2025-10-09  9:00 ` [PATCH 5/8] drm/i915/display: Check if final vblank is sufficient for PSR features Ankit Nautiyal
2025-10-10  6:53   ` Hogander, Jouni
2025-10-10 13:42     ` Nautiyal, Ankit K
2025-10-13 10:57       ` Hogander, Jouni
2025-10-13 12:29         ` Nautiyal, Ankit K
2025-10-09  9:01 ` [PATCH 6/8] drm/i915/vrr: Recompute vblank_start for platforms with always-on VRR TG Ankit Nautiyal
2025-10-09  9:01 ` [PATCH 7/8] drm/i915/display: Add vblank_start adjustment logic for " Ankit Nautiyal
2025-10-10 15:05   ` Ville Syrjälä
2025-10-13  2:23     ` Nautiyal, Ankit K
2025-10-09  9:01 ` [PATCH 8/8] drm/i915/display: Prepare for vblank_delay for LRR Ankit Nautiyal
2025-10-09  9:22 ` ✓ CI.KUnit: success for Preparatory patches for guardband optimization (rev2) Patchwork
2025-10-09  9:37 ` ✗ CI.checksparse: warning " Patchwork
2025-10-09 10:14 ` ✓ Xe.CI.BAT: success " Patchwork
2025-10-09 11:04 ` ✓ i915.CI.BAT: " Patchwork
2025-10-09 12:42 ` ✓ Xe.CI.Full: " Patchwork
2025-10-09 17:03 ` ✗ i915.CI.Full: failure " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2025-10-09  7:17 [PATCH 0/8] Preparatory patches for guardband optimization Ankit Nautiyal
2025-10-09  7:17 ` [PATCH 3/8] drm/i915/vblank: Add helper to get correct vblank length Ankit Nautiyal

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=aOkeLTN3EO7AVq6u@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.