[Intel-gfx] [PATCH v2 8/8] drm/i915: Add debug prints for encoder modeset hooks

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Fri May 27 17:59:26 UTC 2016


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

To get a better idea where exactly some error occurred during modeset,
put in some debug prints to tell us when the variuous encoder hooks are
getting called.

v2: i9xx ->enable hook slipped through, bring it to the fold

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 58 +++++++++++++++++-------------------
 1 file changed, 28 insertions(+), 30 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index e1e61e00880b..35a5623dfcde 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4726,6 +4726,15 @@ static void intel_crtc_disable_planes(struct drm_crtc *crtc, unsigned plane_mask
 	intel_frontbuffer_flip(dev, INTEL_FRONTBUFFER_ALL_MASK(pipe));
 }
 
+#define intel_call_encoder_func(encoder, func) \
+do { \
+	if (!(encoder)->func) \
+		break; \
+	DRM_DEBUG_KMS("%s " #func " start\n", (encoder)->base.name); \
+	(encoder)->func(encoder); \
+	DRM_DEBUG_KMS("%s " #func " end\n", (encoder)->base.name); \
+} while (0)
+
 static void ironlake_crtc_enable(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
@@ -4773,8 +4782,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
 	intel_crtc->active = true;
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		if (encoder->pre_enable)
-			encoder->pre_enable(encoder);
+		intel_call_encoder_func(encoder, pre_enable);
 
 	if (intel_crtc->config->has_pch_encoder) {
 		/* Note: FDI PLL enabling _must_ be done before we enable the
@@ -4805,7 +4813,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc)
 	drm_crtc_vblank_on(crtc);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		encoder->enable(encoder);
+		intel_call_encoder_func(encoder, enable);
 
 	if (HAS_PCH_CPT(dev))
 		cpt_verify_modeset(dev, intel_crtc->pipe);
@@ -4877,10 +4885,8 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
 	else
 		intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
 
-	for_each_encoder_on_crtc(dev, crtc, encoder) {
-		if (encoder->pre_enable)
-			encoder->pre_enable(encoder);
-	}
+	for_each_encoder_on_crtc(dev, crtc, encoder)
+		intel_call_encoder_func(encoder, pre_enable);
 
 	if (intel_crtc->config->has_pch_encoder)
 		dev_priv->display.fdi_link_train(crtc);
@@ -4922,7 +4928,7 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
 	drm_crtc_vblank_on(crtc);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder) {
-		encoder->enable(encoder);
+		intel_call_encoder_func(encoder, enable);
 		intel_opregion_notify_encoder(encoder, true);
 	}
 
@@ -4977,7 +4983,7 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
 	}
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		encoder->disable(encoder);
+		intel_call_encoder_func(encoder, disable);
 
 	drm_crtc_vblank_off(crtc);
 	assert_vblank_disabled(crtc);
@@ -4990,8 +4996,7 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
 		ironlake_fdi_disable(crtc);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		if (encoder->post_disable)
-			encoder->post_disable(encoder);
+		intel_call_encoder_func(encoder, post_disable);
 
 	if (intel_crtc->config->has_pch_encoder) {
 		ironlake_disable_pch_transcoder(dev_priv, pipe);
@@ -5035,7 +5040,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
 
 	for_each_encoder_on_crtc(dev, crtc, encoder) {
 		intel_opregion_notify_encoder(encoder, false);
-		encoder->disable(encoder);
+		intel_call_encoder_func(encoder, disable);
 	}
 
 	drm_crtc_vblank_off(crtc);
@@ -5060,8 +5065,7 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
 		intel_ddi_disable_pipe_clock(intel_crtc);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		if (encoder->post_disable)
-			encoder->post_disable(encoder);
+		intel_call_encoder_func(encoder, post_disable);
 
 	if (intel_crtc->config->has_pch_encoder) {
 		lpt_disable_pch_transcoder(dev_priv);
@@ -6157,8 +6161,7 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
 	intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		if (encoder->pre_pll_enable)
-			encoder->pre_pll_enable(encoder);
+		intel_call_encoder_func(encoder, pre_pll_enable);
 
 	if (IS_CHERRYVIEW(dev)) {
 		chv_prepare_pll(intel_crtc, intel_crtc->config);
@@ -6169,8 +6172,7 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
 	}
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		if (encoder->pre_enable)
-			encoder->pre_enable(encoder);
+		intel_call_encoder_func(encoder, pre_enable);
 
 	i9xx_pfit_enable(intel_crtc);
 
@@ -6183,7 +6185,7 @@ static void valleyview_crtc_enable(struct drm_crtc *crtc)
 	drm_crtc_vblank_on(crtc);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		encoder->enable(encoder);
+		intel_call_encoder_func(encoder, enable);
 }
 
 static void i9xx_set_pll_dividers(struct intel_crtc *crtc)
@@ -6224,8 +6226,7 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
 		intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, true);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		if (encoder->pre_enable)
-			encoder->pre_enable(encoder);
+		intel_call_encoder_func(encoder, pre_enable);
 
 	i9xx_enable_pll(intel_crtc);
 
@@ -6240,7 +6241,7 @@ static void i9xx_crtc_enable(struct drm_crtc *crtc)
 	drm_crtc_vblank_on(crtc);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		encoder->enable(encoder);
+		intel_call_encoder_func(encoder, enable);
 }
 
 static void i9xx_pfit_disable(struct intel_crtc *crtc)
@@ -6274,7 +6275,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 		intel_wait_for_vblank(dev, pipe);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		encoder->disable(encoder);
+		intel_call_encoder_func(encoder, disable);
 
 	drm_crtc_vblank_off(crtc);
 	assert_vblank_disabled(crtc);
@@ -6284,8 +6285,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 	i9xx_pfit_disable(intel_crtc);
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		if (encoder->post_disable)
-			encoder->post_disable(encoder);
+		intel_call_encoder_func(encoder, post_disable);
 
 	if (!intel_crtc->config->has_dsi_encoder) {
 		if (IS_CHERRYVIEW(dev))
@@ -6297,8 +6297,7 @@ static void i9xx_crtc_disable(struct drm_crtc *crtc)
 	}
 
 	for_each_encoder_on_crtc(dev, crtc, encoder)
-		if (encoder->post_pll_disable)
-			encoder->post_pll_disable(encoder);
+		intel_call_encoder_func(encoder, post_pll_disable);
 
 	if (!IS_GEN2(dev))
 		intel_set_cpu_fifo_underrun_reporting(dev_priv, pipe, false);
@@ -15830,9 +15829,8 @@ static void intel_sanitize_encoder(struct intel_encoder *encoder)
 			DRM_DEBUG_KMS("[ENCODER:%d:%s] manually disabled\n",
 				      encoder->base.base.id,
 				      encoder->base.name);
-			encoder->disable(encoder);
-			if (encoder->post_disable)
-				encoder->post_disable(encoder);
+			intel_call_encoder_func(encoder, disable);
+			intel_call_encoder_func(encoder, post_disable);
 		}
 		encoder->base.crtc = NULL;
 
-- 
2.7.4



More information about the Intel-gfx mailing list