Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: <intel-gfx@lists.freedesktop.org>, <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 15/15] drm/i915/display: Use optimized guardband to set vblank start
Date: Wed, 1 Oct 2025 18:47:44 +0530	[thread overview]
Message-ID: <76896468-3204-4836-80d8-7186f81899c3@intel.com> (raw)
In-Reply-To: <aN0axoGBGu3ZEMBk@intel.com>


On 10/1/2025 5:42 PM, Ville Syrjälä wrote:
> On Wed, Oct 01, 2025 at 04:11:13PM +0530, Nautiyal, Ankit K wrote:
>> On 9/29/2025 2:30 PM, Ville Syrjälä wrote:
>>> On Sun, Sep 28, 2025 at 12:35:40PM +0530, Ankit Nautiyal wrote:
>>>> As we move towards using a shorter, optimized guardband, we need to adjust
>>>> how the delayed vblank start is computed.
>>>>
>>>> Use the helper intel_vrr_compute_guardband() to calculate the optimized
>>>> guardband. Since this is measured from the vblank end, we shift the
>>>> vblank-start accordingly.
>>>>
>>>> Calculate the minimum delay required based on the guardband and apply it in
>>>> intel_crtc_vblank_delay() to update crtc_vblank_start.
>>>>
>>>> Additionally, introduce a new allow_vblank_delay_fastset() helper that
>>>> combines the existing LRR-based logic with an additional check for the
>>>> optimized guardband usage.
>>>>
>>>> v2:
>>>> - Check if optimized guardband is more than vblank length and add debug
>>>>     print.
>>>> - Extend vblank delay fastset logic to cover optimized guardband.
>>>>
>>>> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
>>>> ---
>>>>    drivers/gpu/drm/i915/display/intel_display.c | 79 +++++++++++++++++++-
>>>>    1 file changed, 76 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
>>>> index 4135f9be53fd..97a3121a204f 100644
>>>> --- a/drivers/gpu/drm/i915/display/intel_display.c
>>>> +++ b/drivers/gpu/drm/i915/display/intel_display.c
>>>> @@ -2361,6 +2361,67 @@ static int intel_crtc_compute_pipe_mode(struct intel_crtc_state *crtc_state)
>>>>    	return 0;
>>>>    }
>>>>    
>>>> +static
>>>> +int intel_crtc_min_guardband_delay(struct intel_atomic_state *state,
>>>> +				   struct intel_crtc *crtc)
>>>> +{
>>>> +	struct intel_display *display = to_intel_display(state);
>>>> +	struct intel_crtc_state *crtc_state =
>>>> +		intel_atomic_get_new_crtc_state(state, crtc);
>>>> +	const struct drm_display_mode *adjusted_mode =
>>>> +		&crtc_state->hw.adjusted_mode;
>>>> +	struct drm_connector_state *conn_state;
>>>> +	struct drm_connector *drm_connector;
>>>> +	int vblank_length;
>>>> +	int i;
>>>> +
>>>> +	if (!intel_vrr_use_optimized_guardband(crtc_state))
>>>> +		return 0;
>>>> +
>>>> +	vblank_length = crtc_state->vrr.vmin -
>>>> +			adjusted_mode->crtc_vdisplay;
>>>> +
>>>> +	for_each_new_connector_in_state(&state->base,
>>>> +					drm_connector,
>>>> +					conn_state, i) {
>>>> +		int guardband;
>>>> +		struct intel_connector *connector;
>>>> +
>>>> +		if (conn_state->crtc != &crtc->base)
>>>> +			continue;
>>>> +
>>>> +		connector = to_intel_connector(drm_connector);
>>>> +		guardband = intel_vrr_compute_guardband(crtc_state,
>>>> +							connector);
>>>> +		if (guardband > vblank_length) {
>>>> +			drm_dbg_kms(display->drm,
>>>> +				    "[CRTC:%d:%s] Cannot optimize guardband (%d) exceeds max (%d)\n",
>>>> +				    crtc->base.base.id, crtc->base.name,
>>>> +				    guardband,
>>>> +				    vblank_length);
>>>> +			return 0;
>>>> +		}
>>>> +
>>>> +		return vblank_length - guardband;
>>>> +	}
>>>> +
>>>> +	return 0;
>>>> +}
>>>> +
>>>> +static void intel_crtc_vblank_delay(struct intel_atomic_state *state,
>>>> +				    struct intel_crtc *crtc)
>>>> +{
>>>> +	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;
>>>> +	int vblank_delay = 0;
>>>> +
>>>> +	vblank_delay = intel_crtc_min_guardband_delay(state, crtc);
>>>> +
>>>> +	adjusted_mode->crtc_vblank_start += vblank_delay;
>>>> +}
>>>> +
>>>>    static int intel_crtc_set_context_latency(struct intel_crtc_state *crtc_state)
>>>>    {
>>>>    	struct intel_display *display = to_intel_display(crtc_state);
>>>> @@ -2413,6 +2474,7 @@ static int intel_crtc_compute_config(struct intel_atomic_state *state,
>>>>    	ret = intel_crtc_compute_set_context_latency(state, crtc);
>>>>    	if (ret)
>>>>    		return ret;
>>>> +	intel_crtc_vblank_delay(state, crtc);
>>> IMO we should get rid of all this vblank_delay terminology here.
>>> This one I think should just be our current
>>> intel_vrr_compute_config_late() (renamed to eg.
>>> intel_vrr_compute_guardband()).
>> Hmm ok so will rename this and call from intel_modeset_pipe_config_late().
> I meant you should move the intel_vrr_compute_config_late() call
> from intel_modeset_pipe_config_late() to here, and rename it to
> eg. intel_vrr_compute_guardband().

Oh ok sorry I got it other way round. Will do as suggested.

Regards,

Ankit

>

  reply	other threads:[~2025-10-01 13:17 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-28  7:05 [PATCH 00/15] Optimize vrr.guardband and fix LRR Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 01/15] drm/i915/vrr: Use crtc_vsync_start/end for computing vrr.vsync_start/end Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 02/15] drm/i915/skl_watermark: Fix the scaling factor for chroma subsampling Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 03/15] drm/i915/skl_watermark: Pass linetime as argument to latency helpers Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 04/15] drm/i915/skl_scaler: Introduce helper for chroma downscale factor Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 05/15] drm/i915/display: Extract helpers to set dsc/scaler prefill latencies Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 06/15] drm/i915/dp: Add SDP latency computation helper Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 07/15] drm/i915/alpm: Add function to compute max link-wake latency Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 08/15] drm/i915/display: Add guardband check for feature latencies Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 09/15] drm/i915/skl_watermark: Remove redundant latency checks from vblank validation Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 10/15] drm/i915/vrr: Introduce helper to compute min static guardband Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 11/15] drm/i915/vrr: Use optimized guardband when VRR TG is active Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 12/15] drm/i915/vrr: Prepare for movement of vblank start for optimized guardband Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 13/15] drm/i915/display: Recompute crtc_vblank_start " Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 14/15] drm/i915/display: s/allow_vblank_delay_fastset/allow_vblank_delay_fastset_lrr Ankit Nautiyal
