Skip to contentSkip to conversation

drm/i915: Pass pipe_config to DP link training functions

PATCH New [email protected] 3 participants 4 messages Aug 17, 2015 – Aug 26, 2015

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

PATCH 1/1 drm/i915: Pass pipe_config to DP link training functions

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

With MST the primary encoder doesn't have a crtc, so trying to dig out the pipe config via that is going to explode. Insted pass the pipe config in so that the MST code can pass in what it wants.

It's still a huge mess since the MST code recomputes the main link parameters for every stream. We should really aim to split the main link setup so that we'd compute it only once.

Fixes a regression with MST caused by:
commit 90a6b7b052b1aa17fbb98b049e9c8b7f729c35a7
Author: Ville Syrjälä <[email protected]>
Date: Mon Jul 6 16:39:15 2015 +0300

    drm/i915: Move intel_dp->lane_count into pipe_config
---
 drivers/gpu/drm/i915/intel_ddi.c    | 12 +++++------
 drivers/gpu/drm/i915/intel_dp.c     | 42 ++++++++++++++++++-------------------
 drivers/gpu/drm/i915/intel_dp_mst.c |  7 ++++---
 drivers/gpu/drm/i915/intel_drv.h    |  9 +++++---
 4 files changed, 36 insertions(+), 34 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +6 -6
index 56d778f..9b1a538 100644
@@ -723,16 +723,16 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)
 	DRM_ERROR("FDI link training failed!\n");
 }
 
-void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder)
+void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder,
+			       const struct intel_crtc_state *pipe_config)
 {
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct intel_digital_port *intel_dig_port =
 		enc_to_dig_port(&encoder->base);
-	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
 
 	intel_dp->DP = intel_dig_port->saved_port_bits |
 		DDI_BUF_CTL_ENABLE | DDI_BUF_TRANS_SELECT(0);
-	intel_dp->DP |= DDI_PORT_WIDTH(crtc->config->lane_count);
+	intel_dp->DP |= DDI_PORT_WIDTH(pipe_config->lane_count);
 }
 
 static struct intel_encoder *
@@ -2314,11 +2314,11 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
-		intel_ddi_init_dp_buf_reg(intel_encoder);
+		intel_ddi_init_dp_buf_reg(intel_encoder, crtc->config);
 
 		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_start_link_train(intel_dp, crtc->config);
+		intel_dp_complete_link_train(intel_dp, crtc->config);
 		if (port != PORT_A || INTEL_INFO(dev)->gen >= 9)
 			intel_dp_stop_link_train(intel_dp);
 	} else if (type == INTEL_OUTPUT_HDMI) {
drivers/gpu/drm/i915/intel_dp.c +20 -22

124 lines not on this page · raw message

drivers/gpu/drm/i915/intel_dp_mst.c +4 -3
index 9ec5c20..4c0304a 100644
@@ -170,13 +170,14 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
 			I915_WRITE(PORT_CLK_SEL(port),
 				   intel_crtc->config->ddi_pll_sel);
 
-		intel_ddi_init_dp_buf_reg(&intel_dig_port->base);
+		intel_ddi_init_dp_buf_reg(&intel_dig_port->base,
+					  intel_crtc->config);
 
 		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_start_link_train(intel_dp, intel_crtc->config);
+		intel_dp_complete_link_train(intel_dp, intel_crtc->config);
 		intel_dp_stop_link_train(intel_dp);
 	}
 
drivers/gpu/drm/i915/intel_drv.h +6 -3
index 81b7d77..8e3ccd8 100644
@@ -958,7 +958,8 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 struct intel_encoder *
 intel_ddi_get_crtc_new_encoder(struct intel_crtc_state *crtc_state);
 
-void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder);
+void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder,
+			       const struct intel_crtc_state *pipe_config);
 void intel_ddi_clock_get(struct intel_encoder *encoder,
 			 struct intel_crtc_state *pipe_config);
 void intel_ddi_set_vc_payload_alloc(struct drm_crtc *crtc, bool state);
@@ -1161,8 +1162,10 @@ void assert_csr_loaded(struct drm_i915_private *dev_priv);
 void intel_dp_init(struct drm_device *dev, int output_reg, enum port port);
 bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			     struct intel_connector *intel_connector);
-void intel_dp_start_link_train(struct intel_dp *intel_dp);
-void intel_dp_complete_link_train(struct intel_dp *intel_dp);
+void intel_dp_start_link_train(struct intel_dp *intel_dp,
+			       const struct intel_crtc_state *pipe_config);
+void intel_dp_complete_link_train(struct intel_dp *intel_dp,
+				  const struct intel_crtc_state *pipe_config);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
 void intel_dp_sink_dpms(struct intel_dp *intel_dp, int mode);
 void intel_dp_encoder_destroy(struct drm_encoder *encoder);
Signature · 6 lines
2.4.6

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

PATCH v2 1/1 drm/i915: Put back lane_count into intel_dp and add link_rate too

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

With MST there won't be a crtc assigned to the main link encoder, so trying to dig up the pipe_config from there is a recipe for an oops.

Instead store the parameters (lane_count and link_rate) in the encoder, and use those values during link training etc. Since those parameters are now assigned only when the link is actually enabled, .compute_config() won't clobber them as it did before.

Hardware state readout is still bonkers though as we don't transfer the link parameters from pipe_config intel_dp. We should do that during encoder sanitation. But since we don't even do a proper job of reading out the main link encoder state for MST there's littel point in worrying about this now.

