All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hanson Wang <hanson.wang@ugreen.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@linux.intel.com, rodrigo.vivi@intel.com,
	joonas.lahtinen@linux.intel.com, tursulin@ursulin.net,
	dri-devel@lists.freedesktop.org,
	Hanson Wang <hanson.wang@ugreen.com>
Subject: [PATCH i915] drm/i915/bw: Ignore inactive CRTCs in bandwidth calculation
Date: Fri, 16 Oct 2026 09:47:04 +0800	[thread overview]
Message-ID: <20261016014704.3876294-1-hanson.wang@ugreen.com> (raw)

The per-CRTC bandwidth helpers use cached active_planes and data_rate
values without checking whether the CRTC is active. During hardware
state readout an inactive CRTC may retain stale plane state, causing
intel_bw_state to account phantom bandwidth.

This can leave bandwidth and an active plane accounted after an HDMI
disconnect and make the QGV check reject otherwise valid atomic commits.

Return zero from both helpers for inactive CRTCs so hardware readout
and atomic checks cannot propagate stale bandwidth.

Signed-off-by: Hanson Wang <hanson.wang@ugreen.com>
---
 drivers/gpu/drm/i915/display/intel_bw.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_bw.c b/drivers/gpu/drm/i915/display/intel_bw.c
index ac6da20d9..62d9ae416 100644
--- a/drivers/gpu/drm/i915/display/intel_bw.c
+++ b/drivers/gpu/drm/i915/display/intel_bw.c
@@ -838,6 +838,9 @@ void intel_bw_init_hw(struct intel_display *display)
 
 static unsigned int intel_bw_crtc_num_active_planes(const struct intel_crtc_state *crtc_state)
 {
+	if (!crtc_state->hw.active)
+		return 0;
+
 	/*
 	 * We assume cursors are small enough
 	 * to not not cause bandwidth problems.
@@ -852,6 +855,9 @@ static unsigned int intel_bw_crtc_data_rate(const struct intel_crtc_state *crtc_
 	unsigned int data_rate = 0;
 	enum plane_id plane_id;
 
+	if (!crtc_state->hw.active)
+		return 0;
+
 	for_each_plane_id_on_crtc(crtc, plane_id) {
 		/*
 		 * We assume cursors are small enough
-- 
2.34.1


             reply	other threads:[~2026-10-16  7:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  1:47 Hanson Wang [this message]
2026-10-16 11:52 ` [PATCH i915] drm/i915/bw: Ignore inactive CRTCs in bandwidth calculation Ville Syrjälä

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=20261016014704.3876294-1-hanson.wang@ugreen.com \
    --to=hanson.wang@ugreen.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@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 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.