All of 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, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH i915] drm/i915/bw: Ignore inactive CRTCs in bandwidth calculation
Date: Fri, 16 Oct 2026 14:52:53 +0300	[thread overview]
Message-ID: <atIQFRHdf3uofLHM@intel.com> (raw)
In-Reply-To: <20261016014704.3876294-1-hanson.wang@ugreen.com>

On Fri, Oct 16, 2026 at 09:47:04AM +0800, Hanson Wang wrote:
> 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.

Shouldn't happen. If the CRTC gets disabled it no longer counts. Are you
leaving the CRTC logically enabled but inactive (enable==true &&
active==false)? That we still want to count because 
'enable==true && active==false -> enable==true && active==true'
transition should never fail.

> 
> 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

-- 
Ville Syrjälä
Intel

      reply	other threads:[~2026-10-16 11:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  1:47 [PATCH i915] drm/i915/bw: Ignore inactive CRTCs in bandwidth calculation Hanson Wang
2026-10-16 11:52 ` 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=atIQFRHdf3uofLHM@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=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.