Fixes a regression with MST caused by:
commit 90a6b7b052b1aa17fbb98b049e9c8b7f729c35a7
Author: Ville Syrjälä <[email protected]>
Date: Mon Jul 6 16:39:15 2015 +0300

    drm/i915: Move intel_dp->lane_count into pipe_config

v2: Different apporoach that should keep intel_dp_check_mst_status()
somewhat less oopsy

---
 drivers/gpu/drm/i915/intel_ddi.c    |  5 ++--
 drivers/gpu/drm/i915/intel_dp.c     | 53 +++++++++++++++++--------------------
 drivers/gpu/drm/i915/intel_dp_mst.c |  2 ++
 drivers/gpu/drm/i915/intel_drv.h    |  4 +++
 4 files changed, 33 insertions(+), 31 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +3 -2
index 56d778f..5dff8b7 100644
@@ -728,11 +728,10 @@ void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder)
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct intel_digital_port *intel_dig_port =
 		enc_to_dig_port(&encoder->base);
-	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
 
 	intel_dp->DP = intel_dig_port->saved_port_bits |
 		DDI_BUF_CTL_ENABLE | DDI_BUF_TRANS_SELECT(0);
-	intel_dp->DP |= DDI_PORT_WIDTH(crtc->config->lane_count);
+	intel_dp->DP |= DDI_PORT_WIDTH(intel_dp->lane_count);
 }
 
 static struct intel_encoder *
@@ -2314,6 +2313,8 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)
 	if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) {
 		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 
+		intel_dp_set_link_params(intel_dp, crtc->config);
+
 		intel_ddi_init_dp_buf_reg(intel_encoder);
 
 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
drivers/gpu/drm/i915/intel_dp.c +24 -29

180 lines not on this page · raw message

drivers/gpu/drm/i915/intel_dp_mst.c +2 -0
index 9ec5c20..ebf2054 100644
@@ -165,6 +165,8 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)
 	if (intel_dp->active_mst_links == 0) {
 		enum port port = intel_ddi_get_encoder_port(encoder);
 
+		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),
drivers/gpu/drm/i915/intel_drv.h +4 -0
index 81b7d77..71a2e18 100644
@@ -708,6 +708,8 @@ struct intel_dp {
 	uint32_t output_reg;
 	uint32_t aux_ch_ctl_reg;
 	uint32_t DP;
+	int link_rate;
+	uint8_t lane_count;
 	bool has_audio;
 	enum hdmi_force_audio force_audio;
 	bool limited_color_range;
@@ -1161,6 +1163,8 @@ void assert_csr_loaded(struct drm_i915_private *dev_priv);
 void intel_dp_init(struct drm_device *dev, int output_reg, enum port port);
 bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 			     struct intel_connector *intel_connector);
+void intel_dp_set_link_params(struct intel_dp *intel_dp,
+			      const struct intel_crtc_state *pipe_config);
 void intel_dp_start_link_train(struct intel_dp *intel_dp);
 void intel_dp_complete_link_train(struct intel_dp *intel_dp);
 void intel_dp_stop_link_train(struct intel_dp *intel_dp);
Signature · 6 lines
2.4.6

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v2 1/1
#2 lore raw

Re: [PATCH v2] drm/i915: Put back lane_count into intel_dp and add link_rate too

Hey,

Op 17-08-15 om 17:05 schreef [email protected]:

Quoted 23 lines

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

With MST there won't be a crtc assigned to the main link encoder, so trying to dig up the pipe_config from there is a recipe for an oops.

Instead store the parameters (lane_count and link_rate) in the encoder, and use those values during link training etc. Since those parameters are now assigned only when the link is actually enabled, .compute_config() won't clobber them as it did before.

Hardware state readout is still bonkers though as we don't transfer the link parameters from pipe_config intel_dp. We should do that during encoder sanitation. But since we don't even do a proper job of reading out the main link encoder state for MST there's littel point in worrying about this now.

Fixes a regression with MST caused by:
commit 90a6b7b052b1aa17fbb98b049e9c8b7f729c35a7
Author: Ville Syrjälä <[email protected]>
Date: Mon Jul 6 16:39:15 2015 +0300

    drm/i915: Move intel_dp->lane_count into pipe_config
Quoted 7 lines

v2: Different apporoach that should keep intel_dp_check_mst_status()
somewhat less oopsy

---

Thanks, that seems to make MST work as expected again.
_______________________________________________
Intel-gfx mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

Re: [PATCH v2] drm/i915: Put back lane_count into intel_dp and add link_rate too

Quoted 29 lines · Maarten Lankhorst

Hey,

Op 17-08-15 om 17:05 schreef [email protected]:

Quoted 26 lines

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

With MST there won't be a crtc assigned to the main link encoder, so trying to dig up the pipe_config from there is a recipe for an oops.

Instead store the parameters (lane_count and link_rate) in the encoder, and use those values during link training etc. Since those parameters are now assigned only when the link is actually enabled, .compute_config() won't clobber them as it did before.

Hardware state readout is still bonkers though as we don't transfer the link parameters from pipe_config intel_dp. We should do that during encoder sanitation. But since we don't even do a proper job of reading out the main link encoder state for MST there's littel point in worrying about this now.

Fixes a regression with MST caused by:
commit 90a6b7b052b1aa17fbb98b049e9c8b7f729c35a7
Author: Ville Syrjälä <[email protected]>
Date: Mon Jul 6 16:39:15 2015 +0300

    drm/i915: Move intel_dp->lane_count into pipe_config

v2: Different apporoach that should keep intel_dp_check_mst_status()
somewhat less oopsy

Quoted 7 lines
Quoted 4 lines

---

Thanks, that seems to make MST work as expected again.

Queued for -next, thanks for the patch.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx