[Intel-gfx] [RFC 3/6] drm/i915: Fix wrongly populated plane possible_crtcs bit mask

Anshuman Gupta anshuman.gupta at intel.com
Thu Jan 23 13:26:56 UTC 2020


As a disabled pipe in pipe_mask is not having a valid intel crtc,
driver wrongly populates the possible_crtcs mask while initializing
the plane for a CRTC. Fixing up the plane possible_crtc mask.

Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta at intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 23 ++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index afd8d43160c6..b250b31f6000 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -16407,6 +16407,28 @@ static void intel_crtc_free(struct intel_crtc *crtc)
 	kfree(crtc);
 }
 
+static void intel_plane_possible_crtc_fixup(struct drm_i915_private *dev_priv)
+{
+	struct intel_crtc *crtc;
+	struct intel_plane *plane;
+
+	/*
+	 * if in case the disabled fused pipe is not the last pipe,
+	 * it requires to fix the wrong populated possible_crtcs mask.
+	 */
+	if (is_power_of_2(INTEL_INFO(dev_priv)->pipe_mask + 1))
+		return;
+
+	for_each_intel_crtc(&dev_priv->drm, crtc) {
+		for_each_intel_plane_on_crtc(&dev_priv->drm, crtc, plane) {
+			if (WARN_ON(!(plane->base.possible_crtcs & BIT(crtc->pipe))))
+				return;
+			plane->base.possible_crtcs =
+					drm_crtc_mask(&crtc->base);
+		}
+	}
+}
+
 static int intel_crtc_init(struct drm_i915_private *dev_priv, enum pipe pipe)
 {
 	struct intel_plane *primary, *cursor;
@@ -17544,6 +17566,7 @@ int intel_modeset_init(struct drm_i915_private *i915)
 		}
 	}
 
+	intel_plane_possible_crtc_fixup(i915);
 	intel_shared_dpll_init(dev);
 	intel_update_fdi_pll_freq(i915);
 
-- 
2.24.0



More information about the Intel-gfx mailing list