Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Hanson Wang <hanson.wang@ugreen.com>
Cc: intel-gfx@lists.freedesktop.org, jani.nikula@linux.intel.com,
	rodrigo.vivi@intel.com, joonas.lahtinen@linux.intel.com,
	tursulin@ursulin.net, intel-xe@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/bw: sync global BW after non-atomic plane disable
Date: Wed, 18 Nov 2026 06:38:24 +0200	[thread overview]
Message-ID: <av0rwG6o5gzMXGDB@intel.com> (raw)
In-Reply-To: <20261118033312.902366-1-hanson.wang@ugreen.com>

On Wed, Nov 18, 2026 at 11:33:12AM +0800, Hanson Wang wrote:
> Hardware readout copies the firmware plane configuration into the
> global bandwidth state. skl_dbuf_sanitize() may then disable those
> planes through intel_plane_disable_noatomic(), which clears the
> CRTC-local active_planes, data_rate and DDB entries but does not
> update the global state.
> 
> A later atomic modeset sees both the old and new per-CRTC bandwidth
> as zero and skips the global update. The sanitized pipe therefore
> keeps contributing a phantom data rate and an active plane to the
> QGV check.
> 
> Do not force !hw.active to zero. A logically enabled but inactive CRTC
> must retain its bandwidth reservation so that reactivating it cannot
> fail due to insufficient bandwidth. After the non-atomic disable,
> recompute the global intel_bw_state and the separate dbuf bandwidth
> state from the updated CRTC-local plane and DDB state.
> 
> Reproduced on two N5105 systems from different board vendors running
> 6.18.15. After DBUF sanitization, pipe B retained 196000 kB/s and one
> plane in the global BW state despite its local plane state being
> cleared and the pipe subsequently being disabled.
> 
> With the corresponding fix backported to 6.18.15 on one system, the
> same sanitization path updated the global accounting to 0 kB/s and
> zero planes. Subsequent QGV checks no longer included the stale
> bandwidth.

I think what we might want to do is add a new
intel_display_update_hw_state() wrapper that calls all the
intel_foo_update_hw_state() functions. Then we just call that
after any disable_noatomic() stuff is done. Not sure if a single
call would be sufficient once we've sanitized everything, or if
we'd need to do a few extra calls during the sanitization
sequence.

And if we're missing any intel_foo_update_hw_state()
implementations then we should just add them.

