All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/bw: sync global BW after non-atomic plane disable
@ 2026-11-18  3:33 Hanson Wang
  2026-11-18  4:00 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hanson Wang @ 2026-11-18  3:33 UTC (permalink / raw)
  To: intel-gfx
  Cc: jani.nikula, rodrigo.vivi, joonas.lahtinen, tursulin, intel-xe,
	dri-devel, hanson.wang

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.

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-18  4:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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  4:03 ` ✗ LGCI.VerificationFailed: failure for " Patchwork
2026-11-18  4:38 ` [PATCH] " Ville Syrjälä

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.