* Re: [PATCH i915] drm/i915/bw: Ignore inactive CRTCs in bandwidth calculation
[not found] <20261016014704.3876294-1-hanson.wang@ugreen.com>
@ 2026-10-16 11:52 ` Ville Syrjälä
0 siblings, 0 replies; only message in thread
From: Ville Syrjälä @ 2026-10-16 11:52 UTC (permalink / raw)
To: Hanson Wang
Cc: intel-gfx, jani.nikula, rodrigo.vivi, joonas.lahtinen, tursulin,
dri-devel
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
^ permalink raw reply [flat|nested] only message in thread