> 
> Link: https://lore.kernel.org/intel-gfx/20261016014704.3876294-1-hanson.wang@ugreen.com
> 
> Signed-off-by: Hanson Wang <hanson.wang@ugreen.com>
> ---
> Testing:
> - The corresponding 6.18.15 backport was tested on one N5105 system.
> - This mainline version has not been runtime-tested.
> - The original high-bandwidth application failure was not replayed.
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c
> index 99fd84a5ac13..84fe1f68e312 100644
> --- a/drivers/gpu/drm/i915/display/intel_bw.c
> +++ b/drivers/gpu/drm/i915/display/intel_bw.c
> @@ -1444,6 +1444,20 @@ static void intel_bw_crtc_update(struct intel_bw_state *bw_state,
>  		    bw_state->num_active_planes[crtc->pipe]);
>  }
>  
> +void intel_bw_crtc_update_noatomic(struct intel_crtc *crtc)
> +{
> +	struct intel_display *display = to_intel_display(crtc);
> +	struct intel_bw_state *bw_state =
> +		to_intel_bw_state(display->bw.obj.state);
> +	const struct intel_crtc_state *crtc_state =
> +		to_intel_crtc_state(crtc->base.state);
> +
> +	if (DISPLAY_VER(display) < 11)
> +		return;
> +
> +	intel_bw_crtc_update(bw_state, crtc_state);
> +}
> +
>  void intel_bw_update_hw_state(struct intel_display *display)
>  {
>  	struct intel_bw_state *bw_state =
> @@ -1456,12 +1470,9 @@ void intel_bw_update_hw_state(struct intel_display *display)
>  	bw_state->pipe_sagv_reject = 0;
>  
>  	for_each_intel_crtc(display, crtc) {
> -		const struct intel_crtc_state *crtc_state =
> -			to_intel_crtc_state(crtc->base.state);
>  		enum pipe pipe = crtc->pipe;
>  
> -		if (DISPLAY_VER(display) >= 11)
> -			intel_bw_crtc_update(bw_state, crtc_state);
> +		intel_bw_crtc_update_noatomic(crtc);
>  
>  		/* initially SAGV has been forced off */
>  		bw_state->pipe_sagv_reject |= BIT(pipe);
> diff --git a/drivers/gpu/drm/i915/display/intel_bw.h b/drivers/gpu/drm/i915/display/intel_bw.h
> index 99b447388245..41ace27608dc 100644
> --- a/drivers/gpu/drm/i915/display/intel_bw.h
> +++ b/drivers/gpu/drm/i915/display/intel_bw.h
> @@ -30,6 +30,7 @@ void intel_bw_init_hw(struct intel_display *display);
>  int intel_bw_init(struct intel_display *display);
>  int intel_bw_atomic_check(struct intel_atomic_state *state);
>  void intel_bw_update_hw_state(struct intel_display *display);
> +void intel_bw_crtc_update_noatomic(struct intel_crtc *crtc);
>  void intel_bw_crtc_disable_noatomic(struct intel_crtc *crtc);
>  
>  bool intel_bw_pmdemand_needs_update(struct intel_atomic_state *state);
> diff --git a/drivers/gpu/drm/i915/display/intel_dbuf_bw.c b/drivers/gpu/drm/i915/display/intel_dbuf_bw.c
> index 6cf674c586dc..453ceaa52e26 100644
> --- a/drivers/gpu/drm/i915/display/intel_dbuf_bw.c
> +++ b/drivers/gpu/drm/i915/display/intel_dbuf_bw.c
> @@ -226,21 +226,29 @@ int intel_dbuf_bw_calc_min_cdclk(struct intel_atomic_state *state,
>  	return 0;
>  }
>  
> -void intel_dbuf_bw_update_hw_state(struct intel_display *display)
> +void intel_dbuf_bw_crtc_update_noatomic(struct intel_crtc *crtc)
>  {
> +	struct intel_display *display = to_intel_display(crtc);
>  	struct intel_dbuf_bw_state *dbuf_bw_state =
>  		to_intel_dbuf_bw_state(display->dbuf_bw.obj.state);
> -	struct intel_crtc *crtc;
> +	const struct intel_crtc_state *crtc_state =
> +		to_intel_crtc_state(crtc->base.state);
>  
>  	if (DISPLAY_VER(display) < 9)
>  		return;
>  
> -	for_each_intel_crtc(display, crtc) {
> -		const struct intel_crtc_state *crtc_state =
> -			to_intel_crtc_state(crtc->base.state);
> +	skl_crtc_calc_dbuf_bw(&dbuf_bw_state->dbuf_bw[crtc->pipe], crtc_state);
> +}
>  
> -		skl_crtc_calc_dbuf_bw(&dbuf_bw_state->dbuf_bw[crtc->pipe], crtc_state);
> -	}
> +void intel_dbuf_bw_update_hw_state(struct intel_display *display)
> +{
> +	struct intel_crtc *crtc;
> +
> +	if (DISPLAY_VER(display) < 9)
> +		return;
> +
> +	for_each_intel_crtc(display, crtc)
> +		intel_dbuf_bw_crtc_update_noatomic(crtc);
>  }
>  
>  void intel_dbuf_bw_crtc_disable_noatomic(struct intel_crtc *crtc)
> diff --git a/drivers/gpu/drm/i915/display/intel_dbuf_bw.h b/drivers/gpu/drm/i915/display/intel_dbuf_bw.h
> index 61875b9d5969..434f3c605995 100644
> --- a/drivers/gpu/drm/i915/display/intel_dbuf_bw.h
> +++ b/drivers/gpu/drm/i915/display/intel_dbuf_bw.h
> @@ -32,6 +32,7 @@ int intel_dbuf_bw_calc_min_cdclk(struct intel_atomic_state *state,
>  int intel_dbuf_bw_min_cdclk(struct intel_display *display,
>  			    const struct intel_dbuf_bw_state *dbuf_bw_state);
>  void intel_dbuf_bw_update_hw_state(struct intel_display *display);
> +void intel_dbuf_bw_crtc_update_noatomic(struct intel_crtc *crtc);
>  void intel_dbuf_bw_crtc_disable_noatomic(struct intel_crtc *crtc);
>  
>  #endif /* __INTEL_DBUF_BW_H__ */
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index b897678a93c0..b81d8f288810 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -67,6 +67,7 @@
>  #include "intel_cursor.h"
>  #include "intel_cursor_regs.h"
>  #include "intel_cx0_phy.h"
> +#include "intel_dbuf_bw.h"
>  #include "intel_ddi.h"
>  #include "intel_de.h"
>  #include "intel_dip.h"
> @@ -679,6 +680,14 @@ void intel_plane_disable_noatomic(struct intel_crtc *crtc,
>  
>  	skl_wm_plane_disable_noatomic(crtc, plane);
>  
> +	/*
> +	 * Keep the global bandwidth states in sync with the updated
> +	 * CRTC-local plane and DDB state. Otherwise a later atomic check
> +	 * may skip the update when its old and new inputs are identical.
> +	 */
> +	intel_bw_crtc_update_noatomic(crtc);
> +	intel_dbuf_bw_crtc_update_noatomic(crtc);
> +
>  	if ((crtc_state->active_planes & ~BIT(PLANE_CURSOR)) == 0 &&
>  	    hsw_ips_disable(crtc_state)) {
>  		crtc_state->ips_enabled = false;
> -- 
> 2.34.1

-- 
Ville Syrjälä
Intel

      parent reply	other threads:[~2026-11-18  4:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18  3:33 [PATCH] drm/i915/bw: sync global BW after non-atomic plane disable Hanson Wang
2026-11-18  4:00 ` sashiko-bot
2026-11-18 13:41   ` Hanson Wang
2026-11-18  4:03 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
2026-11-18  4:38 ` Ville Syrjälä [this message]

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=av0rwG6o5gzMXGDB@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hanson.wang@ugreen.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=tursulin@ursulin.net \
    /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