Skip to contentSkip to conversation

drm/i915: Try to fix MST for SKL

PATCH In review [email protected] 4 participants 5 messages Aug 17, 2015 – Nov 23, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Try to fix MST for SKL

From: Ville Syrjälä <[email protected]>

Set up the DDI->PLL mapping on SKL also for MST links. Might help make MST operational on SKL.

Cc Maarten Lankhorst <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c    | 49 ++++++++++++++++++++++---------------
 drivers/gpu/drm/i915/intel_dp_mst.c |  8 +-----
 drivers/gpu/drm/i915/intel_drv.h    |  2 ++
 3 files changed, 32 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +29 -20
index 5dff8b7..10a5a98 100644
@@ -2258,30 +2258,21 @@ uint32_t ddi_signal_levels(struct intel_dp *intel_dp)
 	return DDI_BUF_TRANS_SELECT(level);
 }
 
-static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
+void intel_ddi_clk_select(struct intel_encoder *encoder,
+			  const struct intel_crtc_state *pipe_config)
 {
-	struct drm_encoder *encoder = &intel_encoder->base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
-	enum port port = intel_ddi_get_encoder_port(intel_encoder);
-	int type = intel_encoder->type;
-	int hdmi_level;
-
-	if (type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
-		intel_edp_panel_on(intel_dp);
-	}
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	enum port port = intel_ddi_get_encoder_port(encoder);
 
-	if (IS_SKYLAKE(dev)) {
-		uint32_t dpll = crtc->config->ddi_pll_sel;
+	if (IS_SKYLAKE(dev_priv)) {
+		uint32_t dpll = pipe_config->ddi_pll_sel;
 		uint32_t val;
 
 		/*
 		 * DPLL0 is used for eDP and is the only "private" DPLL (as
 		 * opposed to shared) on SKL
 		 */
-		if (type == INTEL_OUTPUT_EDP) {
+		if (encoder->type == INTEL_OUTPUT_EDP) {
 			WARN_ON(dpll != SKL_DPLL0);
 
 			val = I915_READ(DPLL_CTRL1);
@@ -2289,7 +2280,7 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 			val &= ~(DPLL_CTRL1_HDMI_MODE(dpll) |
 				 DPLL_CTRL1_SSC(dpll) |
 				 DPLL_CTRL1_LINK_RATE_MASK(dpll));
-			val |= crtc->config->dpll_hw_state.ctrl1 << (dpll * 6);
+			val |= pipe_config->dpll_hw_state.ctrl1 << (dpll * 6);
 
 			I915_WRITE(DPLL_CTRL1, val);
 			POSTING_READ(DPLL_CTRL1);
@@ -2305,11 +2296,29 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 
 		I915_WRITE(DPLL_CTRL2, val);
 
-	} else if (INTEL_INFO(dev)->gen < 9) {
-		WARN_ON(crtc->config->ddi_pll_sel == PORT_CLK_SEL_NONE);
-		I915_WRITE(PORT_CLK_SEL(port), crtc->config->ddi_pll_sel);
+	} else if (INTEL_INFO(dev_priv)->gen < 9) {
+		WARN_ON(pipe_config->ddi_pll_sel == PORT_CLK_SEL_NONE);
+		I915_WRITE(PORT_CLK_SEL(port), pipe_config->ddi_pll_sel);
+	}
+}
+
+static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
+{
+	struct drm_encoder *encoder = &intel_encoder->base;
+	struct drm_device *dev = encoder->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
+	enum port port = intel_ddi_get_encoder_port(intel_encoder);
+	int type = intel_encoder->type;
+	int hdmi_level;
+
+	if (type == INTEL_OUTPUT_EDP) {
+		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+		intel_edp_panel_on(intel_dp);
 	}
 
+	intel_ddi_clk_select(intel_encoder, crtc->config);
+
 	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
drivers/gpu/drm/i915/intel_dp_mst.c +1 -7
index ebf2054..fd25aeb7 100644
@@ -163,20 +163,14 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
 	intel_mst->port = found->port;
 
 	if (intel_dp->active_mst_links == 0) {
-		enum port port = intel_ddi_get_encoder_port(encoder);
+		intel_ddi_clk_select(encoder, intel_crtc->config);
 
 		intel_dp_set_link_params(intel_dp, intel_crtc->config);
 
-		/* FIXME: add support for SKL */
-		if (INTEL_INFO(dev)->gen < 9)
-			I915_WRITE(PORT_CLK_SEL(port),
-				   intel_crtc->config->ddi_pll_sel);
-
 		intel_ddi_init_dp_buf_reg(&intel_dig_port->base);
 
 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
 
-
 		intel_dp_start_link_train(intel_dp);
 		intel_dp_complete_link_train(intel_dp);
 		intel_dp_stop_link_train(intel_dp);
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 71a2e18..a97908a 100644
@@ -938,6 +938,8 @@ void intel_crt_init(struct drm_device *dev);
 
 
 /* intel_ddi.c */
+void intel_ddi_clk_select(struct intel_encoder *encoder,
+			  const struct intel_crtc_state *pipe_config);
 void intel_prepare_ddi(struct drm_device *dev);
 void hsw_fdi_link_train(struct drm_crtc *crtc);
 void intel_ddi_init(struct drm_device *dev, enum port port);
Signature · 6 lines
2.4.6

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 129 lines · On 08/17/2015 08:46 AM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Set up the DDI->PLL mapping on SKL also for MST links. Might help make MST operational on SKL.

Cc Maarten Lankhorst <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c    | 49 ++++++++++++++++++++++---------------
 drivers/gpu/drm/i915/intel_dp_mst.c |  8 +-----
 drivers/gpu/drm/i915/intel_drv.h    |  2 ++
 3 files changed, 32 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +29 -20
index 5dff8b7..10a5a98 100644
@@ -2258,30 +2258,21 @@ uint32_t ddi_signal_levels(struct intel_dp *intel_dp)
 	return DDI_BUF_TRANS_SELECT(level);
 }
 
-static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
+void intel_ddi_clk_select(struct intel_encoder *encoder,
+			  const struct intel_crtc_state *pipe_config)
 {
-	struct drm_encoder *encoder = &intel_encoder->base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
-	enum port port = intel_ddi_get_encoder_port(intel_encoder);
-	int type = intel_encoder->type;
-	int hdmi_level;
-
-	if (type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
-		intel_edp_panel_on(intel_dp);
-	}
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	enum port port = intel_ddi_get_encoder_port(encoder);
 
-	if (IS_SKYLAKE(dev)) {
-		uint32_t dpll = crtc->config->ddi_pll_sel;
+	if (IS_SKYLAKE(dev_priv)) {
+		uint32_t dpll = pipe_config->ddi_pll_sel;
 		uint32_t val;
 
 		/*
 		 * DPLL0 is used for eDP and is the only "private" DPLL (as
 		 * opposed to shared) on SKL
 		 */
-		if (type == INTEL_OUTPUT_EDP) {
+		if (encoder->type == INTEL_OUTPUT_EDP) {
 			WARN_ON(dpll != SKL_DPLL0);
 
 			val = I915_READ(DPLL_CTRL1);
@@ -2289,7 +2280,7 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 			val &= ~(DPLL_CTRL1_HDMI_MODE(dpll) |
 				 DPLL_CTRL1_SSC(dpll) |
 				 DPLL_CTRL1_LINK_RATE_MASK(dpll));
-			val |= crtc->config->dpll_hw_state.ctrl1 << (dpll * 6);
+			val |= pipe_config->dpll_hw_state.ctrl1 << (dpll * 6);
 
 			I915_WRITE(DPLL_CTRL1, val);
 			POSTING_READ(DPLL_CTRL1);
@@ -2305,11 +2296,29 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 
 		I915_WRITE(DPLL_CTRL2, val);
 
-	} else if (INTEL_INFO(dev)->gen < 9) {
-		WARN_ON(crtc->config->ddi_pll_sel == PORT_CLK_SEL_NONE);
-		I915_WRITE(PORT_CLK_SEL(port), crtc->config->ddi_pll_sel);
+	} else if (INTEL_INFO(dev_priv)->gen < 9) {
+		WARN_ON(pipe_config->ddi_pll_sel == PORT_CLK_SEL_NONE);
+		I915_WRITE(PORT_CLK_SEL(port), pipe_config->ddi_pll_sel);
+	}
+}
+
+static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
+{
+	struct drm_encoder *encoder = &intel_encoder->base;
+	struct drm_device *dev = encoder->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
+	enum port port = intel_ddi_get_encoder_port(intel_encoder);
+	int type = intel_encoder->type;
+	int hdmi_level;
+
+	if (type == INTEL_OUTPUT_EDP) {
+		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+		intel_edp_panel_on(intel_dp);
 	}
 
+	intel_ddi_clk_select(intel_encoder, crtc->config);
+
 	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
drivers/gpu/drm/i915/intel_dp_mst.c +1 -7
index ebf2054..fd25aeb7 100644
@@ -163,20 +163,14 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
 	intel_mst->port = found->port;
 
 	if (intel_dp->active_mst_links == 0) {
-		enum port port = intel_ddi_get_encoder_port(encoder);
+		intel_ddi_clk_select(encoder, intel_crtc->config);
 
 		intel_dp_set_link_params(intel_dp, intel_crtc->config);
 
-		/* FIXME: add support for SKL */
-		if (INTEL_INFO(dev)->gen < 9)
-			I915_WRITE(PORT_CLK_SEL(port),
-				   intel_crtc->config->ddi_pll_sel);
-
 		intel_ddi_init_dp_buf_reg(&intel_dig_port->base);
 
 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
 
-
 		intel_dp_start_link_train(intel_dp);
 		intel_dp_complete_link_train(intel_dp);
 		intel_dp_stop_link_train(intel_dp);
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 71a2e18..a97908a 100644

drivers/gpu/drm/i915/intel_drv.h void intel_crt_init(struct drm_device *dev); · line 945

Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -938,6 +938,8 @@ void intel_crt_init(struct drm_device *dev);
 
 
 /* intel_ddi.c */
+void intel_ddi_clk_select(struct intel_encoder *encoder,
+			  const struct intel_crtc_state *pipe_config);
 void intel_prepare_ddi(struct drm_device *dev);
 void hsw_fdi_link_train(struct drm_crtc *crtc);
 void intel_ddi_init(struct drm_device *dev, enum port port);

Looks like an improvement over current code and fixes the hard hang in
https://bugs.freedesktop.org/show_bug.cgi?id=91791, so I think we should push it.

Sounds like we need more than just this to fix MST on SKL though.

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 143 lines · Jesse Barnes
Quoted 129 lines · On 08/17/2015 08:46 AM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Set up the DDI->PLL mapping on SKL also for MST links. Might help make MST operational on SKL.

Cc Maarten Lankhorst <[email protected]>
---
 drivers/gpu/drm/i915/intel_ddi.c    | 49 ++++++++++++++++++++++---------------
 drivers/gpu/drm/i915/intel_dp_mst.c |  8 +-----
 drivers/gpu/drm/i915/intel_drv.h    |  2 ++
 3 files changed, 32 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +29 -20
index 5dff8b7..10a5a98 100644
@@ -2258,30 +2258,21 @@ uint32_t ddi_signal_levels(struct intel_dp *intel_dp)
 	return DDI_BUF_TRANS_SELECT(level);
 }
 
-static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
+void intel_ddi_clk_select(struct intel_encoder *encoder,
+			  const struct intel_crtc_state *pipe_config)
 {
-	struct drm_encoder *encoder = &intel_encoder->base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
-	enum port port = intel_ddi_get_encoder_port(intel_encoder);
-	int type = intel_encoder->type;
-	int hdmi_level;
-
-	if (type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
-		intel_edp_panel_on(intel_dp);
-	}
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	enum port port = intel_ddi_get_encoder_port(encoder);
 
-	if (IS_SKYLAKE(dev)) {
-		uint32_t dpll = crtc->config->ddi_pll_sel;
+	if (IS_SKYLAKE(dev_priv)) {
+		uint32_t dpll = pipe_config->ddi_pll_sel;
 		uint32_t val;
 
 		/*
 		 * DPLL0 is used for eDP and is the only "private" DPLL (as
 		 * opposed to shared) on SKL
 		 */
-		if (type == INTEL_OUTPUT_EDP) {
+		if (encoder->type == INTEL_OUTPUT_EDP) {
 			WARN_ON(dpll != SKL_DPLL0);
 
 			val = I915_READ(DPLL_CTRL1);
@@ -2289,7 +2280,7 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 			val &= ~(DPLL_CTRL1_HDMI_MODE(dpll) |
 				 DPLL_CTRL1_SSC(dpll) |
 				 DPLL_CTRL1_LINK_RATE_MASK(dpll));
-			val |= crtc->config->dpll_hw_state.ctrl1 << (dpll * 6);
+			val |= pipe_config->dpll_hw_state.ctrl1 << (dpll * 6);
 
 			I915_WRITE(DPLL_CTRL1, val);
 			POSTING_READ(DPLL_CTRL1);
@@ -2305,11 +2296,29 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 
 		I915_WRITE(DPLL_CTRL2, val);
 
-	} else if (INTEL_INFO(dev)->gen < 9) {
-		WARN_ON(crtc->config->ddi_pll_sel == PORT_CLK_SEL_NONE);
-		I915_WRITE(PORT_CLK_SEL(port), crtc->config->ddi_pll_sel);
+	} else if (INTEL_INFO(dev_priv)->gen < 9) {
+		WARN_ON(pipe_config->ddi_pll_sel == PORT_CLK_SEL_NONE);
+		I915_WRITE(PORT_CLK_SEL(port), pipe_config->ddi_pll_sel);
+	}
+}
+
+static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
+{
+	struct drm_encoder *encoder = &intel_encoder->base;
+	struct drm_device *dev = encoder->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
+	enum port port = intel_ddi_get_encoder_port(intel_encoder);
+	int type = intel_encoder->type;
+	int hdmi_level;
+
+	if (type == INTEL_OUTPUT_EDP) {
+		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+		intel_edp_panel_on(intel_dp);
 	}
 
+	intel_ddi_clk_select(intel_encoder, crtc->config);
+
 	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
drivers/gpu/drm/i915/intel_dp_mst.c +1 -7
index ebf2054..fd25aeb7 100644
@@ -163,20 +163,14 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
 	intel_mst->port = found->port;
 
 	if (intel_dp->active_mst_links == 0) {
-		enum port port = intel_ddi_get_encoder_port(encoder);
+		intel_ddi_clk_select(encoder, intel_crtc->config);
 
 		intel_dp_set_link_params(intel_dp, intel_crtc->config);
 
-		/* FIXME: add support for SKL */
-		if (INTEL_INFO(dev)->gen < 9)
-			I915_WRITE(PORT_CLK_SEL(port),
-				   intel_crtc->config->ddi_pll_sel);
-
 		intel_ddi_init_dp_buf_reg(&intel_dig_port->base);
 
 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
 
-
 		intel_dp_start_link_train(intel_dp);
 		intel_dp_complete_link_train(intel_dp);
 		intel_dp_stop_link_train(intel_dp);
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 71a2e18..a97908a 100644

drivers/gpu/drm/i915/intel_drv.h void intel_crt_init(struct drm_device *dev); · line 945

Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -938,6 +938,8 @@ void intel_crt_init(struct drm_device *dev);
 
 
 /* intel_ddi.c */
+void intel_ddi_clk_select(struct intel_encoder *encoder,
+			  const struct intel_crtc_state *pipe_config);
 void intel_prepare_ddi(struct drm_device *dev);
 void hsw_fdi_link_train(struct drm_crtc *crtc);
 void intel_ddi_init(struct drm_device *dev, enum port port);

Looks like an improvement over current code and fixes the hard hang in
https://bugs.freedesktop.org/show_bug.cgi?id=91791, so I think we should push it.

Quoted 3 lines

Sounds like we need more than just this to fix MST on SKL though.

Patch merged to dinq with an improved subject:
"drm/i915: Setup DDI clk for MST on SKL"

... which apparently made the patchwork link invalid somehow:
"remote: Updating patchwork state for http://patchwork.freedesktop.org/project/intel-gfx/list/
remote: E: failed to find patch for rev e404ba8d06ff2a1bdb916a9e5d2c09cacd7e5ca3
remote: I: 0 patch(es) updated to state Accepted."

Anyway, thanks for the r-b.

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
In reply to Jesse Barnes
Quoted 142 lines · Jesse Barnes
Quoted 129 lines · On 08/17/2015 08:46 AM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Set up the DDI->PLL mapping on SKL also for MST links. Might help make MST operational on SKL.

Cc Maarten Lankhorst <[email protected]>
---
  drivers/gpu/drm/i915/intel_ddi.c    | 49 ++++++++++++++++++++++---------------
  drivers/gpu/drm/i915/intel_dp_mst.c |  8 +-----
  drivers/gpu/drm/i915/intel_drv.h    |  2 ++
  3 files changed, 32 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +29 -20
index 5dff8b7..10a5a98 100644
@@ -2258,30 +2258,21 @@ uint32_t ddi_signal_levels(struct intel_dp *intel_dp)
  	return DDI_BUF_TRANS_SELECT(level);
  }
 
-static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
+void intel_ddi_clk_select(struct intel_encoder *encoder,
+			  const struct intel_crtc_state *pipe_config)
  {
-	struct drm_encoder *encoder = &intel_encoder->base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
-	enum port port = intel_ddi_get_encoder_port(intel_encoder);
-	int type = intel_encoder->type;
-	int hdmi_level;
-
-	if (type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
-		intel_edp_panel_on(intel_dp);
-	}
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	enum port port = intel_ddi_get_encoder_port(encoder);
 
-	if (IS_SKYLAKE(dev)) {
-		uint32_t dpll = crtc->config->ddi_pll_sel;
+	if (IS_SKYLAKE(dev_priv)) {
+		uint32_t dpll = pipe_config->ddi_pll_sel;
  		uint32_t val;
 
  		/*
  		 * DPLL0 is used for eDP and is the only "private" DPLL (as
  		 * opposed to shared) on SKL
  		 */
-		if (type == INTEL_OUTPUT_EDP) {
+		if (encoder->type == INTEL_OUTPUT_EDP) {
  			WARN_ON(dpll != SKL_DPLL0);
 
  			val = I915_READ(DPLL_CTRL1);
@@ -2289,7 +2280,7 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
  			val &= ~(DPLL_CTRL1_HDMI_MODE(dpll) |
  				 DPLL_CTRL1_SSC(dpll) |
  				 DPLL_CTRL1_LINK_RATE_MASK(dpll));
-			val |= crtc->config->dpll_hw_state.ctrl1 << (dpll * 6);
+			val |= pipe_config->dpll_hw_state.ctrl1 << (dpll * 6);
 
  			I915_WRITE(DPLL_CTRL1, val);
  			POSTING_READ(DPLL_CTRL1);
@@ -2305,11 +2296,29 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 
  		I915_WRITE(DPLL_CTRL2, val);
 
-	} else if (INTEL_INFO(dev)->gen < 9) {
-		WARN_ON(crtc->config->ddi_pll_sel == PORT_CLK_SEL_NONE);
-		I915_WRITE(PORT_CLK_SEL(port), crtc->config->ddi_pll_sel);
+	} else if (INTEL_INFO(dev_priv)->gen < 9) {
+		WARN_ON(pipe_config->ddi_pll_sel == PORT_CLK_SEL_NONE);
+		I915_WRITE(PORT_CLK_SEL(port), pipe_config->ddi_pll_sel);
+	}
+}
+
+static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
+{
+	struct drm_encoder *encoder = &intel_encoder->base;
+	struct drm_device *dev = encoder->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
+	enum port port = intel_ddi_get_encoder_port(intel_encoder);
+	int type = intel_encoder->type;
+	int hdmi_level;
+
+	if (type == INTEL_OUTPUT_EDP) {
+		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+		intel_edp_panel_on(intel_dp);
  	}
 
+	intel_ddi_clk_select(intel_encoder, crtc->config);
+
  	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
  		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
drivers/gpu/drm/i915/intel_dp_mst.c +1 -7
index ebf2054..fd25aeb7 100644
@@ -163,20 +163,14 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
  	intel_mst->port = found->port;
 
  	if (intel_dp->active_mst_links == 0) {
-		enum port port = intel_ddi_get_encoder_port(encoder);
+		intel_ddi_clk_select(encoder, intel_crtc->config);
 
  		intel_dp_set_link_params(intel_dp, intel_crtc->config);
 
-		/* FIXME: add support for SKL */
-		if (INTEL_INFO(dev)->gen < 9)
-			I915_WRITE(PORT_CLK_SEL(port),
-				   intel_crtc->config->ddi_pll_sel);
-
  		intel_ddi_init_dp_buf_reg(&intel_dig_port->base);
 
  		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
 
-
  		intel_dp_start_link_train(intel_dp);
  		intel_dp_complete_link_train(intel_dp);
  		intel_dp_stop_link_train(intel_dp);
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 71a2e18..a97908a 100644

drivers/gpu/drm/i915/intel_drv.h void intel_crt_init(struct drm_device *dev); · line 945

Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -938,6 +938,8 @@ void intel_crt_init(struct drm_device *dev);
 
 
  /* intel_ddi.c */
+void intel_ddi_clk_select(struct intel_encoder *encoder,
+			  const struct intel_crtc_state *pipe_config);
  void intel_prepare_ddi(struct drm_device *dev);
  void hsw_fdi_link_train(struct drm_crtc *crtc);
  void intel_ddi_init(struct drm_device *dev, enum port port);

Looks like an improvement over current code and fixes the hard hang in
https://bugs.freedesktop.org/show_bug.cgi?id=91791, so I think we should push it.

Quoted 1 line

Sounds like we need more than just this to fix MST on SKL though.

I tested against dell 4k UP3214Q and I still have a hard hang so yes MST on skylake is not in a good shape.

Quoted 6 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 178 lines · Kenneth Johansson
Quoted 177 lines · Jesse Barnes
Quoted 168 lines · On 08/17/2015 08:46 AM, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Set up the DDI->PLL mapping on SKL also for MST links. Might help make
MST operational on SKL.

Cc Maarten Lankhorst <[email protected]>
---
  drivers/gpu/drm/i915/intel_ddi.c    | 49 ++++++++++++++++++++++
---------------
  drivers/gpu/drm/i915/intel_dp_mst.c |  8 +-----
  drivers/gpu/drm/i915/intel_drv.h    |  2 ++
  3 files changed, 32 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +6 -16
index 5dff8b7..10a5a98 100644
@@ -2258,30 +2258,21 @@ uint32_t ddi_signal_levels(struct
 intel_dp *intel_dp)
  	return DDI_BUF_TRANS_SELECT(level);
  }
 
-static void intel_ddi_pre_enable(struct intel_encoder
 *intel_encoder)
+void intel_ddi_clk_select(struct intel_encoder *encoder,
+			  const struct intel_crtc_state
 *pipe_config)
  {
-	struct drm_encoder *encoder = &intel_encoder->base;
-	struct drm_device *dev = encoder->dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
-	enum port port =
 intel_ddi_get_encoder_port(intel_encoder);
-	int type = intel_encoder->type;
-	int hdmi_level;
-
-	if (type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp =
 enc_to_intel_dp(encoder);
-		intel_edp_panel_on(intel_dp);
-	}
+	struct drm_i915_private *dev_priv = to_i915(encoder
->base.dev);
+	enum port port = intel_ddi_get_encoder_port(encoder);
 
-	if (IS_SKYLAKE(dev)) {
-		uint32_t dpll = crtc->config->ddi_pll_sel;
+	if (IS_SKYLAKE(dev_priv)) {
+		uint32_t dpll = pipe_config->ddi_pll_sel;
  		uint32_t val;
 
  		/*
  		 * DPLL0 is used for eDP and is the only

"private" DPLL (as
* opposed to shared) on SKL
*/

drivers/gpu/drm/i915/intel_ddi.c +2 -2
-		if (type == INTEL_OUTPUT_EDP) {
+		if (encoder->type == INTEL_OUTPUT_EDP) {
  			WARN_ON(dpll != SKL_DPLL0);
 
  			val = I915_READ(DPLL_CTRL1);
@@ -2289,7 +2280,7 @@ static void intel_ddi_pre_enable(struct
 intel_encoder *intel_encoder)
  			val &= ~(DPLL_CTRL1_HDMI_MODE(dpll) |
  				 DPLL_CTRL1_SSC(dpll) |
  				 DPLL_CTRL1_LINK_RATE_MASK(dpll
 ));
-			val |= crtc->config->dpll_hw_state.ctrl1
 << (dpll * 6);
+			val |= pipe_config->dpll_hw_state.ctrl1

<< (dpll * 6);

  			I915_WRITE(DPLL_CTRL1, val);
  			POSTING_READ(DPLL_CTRL1);
drivers/gpu/drm/i915/intel_ddi.c +7 -5
@@ -2305,11 +2296,29 @@ static void intel_ddi_pre_enable(struct
 intel_encoder *intel_encoder)
 
  		I915_WRITE(DPLL_CTRL2, val);
 
-	} else if (INTEL_INFO(dev)->gen < 9) {
-		WARN_ON(crtc->config->ddi_pll_sel ==
 PORT_CLK_SEL_NONE);
-		I915_WRITE(PORT_CLK_SEL(port), crtc->config
->ddi_pll_sel);
+	} else if (INTEL_INFO(dev_priv)->gen < 9) {
+		WARN_ON(pipe_config->ddi_pll_sel ==
 PORT_CLK_SEL_NONE);
+		I915_WRITE(PORT_CLK_SEL(port), pipe_config
->ddi_pll_sel);
+	}
+}
+
+static void intel_ddi_pre_enable(struct intel_encoder

*intel_encoder)

drivers/gpu/drm/i915/intel_ddi.c +6 -0
+{
+	struct drm_encoder *encoder = &intel_encoder->base;
+	struct drm_device *dev = encoder->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
+	enum port port =

intel_ddi_get_encoder_port(intel_encoder);

drivers/gpu/drm/i915/intel_ddi.c +5 -0
+	int type = intel_encoder->type;
+	int hdmi_level;
+
+	if (type == INTEL_OUTPUT_EDP) {
+		struct intel_dp *intel_dp =

enc_to_intel_dp(encoder);

drivers/gpu/drm/i915/intel_ddi.c +3 -0
+		intel_edp_panel_on(intel_dp);
  	}
 
+	intel_ddi_clk_select(intel_encoder, crtc->config);
+
  	if (type == INTEL_OUTPUT_DISPLAYPORT || type ==

INTEL_OUTPUT_EDP) {
struct intel_dp *intel_dp =
enc_to_intel_dp(encoder);

drivers/gpu/drm/i915/intel_dp_mst.c +1 -11
index ebf2054..fd25aeb7 100644
@@ -163,20 +163,14 @@ static void intel_mst_pre_enable_dp(struct
 intel_encoder *encoder)
  	intel_mst->port = found->port;
 
  	if (intel_dp->active_mst_links == 0) {
-		enum port port =
 intel_ddi_get_encoder_port(encoder);
+		intel_ddi_clk_select(encoder, intel_crtc
->config);
 
  		intel_dp_set_link_params(intel_dp, intel_crtc
->config);
 
-		/* FIXME: add support for SKL */
-		if (INTEL_INFO(dev)->gen < 9)
-			I915_WRITE(PORT_CLK_SEL(port),
-				   intel_crtc->config
->ddi_pll_sel);
-
  		intel_ddi_init_dp_buf_reg(&intel_dig_port
->base);
 
  		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
 
-
  		intel_dp_start_link_train(intel_dp);
  		intel_dp_complete_link_train(intel_dp);
  		intel_dp_stop_link_train(intel_dp);
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 71a2e18..a97908a 100644
@@ -938,6 +938,8 @@ void intel_crt_init(struct drm_device *dev);
 
 
  /* intel_ddi.c */
+void intel_ddi_clk_select(struct intel_encoder *encoder,
+			  const struct intel_crtc_state
 *pipe_config);
  void intel_prepare_ddi(struct drm_device *dev);
  void hsw_fdi_link_train(struct drm_crtc *crtc);
Quoted 2 lines
  void intel_ddi_init(struct drm_device *dev, enum port port);

Looks like an improvement over current code and fixes the hard hang in
https://bugs.freedesktop.org/show_bug.cgi?id=91791, so I think we should
push it.

Quoted 4 lines
Quoted 1 line

Sounds like we need more than just this to fix MST on SKL though.

I tested against dell 4k UP3214Q and I still have a hard hang so yes MST on skylake is not in a good shape.

Just tested on special kernel for yoga 900 with USB Type C to DP adapter connected to Club 3D MST Hub (CSV-5200). Mostly works with 2560x1440 on local display and dual head Samsung 4k monitors - same resolution on all. I am writing this e-mail on one of the samsung monitors. have pictures if you are interested.

Also, I am getting watermark stack traces and periodic drops of the MST displays - blank then re-appear.

Jim

Quoted 11 lines
Quoted 6 lines

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx