* Re: [PATCH] drm/i915/bw: sync global BW after non-atomic plane disable
[not found] <20261118033312.902366-1-hanson.wang@ugreen.com>
@ 2026-11-18 4:00 ` sashiko-bot
2026-11-18 4:38 ` Ville Syrjälä
1 sibling, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-18 4:00 UTC (permalink / raw)
To: Hanson Wang, intel-gfx; +Cc: intel-xe, dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/i915/display: stale cdclk state after
intel_plane_disable_noatomic()
--
commit cc04b14ee64b615dd833441addacb0b2def5e98d
Author: Hanson Wang <hanson.wang@ugreen.com>
drm/i915/bw: sync global BW after non-atomic plane disable
This commit updates the global intel_bw_state and intel_dbuf_bw_state
when a plane is disabled via intel_plane_disable_noatomic() so that
subsequent atomic checks do not retain stale plane bandwidth accounting.
Link: https://lore.kernel.org/intel-gfx/20261016014704.3876294-1-hanson.wang@ugreen.com
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index f79caeb5a82ec..c5a043ade54ff 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
[ ... ]
> @@ -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;
[Severity: Medium]
Does updating display->dbuf_bw.obj.state here without also updating
display->cdclk.obj.state and crtc_state->min_cdclk leave
cdclk_state->dbuf_bw_min_cdclk and cdclk_state->min_cdclk[pipe] stuck at
their pre-sanitization values?
During hardware readout, intel_cdclk_update_hw_state() caches
crtc_state->min_cdclk in cdclk_state->min_cdclk[pipe] and caches
intel_dbuf_bw_min_cdclk(display, dbuf_bw_state) in
cdclk_state->dbuf_bw_min_cdclk. When skl_dbuf_sanitize() then disables
the plane through intel_plane_disable_noatomic(),
intel_dbuf_bw_crtc_update_noatomic() zeroes the pipe's entry in
dbuf_bw_state, so a subsequent atomic modeset on that pipe sees both
old_dbuf_bw and new_dbuf_bw as zero and skips
intel_cdclk_update_dbuf_bw_min_cdclk() in intel_dbuf_bw_calc_min_cdclk():
drivers/gpu/drm/i915/display/intel_dbuf_bw.c:intel_dbuf_bw_calc_min_cdclk() {
...
for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state) {
struct intel_dbuf_bw old_dbuf_bw, new_dbuf_bw;
skl_crtc_calc_dbuf_bw(&old_dbuf_bw, old_crtc_state);
skl_crtc_calc_dbuf_bw(&new_dbuf_bw, new_crtc_state);
if (!intel_dbuf_bw_changed(display, &old_dbuf_bw, &new_dbuf_bw))
continue;
...
if (!old_dbuf_bw_state)
return 0;
}
Similarly, intel_plane_set_invisible() zeroes plane_min_cdclk[plane->id]
and hsw_ips_disable() clears ips_enabled without recomputing
crtc_state->min_cdclk or cdclk_state->min_cdclk[pipe];
intel_initial_commit() then updates crtc_state->min_cdclk while
allow_cdclk_decrease is false, so later modesets where min_cdclk does not
change return early in intel_cdclk_update_crtc_min_cdclk() on
new_min_cdclk == old_min_cdclk, keeping minimum CDCLK artificially
elevated.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118033312.902366-1-hanson.wang@ugreen.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/i915/bw: sync global BW after non-atomic plane disable
[not found] <20261118033312.902366-1-hanson.wang@ugreen.com>
2026-11-18 4:00 ` [PATCH] drm/i915/bw: sync global BW after non-atomic plane disable sashiko-bot
@ 2026-11-18 4:38 ` Ville Syrjälä
1 sibling, 0 replies; 2+ messages in thread
From: Ville Syrjälä @ 2026-11-18 4:38 UTC (permalink / raw)
To: Hanson Wang
Cc: intel-gfx, jani.nikula, rodrigo.vivi, joonas.lahtinen, tursulin,
intel-xe, dri-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-18 4:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20261118033312.902366-1-hanson.wang@ugreen.com>
2026-11-18 4:00 ` [PATCH] drm/i915/bw: sync global BW after non-atomic plane disable sashiko-bot
2026-11-18 4:38 ` Ville Syrjälä
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox