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 <[email protected]>
---
 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 via email to