2025-09-28  7:05 ` [PATCH 15/15] drm/i915/display: Use optimized guardband to set vblank start Ankit Nautiyal
2025-09-29  8:45   ` Ville Syrjälä
2025-09-29  9:09     ` Ville Syrjälä
2025-09-29  9:21     ` Ville Syrjälä
2025-10-01 10:34     ` Nautiyal, Ankit K
2025-10-01 12:10       ` Ville Syrjälä
2025-10-01 13:16         ` Nautiyal, Ankit K
2025-09-29  9:00   ` Ville Syrjälä
2025-10-01 10:41     ` Nautiyal, Ankit K
2025-10-01 12:12       ` Ville Syrjälä
2025-10-01 13:17         ` Nautiyal, Ankit K [this message]
2025-09-28  7:31 ` ✓ CI.KUnit: success for Optimize vrr.guardband and fix LRR (rev13) Patchwork
2025-09-28  7:46 ` ✗ CI.checksparse: warning " Patchwork
2025-09-28  8:08 ` ✓ Xe.CI.BAT: success " Patchwork
2025-09-28  9:31 ` ✗ Xe.CI.Full: failure " Patchwork

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=76896468-3204-4836-80d8-7186f81899c3@intel.com \
    --to=ankit.k.nautiyal@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --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