All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux
@ 2017-09-18 18:25 Ville Syrjala
  2017-09-18 18:25 ` [PATCH 01/29] drm/i915: Replace some spaces with tabs Ville Syrjala
                   ` (35 more replies)
  0 siblings, 36 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

This series aims to eliminate the DDI encoder->type shenanigans.
Afterwards encoder->type will permanently be "DDI" for DDI DP/HDMI
ports, and "EDP" for DDI eDP ports. To figure out in which mode
we want to drive the port we use the output_types bitmask, which
for DDI will be computed by the new .compute_output_type() encoder
hook.

Originally (some years ago?) I simply planned to avoid this role 
switching for the DDI encoders by splitting each encoders into two
two separate instances (which is how the pre-DDI platforms work).
I even posted a patch series achieving this. But the series didn't
land before LSPCON happened and at that point I figured that we
actually might want to switch the encoder mode as needed. So I
came up with this alternative apporach (and introduced the
output_types bitmask). Unfortunately I never managed to land the
remaining bits.

Having a single encoder per DDI port does have the benefit of
giving userspace a hint that there's no way to enable both the DP
and HDMI connectors handing off it at the same time. With pre-DDI
platforms userspace has no idea which connectors are tied to the
same port. So one might argue that this is indeed the better
approach.

Since I last posted this stuff a lot has changed in the DDI code
(BXT and CNL at least, can't recall if SKL was a thing when
I originally posted this stuff). So this series actually turned
out into a rather massive "clean up DDI" series. I regret it
ending up this big, but I don't think I want to start spliting
it up at this point. So I'll just offer my apologies and post
the series as is. The patches shouldn't be too tricky to read
since it's basically just refactoring all over.

Entire series is available here:
git://github.com/vsyrjala/linux.git ddi_output_types

Ville Syrjälä (29):
  drm/i915: Replace some spaces with tabs
  drm/i915: Shrink bxt_ddi_buf_trans
  drm/i915: Shrink cnl_ddi_buf_trans
  drm/i915: Dump 'output_types' in crtc state dump
  drm/i915: Extract intel_ddi_clk_disable()
  drm/i915: Extract intel_disable_ddi_buf()
  drm/i915: Inline the required bits of intel_ddi_post_disable() into
    intel_ddi_fdi_post_disable()
  drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants
  drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp()
  drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants
  drm/i915: Plump crtc_state etc. directly to
    intel_ddi_pre_enable_{dp,hdmi}()
  drm/i915: Split intel_enable_ddi() into DP and HDMI variants
  drm/i915: Relocate intel_ddi_get_buf_trans_*() functions
  drm/i915: Extract intel_ddi_get_buf_trans_hdmi()
  drm/i915: Pass the encoder type explicitly to skl_set_iboost()
  drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers()
  drm/i915: Integrate BXT into intel_ddi_dp_voltage_max()
  drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly
  drm/i915: Kill off the BXT buf_trans default_index
  drm/i915: Don't use encoder->type in intel_ddi_set_pipe_settings()
  drm/i915: Pass crtc state to intel_prepare_dp_ddi_buffers()
  drm/i915: Start using output_types for DPLL selection
  drm/i915: Stop using encoder->type in
    intel_ddi_enable_transcoder_func()
  drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling
  drm/i915: Stop frobbing with DDI encoder->type
  drm/i915: Unify error handling for missing DDI buf trans tables
  drm/i915: Clear up the types we use for DDI buf trans level/n_entries
  drm/i915: Replace most intel_ddi_get_encoder_port() alls with
    encoder->port
  drm/i915: Pass a crtc state to ddi post_disable from MST code

 drivers/gpu/drm/i915/i915_debugfs.c   |   2 +-
 drivers/gpu/drm/i915/intel_ddi.c      | 973 ++++++++++++++++++----------------
 drivers/gpu/drm/i915/intel_display.c  |  59 ++-
 drivers/gpu/drm/i915/intel_dp.c       |  19 +-
 drivers/gpu/drm/i915/intel_dp_mst.c   |   2 +-
 drivers/gpu/drm/i915/intel_dpll_mgr.c |  36 +-
 drivers/gpu/drm/i915/intel_drv.h      |   7 +-
 drivers/gpu/drm/i915/intel_hdmi.c     |  10 +-
 drivers/gpu/drm/i915/intel_opregion.c |   2 +-
 9 files changed, 603 insertions(+), 507 deletions(-)

-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* [PATCH 01/29] drm/i915: Replace some spaces with tabs
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:38   ` Chris Wilson
  2017-09-18 18:53   ` Jani Nikula
  2017-09-18 18:25 ` [PATCH 02/29] drm/i915: Shrink bxt_ddi_buf_trans Ville Syrjala
                   ` (34 subsequent siblings)
  35 siblings, 2 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

Some comments in intel_ddi.c are indented with spaces instead of tabs.
Fix that up.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 31d14587ad86..797008033089 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1939,7 +1939,7 @@ static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
 	val |= RCOMP_SCALAR(0x98);
 	I915_WRITE(CNL_PORT_TX_DW2_GRP(port), val);
 
-        /* Program PORT_TX_DW4 */
+	/* Program PORT_TX_DW4 */
 	/* We cannot write to GRP. It would overrite individual loadgen */
 	for (ln = 0; ln < 4; ln++) {
 		val = I915_READ(CNL_PORT_TX_DW4_LN(port, ln));
@@ -1951,7 +1951,7 @@ static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
 		I915_WRITE(CNL_PORT_TX_DW4_LN(port, ln), val);
 	}
 
-        /* Program PORT_TX_DW5 */
+	/* Program PORT_TX_DW5 */
 	/* All DW5 values are fixed for every table entry */
 	val = I915_READ(CNL_PORT_TX_DW5_LN0(port));
 	val &= ~RTERM_SELECT_MASK;
@@ -1959,7 +1959,7 @@ static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
 	val |= TAP3_DISABLE;
 	I915_WRITE(CNL_PORT_TX_DW5_GRP(port), val);
 
-        /* Program PORT_TX_DW7 */
+	/* Program PORT_TX_DW7 */
 	val = I915_READ(CNL_PORT_TX_DW7_LN0(port));
 	val &= ~N_SCALAR_MASK;
 	val |= N_SCALAR(ddi_translations[level].dw7_n_scalar);
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 02/29] drm/i915: Shrink bxt_ddi_buf_trans
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
  2017-09-18 18:25 ` [PATCH 01/29] drm/i915: Replace some spaces with tabs Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:54   ` Jani Nikula
  2017-09-18 18:25 ` [PATCH 03/29] drm/i915: Shrink cnl_ddi_buf_trans Ville Syrjala
                   ` (33 subsequent siblings)
  35 siblings, 1 reply; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

All the values we put into the BXT buf_trans tables fit into 8 bits.
So switch over to u8 from the u32 we use currently.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 797008033089..5c709985904e 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -301,10 +301,10 @@ static const struct ddi_buf_trans skl_y_ddi_translations_hdmi[] = {
 };
 
 struct bxt_ddi_buf_trans {
-	u32 margin;	/* swing value */
-	u32 scale;	/* scale value */
-	u32 enable;	/* scale enable */
-	u32 deemphasis;
+	u8 margin;	/* swing value */
+	u8 scale;	/* scale value */
+	u8 enable;	/* scale enable */
+	u8 deemphasis;
 	bool default_index; /* true if the entry represents default value */
 };
 
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 03/29] drm/i915: Shrink cnl_ddi_buf_trans
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
  2017-09-18 18:25 ` [PATCH 01/29] drm/i915: Replace some spaces with tabs Ville Syrjala
  2017-09-18 18:25 ` [PATCH 02/29] drm/i915: Shrink bxt_ddi_buf_trans Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:39   ` Chris Wilson
  2017-09-18 18:40   ` Chris Wilson
  2017-09-18 18:25 ` [PATCH 04/29] drm/i915: Dump 'output_types' in crtc state dump Ville Syrjala
                   ` (32 subsequent siblings)
  35 siblings, 2 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

All the values we put into the CNL buf_trans tables fit into 8 bits.
So switch over to u8 from the u32 we use currently.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 5c709985904e..93cbbcbbc193 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -354,11 +354,11 @@ static const struct bxt_ddi_buf_trans bxt_ddi_translations_hdmi[] = {
 };
 
 struct cnl_ddi_buf_trans {
-	u32 dw2_swing_sel;
-	u32 dw7_n_scalar;
-	u32 dw4_cursor_coeff;
-	u32 dw4_post_cursor_2;
-	u32 dw4_post_cursor_1;
+	u8 dw2_swing_sel;
+	u8 dw7_n_scalar;
+	u8 dw4_cursor_coeff;
+	u8 dw4_post_cursor_2;
+	u8 dw4_post_cursor_1;
 };
 
 /* Voltage Swing Programming for VccIO 0.85V for DP */
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 04/29] drm/i915: Dump 'output_types' in crtc state dump
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (2 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 03/29] drm/i915: Shrink cnl_ddi_buf_trans Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:43   ` Chris Wilson
                     ` (2 more replies)
  2017-09-18 18:25 ` [PATCH 05/29] drm/i915: Extract intel_ddi_clk_disable() Ville Syrjala
                   ` (31 subsequent siblings)
  35 siblings, 3 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

To make it easier to debug things let's dump the output types bitmask in
the crtc state dump. And to make life that much better, let's pretty
print it as a a human reaadable string as well.

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

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8599e425abb1..192b07a92e76 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10683,6 +10683,53 @@ intel_dump_m_n_config(struct intel_crtc_state *pipe_config, char *id,
 		      m_n->link_m, m_n->link_n, m_n->tu);
 }
 
+#define OUTPUT_TYPE(x) [INTEL_OUTPUT_ ## x] = #x
+
+static const char * const output_type_str[] = {
+	OUTPUT_TYPE(UNUSED),
+	OUTPUT_TYPE(ANALOG),
+	OUTPUT_TYPE(DVO),
+	OUTPUT_TYPE(SDVO),
+	OUTPUT_TYPE(LVDS),
+	OUTPUT_TYPE(TVOUT),
+	OUTPUT_TYPE(HDMI),
+	OUTPUT_TYPE(DP),
+	OUTPUT_TYPE(EDP),
+	OUTPUT_TYPE(DSI),
+	OUTPUT_TYPE(UNKNOWN),
+	OUTPUT_TYPE(DP_MST),
+};
+
+static const char *output_types_str(unsigned int output_types)
+{
+	static char buf[64];
+	size_t len = sizeof(buf);
+	char *str = buf;
+	int i;
+
+	str[0] = '\0';
+
+	for (i = 0; i < ARRAY_SIZE(output_type_str); i++) {
+		int r;
+
+		if ((output_types & BIT(i)) == 0)
+			continue;
+
+		r = snprintf(str, len, "%s%s",
+			     str != buf ? "," : "", output_type_str[i]);
+		if (r >= len)
+			break;
+		str += r;
+		len -= r;
+
+		output_types &= ~BIT(i);
+	}
+
+	WARN_ON_ONCE(output_types != 0);
+
+	return buf;
+}
+
 static void intel_dump_pipe_config(struct intel_crtc *crtc,
 				   struct intel_crtc_state *pipe_config,
 				   const char *context)
@@ -10696,6 +10743,9 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
 
 	DRM_DEBUG_KMS("[CRTC:%d:%s]%s\n",
 		      crtc->base.base.id, crtc->base.name, context);
+	DRM_DEBUG_KMS("output_types: %s (0x%x)\n",
+		      output_types_str(pipe_config->output_types),
+		      pipe_config->output_types);
 
 	DRM_DEBUG_KMS("cpu_transcoder: %s, pipe bpp: %i, dithering: %i\n",
 		      transcoder_name(pipe_config->cpu_transcoder),
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 05/29] drm/i915: Extract intel_ddi_clk_disable()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (3 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 04/29] drm/i915: Dump 'output_types' in crtc state dump Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:45   ` Chris Wilson
  2017-09-18 18:25 ` [PATCH 06/29] drm/i915: Extract intel_disable_ddi_buf() Ville Syrjala
                   ` (30 subsequent siblings)
  35 siblings, 1 reply; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

Pull the code to disable the port clock into a function. We already have
the intel_ddi_clk_select() counterpart.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 93cbbcbbc193..2b4de7d03ff0 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2131,6 +2131,21 @@ static void intel_ddi_clk_select(struct intel_encoder *encoder,
 	}
 }
 
+static void intel_ddi_clk_disable(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	enum port port = encoder->port;
+
+	if (IS_CANNONLAKE(dev_priv))
+		I915_WRITE(DPCLKA_CFGCR0, I915_READ(DPCLKA_CFGCR0) |
+			   DPCLKA_CFGCR0_DDI_CLK_OFF(port));
+	else if (IS_GEN9_BC(dev_priv))
+		I915_WRITE(DPLL_CTRL2, I915_READ(DPLL_CTRL2) |
+			   DPLL_CTRL2_DDI_CLK_OFF(port));
+	else if (INTEL_GEN(dev_priv) < 9)
+		I915_WRITE(PORT_CLK_SEL(port), PORT_CLK_SEL_NONE);
+}
+
 static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 				    int link_rate, uint32_t lane_count,
 				    struct intel_shared_dpll *pll,
@@ -2273,14 +2288,7 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,
 	if (dig_port)
 		intel_display_power_put(dev_priv, dig_port->ddi_io_power_domain);
 
-	if (IS_CANNONLAKE(dev_priv))
-		I915_WRITE(DPCLKA_CFGCR0, I915_READ(DPCLKA_CFGCR0) |
-			   DPCLKA_CFGCR0_DDI_CLK_OFF(port));
-	else if (IS_GEN9_BC(dev_priv))
-		I915_WRITE(DPLL_CTRL2, (I915_READ(DPLL_CTRL2) |
-					DPLL_CTRL2_DDI_CLK_OFF(port)));
-	else if (INTEL_GEN(dev_priv) < 9)
-		I915_WRITE(PORT_CLK_SEL(port), PORT_CLK_SEL_NONE);
+	intel_ddi_clk_disable(intel_encoder);
 
 	if (type == INTEL_OUTPUT_HDMI) {
 		struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 06/29] drm/i915: Extract intel_disable_ddi_buf()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (4 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 05/29] drm/i915: Extract intel_ddi_clk_disable() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:55   ` Jani Nikula
  2017-09-18 18:25 ` [PATCH 07/29] drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable() Ville Syrjala
                   ` (29 subsequent siblings)
  35 siblings, 1 reply; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

Extract the code to disable the DDI_BUF_CTL into small helper. This
will allows us to detangle the encoder type mess in
intel_ddi_post_disable().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 41 +++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 2b4de7d03ff0..2dbbd47665de 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2238,25 +2238,12 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder,
 	}
 }
 
-static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,
-				   const struct intel_crtc_state *old_crtc_state,
-				   const struct drm_connector_state *old_conn_state)
+static void intel_disable_ddi_buf(struct intel_encoder *encoder)
 {
-	struct drm_encoder *encoder = &intel_encoder->base;
-	struct drm_i915_private *dev_priv = to_i915(encoder->dev);
-	enum port port = intel_ddi_get_encoder_port(intel_encoder);
-	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
-	int type = intel_encoder->type;
-	uint32_t val;
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	enum port port = encoder->port;
 	bool wait = false;
-
-	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
-
-	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
-
-		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
-	}
+	u32 val;
 
 	val = I915_READ(DDI_BUF_CTL(port));
 	if (val & DDI_BUF_CTL_ENABLE) {
@@ -2272,6 +2259,26 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,
 
 	if (wait)
 		intel_wait_ddi_buf_idle(dev_priv, port);
+}
+
+static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,
+				   const struct intel_crtc_state *old_crtc_state,
+				   const struct drm_connector_state *old_conn_state)
+{
+	struct drm_encoder *encoder = &intel_encoder->base;
+	struct drm_i915_private *dev_priv = to_i915(encoder->dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	int type = intel_encoder->type;
+
+	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
+
+	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP) {
+		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+
+		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
+	}
+
+	intel_disable_ddi_buf(intel_encoder);
 
 	if (type == INTEL_OUTPUT_HDMI) {
 		dig_port->set_infoframes(encoder, false,
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 07/29] drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (5 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 06/29] drm/i915: Extract intel_disable_ddi_buf() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:55   ` Jani Nikula
  2017-09-18 18:25 ` [PATCH 08/29] drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants Ville Syrjala
                   ` (28 subsequent siblings)
  35 siblings, 1 reply; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

To untangle the mess that is intel_ddi_post_disable() move the the bits
needed by FDI into intel_ddi_fdi_post_disable(). This way we can stop
worrying about FDI in intel_ddi_post_disable().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 2dbbd47665de..bbb08c6f0bba 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2321,7 +2321,8 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *encoder,
 	val &= ~FDI_RX_ENABLE;
 	I915_WRITE(FDI_RX_CTL(PIPE_A), val);
 
-	intel_ddi_post_disable(encoder, old_crtc_state, old_conn_state);
+	intel_disable_ddi_buf(encoder);
+	intel_ddi_clk_disable(encoder);
 
 	val = I915_READ(FDI_RX_MISC(PIPE_A));
 	val &= ~(FDI_RX_PWRDN_LANE1_MASK | FDI_RX_PWRDN_LANE0_MASK);
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 08/29] drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (6 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 07/29] drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:56   ` Jani Nikula
  2017-09-18 18:25 ` [PATCH 09/29] drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp() Ville Syrjala
                   ` (27 subsequent siblings)
  35 siblings, 1 reply; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

To clean up the mess in intel_ddi_post_disable() split it into two
clean variants for HDMI and DP.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 69 +++++++++++++++++++++++-----------------
 1 file changed, 40 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index bbb08c6f0bba..c38cbdc87545 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2261,47 +2261,58 @@ static void intel_disable_ddi_buf(struct intel_encoder *encoder)
 		intel_wait_ddi_buf_idle(dev_priv, port);
 }
 
-static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,
-				   const struct intel_crtc_state *old_crtc_state,
-				   const struct drm_connector_state *old_conn_state)
+static void intel_ddi_post_disable_dp(struct intel_encoder *encoder,
+				      const struct intel_crtc_state *old_crtc_state,
+				      const struct drm_connector_state *old_conn_state)
 {
-	struct drm_encoder *encoder = &intel_encoder->base;
-	struct drm_i915_private *dev_priv = to_i915(encoder->dev);
-	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
-	int type = intel_encoder->type;
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
+	struct intel_dp *intel_dp = &dig_port->dp;
 
-	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
+	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
 
-	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+	intel_disable_ddi_buf(encoder);
 
-		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
-	}
+	intel_edp_panel_vdd_on(intel_dp);
+	intel_edp_panel_off(intel_dp);
 
-	intel_disable_ddi_buf(intel_encoder);
+	intel_display_power_put(dev_priv, dig_port->ddi_io_power_domain);
 
-	if (type == INTEL_OUTPUT_HDMI) {
-		dig_port->set_infoframes(encoder, false,
-					 old_crtc_state, old_conn_state);
-	}
+	intel_ddi_clk_disable(encoder);
+}
 
-	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+static void intel_ddi_post_disable_hdmi(struct intel_encoder *encoder,
+					const struct intel_crtc_state *old_crtc_state,
+					const struct drm_connector_state *old_conn_state)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
+	struct intel_hdmi *intel_hdmi = &dig_port->hdmi;
 
-		intel_edp_panel_vdd_on(intel_dp);
-		intel_edp_panel_off(intel_dp);
-	}
+	intel_disable_ddi_buf(encoder);
 
-	if (dig_port)
-		intel_display_power_put(dev_priv, dig_port->ddi_io_power_domain);
+	dig_port->set_infoframes(&encoder->base, false,
+				 old_crtc_state, old_conn_state);
 
-	intel_ddi_clk_disable(intel_encoder);
+	intel_display_power_put(dev_priv, dig_port->ddi_io_power_domain);
 
-	if (type == INTEL_OUTPUT_HDMI) {
-		struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
+	intel_ddi_clk_disable(encoder);
 
-		intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
-	}
+	intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
+}
+
+static void intel_ddi_post_disable(struct intel_encoder *encoder,
+				   const struct intel_crtc_state *old_crtc_state,
+				   const struct drm_connector_state *old_conn_state)
+{
+	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
+	if (old_crtc_state &&
+	    intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
+		intel_ddi_post_disable_hdmi(encoder,
+					    old_crtc_state, old_conn_state);
+	else
+		intel_ddi_post_disable_dp(encoder,
+					  old_crtc_state, old_conn_state);
 }
 
 void intel_ddi_fdi_post_disable(struct intel_encoder *encoder,
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 09/29] drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (7 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 08/29] drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:56   ` Jani Nikula
  2017-09-18 18:25 ` [PATCH 10/29] drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants Ville Syrjala
                   ` (26 subsequent siblings)
  35 siblings, 1 reply; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

intel_edp_panel_on() will itself do the is_edp() check, so the caller
doesn't have to bother. Pre-DDI code doesn't bother, so let's follow the
same approach for DDI.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index c38cbdc87545..a3e579ee9962 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2161,8 +2161,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 
 	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
 				 link_mst);
-	if (encoder->type == INTEL_OUTPUT_EDP)
-		intel_edp_panel_on(intel_dp);
+
+	intel_edp_panel_on(intel_dp);
 
 	intel_ddi_clk_select(encoder, pll);
 
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 10/29] drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (8 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 09/29] drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 11/29] drm/i915: Plump crtc_state etc. directly to intel_ddi_pre_enable_{dp, hdmi}() Ville Syrjala
                   ` (25 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

Untangle intel_disable_ddi() by splitting it into DP and HDMI specific
variants.

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

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index a3e579ee9962..b92d2167b576 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2390,29 +2390,40 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder,
 		intel_audio_codec_enable(intel_encoder, pipe_config, conn_state);
 }
 
-static void intel_disable_ddi(struct intel_encoder *intel_encoder,
-			      const struct intel_crtc_state *old_crtc_state,
-			      const struct drm_connector_state *old_conn_state)
+static void intel_disable_ddi_dp(struct intel_encoder *encoder,
+				 const struct intel_crtc_state *old_crtc_state,
+				 const struct drm_connector_state *old_conn_state)
 {
-	struct drm_encoder *encoder = &intel_encoder->base;
-	int type = intel_encoder->type;
+	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 
 	if (old_crtc_state->has_audio)
-		intel_audio_codec_disable(intel_encoder);
+		intel_audio_codec_disable(encoder);
 
-	if (type == INTEL_OUTPUT_HDMI) {
-		intel_hdmi_handle_sink_scrambling(intel_encoder,
-						  old_conn_state->connector,
-						  false, false);
-	}
+	intel_edp_drrs_disable(intel_dp, old_crtc_state);
+	intel_psr_disable(intel_dp, old_crtc_state);
+	intel_edp_backlight_off(old_conn_state);
+}
 
-	if (type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+static void intel_disable_ddi_hdmi(struct intel_encoder *encoder,
+				   const struct intel_crtc_state *old_crtc_state,
+				   const struct drm_connector_state *old_conn_state)
+{
+	if (old_crtc_state->has_audio)
+		intel_audio_codec_disable(encoder);
 
-		intel_edp_drrs_disable(intel_dp, old_crtc_state);
-		intel_psr_disable(intel_dp, old_crtc_state);
-		intel_edp_backlight_off(old_conn_state);
-	}
+	intel_hdmi_handle_sink_scrambling(encoder,
+					  old_conn_state->connector,
+					  false, false);
+}
+
+static void intel_disable_ddi(struct intel_encoder *encoder,
+			      const struct intel_crtc_state *old_crtc_state,
+			      const struct drm_connector_state *old_conn_state)
+{
+	if (intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
+		intel_disable_ddi_hdmi(encoder, old_crtc_state, old_conn_state);
+	else
+		intel_disable_ddi_dp(encoder, old_crtc_state, old_conn_state);
 }
 
 static void bxt_ddi_pre_pll_enable(struct intel_encoder *encoder,
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 11/29] drm/i915: Plump crtc_state etc. directly to intel_ddi_pre_enable_{dp, hdmi}()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (9 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 10/29] drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 12/29] drm/i915: Split intel_enable_ddi() into DP and HDMI variants Ville Syrjala
                   ` (24 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

Rather that plump the link parameters separately to
intel_ddi_pre_enable_dp() let's just pass the entire crtc state.

intel_ddi_pre_enable_hdmi() already took the crtc state, but for some
reason intel_ddi_pre_enable() still wanted to extract has_infoframe
from therein and pass it in separately. Let's not do that since it's
pointless.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 44 ++++++++++++++--------------------------
 1 file changed, 15 insertions(+), 29 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index b92d2167b576..a66e2b6d64cb 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2147,24 +2147,24 @@ static void intel_ddi_clk_disable(struct intel_encoder *encoder)
 }
 
 static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
-				    int link_rate, uint32_t lane_count,
-				    struct intel_shared_dpll *pll,
-				    bool link_mst)
+				    const struct intel_crtc_state *crtc_state,
+				    const struct drm_connector_state *conn_state)
 {
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = intel_ddi_get_encoder_port(encoder);
 	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
+	bool is_mst = intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST);
 	uint32_t level = intel_ddi_dp_level(intel_dp);
 
-	WARN_ON(link_mst && (port == PORT_A || port == PORT_E));
+	WARN_ON(is_mst && (port == PORT_A || port == PORT_E));
 
-	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
-				 link_mst);
+	intel_dp_set_link_params(intel_dp, crtc_state->port_clock,
+				 crtc_state->lane_count, is_mst);
 
 	intel_edp_panel_on(intel_dp);
 
-	intel_ddi_clk_select(encoder, pll);
+	intel_ddi_clk_select(encoder, crtc_state->shared_dpll);
 
 	intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
 
@@ -2183,10 +2183,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 }
 
 static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
-				      bool has_infoframe,
 				      const struct intel_crtc_state *crtc_state,
-				      const struct drm_connector_state *conn_state,
-				      const struct intel_shared_dpll *pll)
+				      const struct drm_connector_state *conn_state)
 {
 	struct intel_digital_port *intel_dig_port = enc_to_dig_port(&encoder->base);
 	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
@@ -2196,7 +2194,7 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
 	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 
 	intel_dp_dual_mode_set_tmds_output(intel_hdmi, true);
-	intel_ddi_clk_select(encoder, pll);
+	intel_ddi_clk_select(encoder, crtc_state->shared_dpll);
 
 	intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
 
@@ -2212,30 +2210,18 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
 		skl_ddi_set_iboost(encoder, level);
 
 	intel_dig_port->set_infoframes(&encoder->base,
-				       has_infoframe,
+				       crtc_state->has_infoframe,
 				       crtc_state, conn_state);
 }
 
 static void intel_ddi_pre_enable(struct intel_encoder *encoder,
-				 const struct intel_crtc_state *pipe_config,
+				 const struct intel_crtc_state *crtc_state,
 				 const struct drm_connector_state *conn_state)
 {
-	int type = encoder->type;
-
-	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP) {
-		intel_ddi_pre_enable_dp(encoder,
-					pipe_config->port_clock,
-					pipe_config->lane_count,
-					pipe_config->shared_dpll,
-					intel_crtc_has_type(pipe_config,
-							    INTEL_OUTPUT_DP_MST));
-	}
-	if (type == INTEL_OUTPUT_HDMI) {
-		intel_ddi_pre_enable_hdmi(encoder,
-					  pipe_config->has_infoframe,
-					  pipe_config, conn_state,
-					  pipe_config->shared_dpll);
-	}
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
+		intel_ddi_pre_enable_hdmi(encoder, crtc_state, conn_state);
+	else
+		intel_ddi_pre_enable_dp(encoder, crtc_state, conn_state);
 }
 
 static void intel_disable_ddi_buf(struct intel_encoder *encoder)
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 12/29] drm/i915: Split intel_enable_ddi() into DP and HDMI variants
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (10 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 11/29] drm/i915: Plump crtc_state etc. directly to intel_ddi_pre_enable_{dp, hdmi}() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 13/29] drm/i915: Relocate intel_ddi_get_buf_trans_*() functions Ville Syrjala
                   ` (23 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

Untangle intel_enable_ddi() by splitting it into DP and HDMI specific
variants.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 80 +++++++++++++++++++++++-----------------
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index a66e2b6d64cb..334789c24f33 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2335,45 +2335,57 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *encoder,
 	I915_WRITE(FDI_RX_CTL(PIPE_A), val);
 }
 
-static void intel_enable_ddi(struct intel_encoder *intel_encoder,
-			     const struct intel_crtc_state *pipe_config,
-			     const struct drm_connector_state *conn_state)
+static void intel_enable_ddi_dp(struct intel_encoder *encoder,
+				const struct intel_crtc_state *crtc_state,
+				const struct drm_connector_state *conn_state)
 {
-	struct drm_encoder *encoder = &intel_encoder->base;
-	struct drm_i915_private *dev_priv = to_i915(encoder->dev);
-	enum port port = intel_ddi_get_encoder_port(intel_encoder);
-	int type = intel_encoder->type;
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
+	enum port port = encoder->port;
 
-	if (type == INTEL_OUTPUT_HDMI) {
-		struct intel_digital_port *intel_dig_port =
-			enc_to_dig_port(encoder);
-		bool clock_ratio = pipe_config->hdmi_high_tmds_clock_ratio;
-		bool scrambling = pipe_config->hdmi_scrambling;
-
-		intel_hdmi_handle_sink_scrambling(intel_encoder,
-						  conn_state->connector,
-						  clock_ratio, scrambling);
-
-		/* In HDMI/DVI mode, the port width, and swing/emphasis values
-		 * are ignored so nothing special needs to be done besides
-		 * enabling the port.
-		 */
-		I915_WRITE(DDI_BUF_CTL(port),
-			   intel_dig_port->saved_port_bits |
-			   DDI_BUF_CTL_ENABLE);
-	} else if (type == INTEL_OUTPUT_EDP) {
-		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
+	if (port == PORT_A && INTEL_GEN(dev_priv) < 9)
+		intel_dp_stop_link_train(intel_dp);
 
-		if (port == PORT_A && INTEL_GEN(dev_priv) < 9)
-			intel_dp_stop_link_train(intel_dp);
+	intel_edp_backlight_on(crtc_state, conn_state);
+	intel_psr_enable(intel_dp, crtc_state);
+	intel_edp_drrs_enable(intel_dp, crtc_state);
 
-		intel_edp_backlight_on(pipe_config, conn_state);
-		intel_psr_enable(intel_dp, pipe_config);
-		intel_edp_drrs_enable(intel_dp, pipe_config);
-	}
+	if (crtc_state->has_audio)
+		intel_audio_codec_enable(encoder, crtc_state, conn_state);
+}
 
-	if (pipe_config->has_audio)
-		intel_audio_codec_enable(intel_encoder, pipe_config, conn_state);
+static void intel_enable_ddi_hdmi(struct intel_encoder *encoder,
+				  const struct intel_crtc_state *crtc_state,
+				  const struct drm_connector_state *conn_state)
+{
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
+	enum port port = encoder->port;
+
+	intel_hdmi_handle_sink_scrambling(encoder,
+					  conn_state->connector,
+					  crtc_state->hdmi_high_tmds_clock_ratio,
+					  crtc_state->hdmi_scrambling);
+
+	/* In HDMI/DVI mode, the port width, and swing/emphasis values
+	 * are ignored so nothing special needs to be done besides
+	 * enabling the port.
+	 */
+	I915_WRITE(DDI_BUF_CTL(port),
+		   dig_port->saved_port_bits | DDI_BUF_CTL_ENABLE);
+
+	if (crtc_state->has_audio)
+		intel_audio_codec_enable(encoder, crtc_state, conn_state);
+}
+
+static void intel_enable_ddi(struct intel_encoder *encoder,
+			     const struct intel_crtc_state *crtc_state,
+			     const struct drm_connector_state *conn_state)
+{
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
+		intel_enable_ddi_hdmi(encoder, crtc_state, conn_state);
+	else
+		intel_enable_ddi_dp(encoder, crtc_state, conn_state);
 }
 
 static void intel_disable_ddi_dp(struct intel_encoder *encoder,
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 13/29] drm/i915: Relocate intel_ddi_get_buf_trans_*() functions
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (11 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 12/29] drm/i915: Split intel_enable_ddi() into DP and HDMI variants Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 14/29] drm/i915: Extract intel_ddi_get_buf_trans_hdmi() Ville Syrjala
                   ` (22 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

We'll want to use the intel_ddi_get_buf_trans_*() functions a bit
earlier in the file, so move them up. While at it start using them
in the iboost setup to get rid of the platform checks there.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 115 +++++++++++++++++++--------------------
 1 file changed, 55 insertions(+), 60 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 334789c24f33..b75d1d0cf5d3 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -588,6 +588,59 @@ skl_get_buf_trans_hdmi(struct drm_i915_private *dev_priv, int *n_entries)
 	}
 }
 
+static const struct ddi_buf_trans *
+intel_ddi_get_buf_trans_dp(struct drm_i915_private *dev_priv,
+			   int *n_entries)
+{
+	if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) {
+		return kbl_get_buf_trans_dp(dev_priv, n_entries);
+	} else if (IS_SKYLAKE(dev_priv)) {
+		return skl_get_buf_trans_dp(dev_priv, n_entries);
+	} else if (IS_BROADWELL(dev_priv)) {
+		*n_entries = ARRAY_SIZE(bdw_ddi_translations_dp);
+		return  bdw_ddi_translations_dp;
+	} else if (IS_HASWELL(dev_priv)) {
+		*n_entries = ARRAY_SIZE(hsw_ddi_translations_dp);
+		return hsw_ddi_translations_dp;
+	}
+
+	*n_entries = 0;
+	return NULL;
+}
+
+static const struct ddi_buf_trans *
+intel_ddi_get_buf_trans_edp(struct drm_i915_private *dev_priv,
+			    int *n_entries)
+{
+	if (IS_GEN9_BC(dev_priv)) {
+		return skl_get_buf_trans_edp(dev_priv, n_entries);
+	} else if (IS_BROADWELL(dev_priv)) {
+		return bdw_get_buf_trans_edp(dev_priv, n_entries);
+	} else if (IS_HASWELL(dev_priv)) {
+		*n_entries = ARRAY_SIZE(hsw_ddi_translations_dp);
+		return hsw_ddi_translations_dp;
+	}
+
+	*n_entries = 0;
+	return NULL;
+}
+
+static const struct ddi_buf_trans *
+intel_ddi_get_buf_trans_fdi(struct drm_i915_private *dev_priv,
+			    int *n_entries)
+{
+	if (IS_BROADWELL(dev_priv)) {
+		*n_entries = ARRAY_SIZE(hsw_ddi_translations_fdi);
+		return hsw_ddi_translations_fdi;
+	} else if (IS_HASWELL(dev_priv)) {
+		*n_entries = ARRAY_SIZE(hsw_ddi_translations_fdi);
+		return hsw_ddi_translations_fdi;
+	}
+
+	*n_entries = 0;
+	return NULL;
+}
+
 static const struct cnl_ddi_buf_trans *
 cnl_get_buf_trans_hdmi(struct drm_i915_private *dev_priv, int *n_entries)
 {
@@ -686,59 +739,6 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
 	return hdmi_level;
 }
 
-static const struct ddi_buf_trans *
-intel_ddi_get_buf_trans_dp(struct drm_i915_private *dev_priv,
-			   int *n_entries)
-{
-	if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) {
-		return kbl_get_buf_trans_dp(dev_priv, n_entries);
-	} else if (IS_SKYLAKE(dev_priv)) {
-		return skl_get_buf_trans_dp(dev_priv, n_entries);
-	} else if (IS_BROADWELL(dev_priv)) {
-		*n_entries = ARRAY_SIZE(bdw_ddi_translations_dp);
-		return  bdw_ddi_translations_dp;
-	} else if (IS_HASWELL(dev_priv)) {
-		*n_entries = ARRAY_SIZE(hsw_ddi_translations_dp);
-		return hsw_ddi_translations_dp;
-	}
-
-	*n_entries = 0;
-	return NULL;
-}
-
-static const struct ddi_buf_trans *
-intel_ddi_get_buf_trans_edp(struct drm_i915_private *dev_priv,
-			    int *n_entries)
-{
-	if (IS_GEN9_BC(dev_priv)) {
-		return skl_get_buf_trans_edp(dev_priv, n_entries);
-	} else if (IS_BROADWELL(dev_priv)) {
-		return bdw_get_buf_trans_edp(dev_priv, n_entries);
-	} else if (IS_HASWELL(dev_priv)) {
-		*n_entries = ARRAY_SIZE(hsw_ddi_translations_dp);
-		return hsw_ddi_translations_dp;
-	}
-
-	*n_entries = 0;
-	return NULL;
-}
-
-static const struct ddi_buf_trans *
-intel_ddi_get_buf_trans_fdi(struct drm_i915_private *dev_priv,
-			    int *n_entries)
-{
-	if (IS_BROADWELL(dev_priv)) {
-		*n_entries = ARRAY_SIZE(hsw_ddi_translations_fdi);
-		return hsw_ddi_translations_fdi;
-	} else if (IS_HASWELL(dev_priv)) {
-		*n_entries = ARRAY_SIZE(hsw_ddi_translations_fdi);
-		return hsw_ddi_translations_fdi;
-	}
-
-	*n_entries = 0;
-	return NULL;
-}
-
 /*
  * Starting with Haswell, DDI port buffers must be programmed with correct
  * values in advance. This function programs the correct values for
@@ -1791,19 +1791,14 @@ static void skl_ddi_set_iboost(struct intel_encoder *encoder, u32 level)
 		if (dp_iboost) {
 			iboost = dp_iboost;
 		} else {
-			if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv))
-				ddi_translations = kbl_get_buf_trans_dp(dev_priv,
-									&n_entries);
-			else
-				ddi_translations = skl_get_buf_trans_dp(dev_priv,
-									&n_entries);
+			ddi_translations = intel_ddi_get_buf_trans_dp(dev_priv, &n_entries);
 			iboost = ddi_translations[level].i_boost;
 		}
 	} else if (type == INTEL_OUTPUT_EDP) {
 		if (dp_iboost) {
 			iboost = dp_iboost;
 		} else {
-			ddi_translations = skl_get_buf_trans_edp(dev_priv, &n_entries);
+			ddi_translations = intel_ddi_get_buf_trans_edp(dev_priv, &n_entries);
 
 			if (WARN_ON(port != PORT_A &&
 				    port != PORT_E && n_entries > 9))
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 14/29] drm/i915: Extract intel_ddi_get_buf_trans_hdmi()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (12 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 13/29] drm/i915: Relocate intel_ddi_get_buf_trans_*() functions Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 15/29] drm/i915: Pass the encoder type explicitly to skl_set_iboost() Ville Syrjala
                   ` (21 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

Introduce intel_ddi_get_buf_trans_hdmi() and start using it where we
can.

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

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index b75d1d0cf5d3..07449b4c58db 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -641,6 +641,24 @@ intel_ddi_get_buf_trans_fdi(struct drm_i915_private *dev_priv,
 	return NULL;
 }
 
+static const struct ddi_buf_trans *
+intel_ddi_get_buf_trans_hdmi(struct drm_i915_private *dev_priv,
+			     int *n_entries)
+{
+	if (IS_GEN9_BC(dev_priv)) {
+		return skl_get_buf_trans_hdmi(dev_priv, n_entries);
+	} else if (IS_BROADWELL(dev_priv)) {
+		*n_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
+		return bdw_ddi_translations_hdmi;
+	} else if (IS_HASWELL(dev_priv)) {
+		*n_entries = ARRAY_SIZE(hsw_ddi_translations_hdmi);
+		return hsw_ddi_translations_hdmi;
+	}
+
+	*n_entries = 0;
+	return NULL;
+}
+
 static const struct cnl_ddi_buf_trans *
 cnl_get_buf_trans_hdmi(struct drm_i915_private *dev_priv, int *n_entries)
 {
@@ -717,18 +735,17 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
 		cnl_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
 		hdmi_default_entry = n_hdmi_entries - 1;
 	} else if (IS_GEN9_BC(dev_priv)) {
-		skl_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
+		intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
 		hdmi_default_entry = 8;
 	} else if (IS_BROADWELL(dev_priv)) {
-		n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
+		intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
 		hdmi_default_entry = 7;
 	} else if (IS_HASWELL(dev_priv)) {
-		n_hdmi_entries = ARRAY_SIZE(hsw_ddi_translations_hdmi);
+		intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
 		hdmi_default_entry = 6;
 	} else {
 		WARN(1, "ddi translation table missing\n");
-		n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
-		hdmi_default_entry = 7;
+		return 0;
 	}
 
 	/* Choose a good default if VBT is badly populated */
@@ -804,23 +821,12 @@ static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder)
 
 	hdmi_level = intel_ddi_hdmi_level(dev_priv, port);
 
-	if (IS_GEN9_BC(dev_priv)) {
-		ddi_translations_hdmi = skl_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
+	ddi_translations_hdmi = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
 
-		/* If we're boosting the current, set bit 31 of trans1 */
-		if (dev_priv->vbt.ddi_port_info[port].hdmi_boost_level)
-			iboost_bit = DDI_BUF_BALANCE_LEG_ENABLE;
-	} else if (IS_BROADWELL(dev_priv)) {
-		ddi_translations_hdmi = bdw_ddi_translations_hdmi;
-		n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
-	} else if (IS_HASWELL(dev_priv)) {
-		ddi_translations_hdmi = hsw_ddi_translations_hdmi;
-		n_hdmi_entries = ARRAY_SIZE(hsw_ddi_translations_hdmi);
-	} else {
-		WARN(1, "ddi translation table missing\n");
-		ddi_translations_hdmi = bdw_ddi_translations_hdmi;
-		n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
-	}
+	/* If we're boosting the current, set bit 31 of trans1 */
+	if (IS_GEN9_BC(dev_priv) &&
+	    dev_priv->vbt.ddi_port_info[port].hdmi_boost_level)
+		iboost_bit = DDI_BUF_BALANCE_LEG_ENABLE;
 
 	/* Entry 9 is for HDMI: */
 	I915_WRITE(DDI_BUF_TRANS_LO(port, 9),
@@ -1810,7 +1816,7 @@ static void skl_ddi_set_iboost(struct intel_encoder *encoder, u32 level)
 		if (hdmi_iboost) {
 			iboost = hdmi_iboost;
 		} else {
-			ddi_translations = skl_get_buf_trans_hdmi(dev_priv, &n_entries);
+			ddi_translations = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_entries);
 			iboost = ddi_translations[level].i_boost;
 		}
 	} else {
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 15/29] drm/i915: Pass the encoder type explicitly to skl_set_iboost()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (13 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 14/29] drm/i915: Extract intel_ddi_get_buf_trans_hdmi() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 16/29] drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers() Ville Syrjala
                   ` (20 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

encoder->type isn't reliable for DP/HDMI encoders, so pass the type
explicity to skl_set_iboost(). Also take the opportunity to streamline
the code.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 57 ++++++++++++++++------------------------
 1 file changed, 22 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 07449b4c58db..6d73cfc70b08 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1778,49 +1778,36 @@ static void _skl_ddi_set_iboost(struct drm_i915_private *dev_priv,
 	I915_WRITE(DISPIO_CR_TX_BMU_CR0, tmp);
 }
 
-static void skl_ddi_set_iboost(struct intel_encoder *encoder, u32 level)
+static void skl_ddi_set_iboost(struct intel_encoder *encoder,
+			       u32 level, int type)
 {
 	struct intel_digital_port *intel_dig_port = enc_to_dig_port(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(intel_dig_port->base.base.dev);
 	enum port port = intel_dig_port->port;
-	int type = encoder->type;
-	const struct ddi_buf_trans *ddi_translations;
 	uint8_t iboost;
-	uint8_t dp_iboost, hdmi_iboost;
-	int n_entries;
 
-	/* VBT may override standard boost values */
-	dp_iboost = dev_priv->vbt.ddi_port_info[port].dp_boost_level;
-	hdmi_iboost = dev_priv->vbt.ddi_port_info[port].hdmi_boost_level;
+	if (type == INTEL_OUTPUT_HDMI)
+		iboost = dev_priv->vbt.ddi_port_info[port].hdmi_boost_level;
+	else
+		iboost = dev_priv->vbt.ddi_port_info[port].dp_boost_level;
 
-	if (type == INTEL_OUTPUT_DP) {
-		if (dp_iboost) {
-			iboost = dp_iboost;
-		} else {
-			ddi_translations = intel_ddi_get_buf_trans_dp(dev_priv, &n_entries);
-			iboost = ddi_translations[level].i_boost;
-		}
-	} else if (type == INTEL_OUTPUT_EDP) {
-		if (dp_iboost) {
-			iboost = dp_iboost;
-		} else {
+	if (iboost == 0) {
+		const struct ddi_buf_trans *ddi_translations;
+		int n_entries;
+
+		if (type == INTEL_OUTPUT_HDMI)
+			ddi_translations = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_entries);
+		else if (type == INTEL_OUTPUT_EDP)
 			ddi_translations = intel_ddi_get_buf_trans_edp(dev_priv, &n_entries);
+		else
+			ddi_translations = intel_ddi_get_buf_trans_dp(dev_priv, &n_entries);
 
-			if (WARN_ON(port != PORT_A &&
-				    port != PORT_E && n_entries > 9))
-				n_entries = 9;
+		if (WARN_ON(type != INTEL_OUTPUT_HDMI &&
+			    port != PORT_A &&
+			    port != PORT_E && n_entries > 9))
+			n_entries = 9;
 
-			iboost = ddi_translations[level].i_boost;
-		}
-	} else if (type == INTEL_OUTPUT_HDMI) {
-		if (hdmi_iboost) {
-			iboost = hdmi_iboost;
-		} else {
-			ddi_translations = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_entries);
-			iboost = ddi_translations[level].i_boost;
-		}
-	} else {
-		return;
+		iboost = ddi_translations[level].i_boost;
 	}
 
 	/* Make sure that the requested I_boost is valid */
@@ -2086,7 +2073,7 @@ uint32_t ddi_signal_levels(struct intel_dp *intel_dp)
 	uint32_t level = intel_ddi_dp_level(intel_dp);
 
 	if (IS_GEN9_BC(dev_priv))
-	    skl_ddi_set_iboost(encoder, level);
+		skl_ddi_set_iboost(encoder, level, encoder->type);
 
 	return DDI_BUF_TRANS_SELECT(level);
 }
@@ -2208,7 +2195,7 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
 		intel_prepare_hdmi_ddi_buffers(encoder);
 
 	if (IS_GEN9_BC(dev_priv))
-		skl_ddi_set_iboost(encoder, level);
+		skl_ddi_set_iboost(encoder, level, INTEL_OUTPUT_HDMI);
 
 	intel_dig_port->set_infoframes(&encoder->base,
 				       crtc_state->has_infoframe,
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 16/29] drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (14 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 15/29] drm/i915: Pass the encoder type explicitly to skl_set_iboost() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 17/29] drm/i915: Integrate BXT into intel_ddi_dp_voltage_max() Ville Syrjala
                   ` (19 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

The caller of intel_prepare_hdmi_ddi_buffers() alreday figured out the
level, so let's just pass it in instead if figuring it out again.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 6d73cfc70b08..176347d4b531 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -811,16 +811,15 @@ static void intel_prepare_dp_ddi_buffers(struct intel_encoder *encoder)
  * values in advance. This function programs the correct values for
  * HDMI/DVI use cases.
  */
-static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder)
+static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder,
+					   int hdmi_level)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	u32 iboost_bit = 0;
-	int n_hdmi_entries, hdmi_level;
+	int n_hdmi_entries;
 	enum port port = intel_ddi_get_encoder_port(encoder);
 	const struct ddi_buf_trans *ddi_translations_hdmi;
 
-	hdmi_level = intel_ddi_hdmi_level(dev_priv, port);
-
 	ddi_translations_hdmi = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
 
 	/* If we're boosting the current, set bit 31 of trans1 */
@@ -2192,7 +2191,7 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
 		bxt_ddi_vswing_sequence(dev_priv, level, port,
 					INTEL_OUTPUT_HDMI);
 	else
-		intel_prepare_hdmi_ddi_buffers(encoder);
+		intel_prepare_hdmi_ddi_buffers(encoder, level);
 
 	if (IS_GEN9_BC(dev_priv))
 		skl_ddi_set_iboost(encoder, level, INTEL_OUTPUT_HDMI);
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 17/29] drm/i915: Integrate BXT into intel_ddi_dp_voltage_max()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (15 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 16/29] drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 18/29] drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly Ville Syrjala
                   ` (18 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

Make BXT less special by following the CNL approach and handling
it in intel_ddi_dp_voltage_max() alognside every other DDI platform.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 69 ++++++++++++++++++++++++++--------------
 drivers/gpu/drm/i915/intel_dp.c  |  4 +--
 2 files changed, 46 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 176347d4b531..406c76fe830a 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -659,6 +659,31 @@ intel_ddi_get_buf_trans_hdmi(struct drm_i915_private *dev_priv,
 	return NULL;
 }
 
+static const struct bxt_ddi_buf_trans *
+bxt_get_buf_trans_dp(struct drm_i915_private *dev_priv, int *n_entries)
+{
+	*n_entries = ARRAY_SIZE(bxt_ddi_translations_dp);
+	return bxt_ddi_translations_dp;
+}
+
+static const struct bxt_ddi_buf_trans *
+bxt_get_buf_trans_edp(struct drm_i915_private *dev_priv, int *n_entries)
+{
+	if (dev_priv->vbt.edp.low_vswing) {
+		*n_entries = ARRAY_SIZE(bxt_ddi_translations_edp);
+		return bxt_ddi_translations_edp;
+	}
+
+	return bxt_get_buf_trans_dp(dev_priv, n_entries);
+}
+
+static const struct bxt_ddi_buf_trans *
+bxt_get_buf_trans_hdmi(struct drm_i915_private *dev_priv, int *n_entries)
+{
+	*n_entries = ARRAY_SIZE(bxt_ddi_translations_hdmi);
+	return bxt_ddi_translations_hdmi;
+}
+
 static const struct cnl_ddi_buf_trans *
 cnl_get_buf_trans_hdmi(struct drm_i915_private *dev_priv, int *n_entries)
 {
@@ -1821,27 +1846,20 @@ static void skl_ddi_set_iboost(struct intel_encoder *encoder,
 		_skl_ddi_set_iboost(dev_priv, PORT_E, iboost);
 }
 
-static void bxt_ddi_vswing_sequence(struct drm_i915_private *dev_priv,
-				    u32 level, enum port port, int type)
+static void bxt_ddi_vswing_sequence(struct intel_encoder *encoder,
+				    int level, int type)
 {
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	const struct bxt_ddi_buf_trans *ddi_translations;
-	u32 n_entries, i;
-
-	if (type == INTEL_OUTPUT_EDP && dev_priv->vbt.edp.low_vswing) {
-		n_entries = ARRAY_SIZE(bxt_ddi_translations_edp);
-		ddi_translations = bxt_ddi_translations_edp;
-	} else if (type == INTEL_OUTPUT_DP
-			|| type == INTEL_OUTPUT_EDP) {
-		n_entries = ARRAY_SIZE(bxt_ddi_translations_dp);
-		ddi_translations = bxt_ddi_translations_dp;
-	} else if (type == INTEL_OUTPUT_HDMI) {
-		n_entries = ARRAY_SIZE(bxt_ddi_translations_hdmi);
-		ddi_translations = bxt_ddi_translations_hdmi;
-	} else {
-		DRM_DEBUG_KMS("Vswing programming not done for encoder %d\n",
-				type);
-		return;
-	}
+	enum port port = encoder->port;
+	int n_entries, i;
+
+	if (type == INTEL_OUTPUT_HDMI)
+		ddi_translations = bxt_get_buf_trans_hdmi(dev_priv, &n_entries);
+	else if (type == INTEL_OUTPUT_EDP)
+		ddi_translations = bxt_get_buf_trans_edp(dev_priv, &n_entries);
+	else
+		ddi_translations = bxt_get_buf_trans_dp(dev_priv, &n_entries);
 
 	/* Check if default value has to be used */
 	if (level >= n_entries ||
@@ -1871,6 +1889,11 @@ u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder)
 			cnl_get_buf_trans_edp(dev_priv, &n_entries);
 		else
 			cnl_get_buf_trans_dp(dev_priv, &n_entries);
+	} else if (IS_GEN9_LP(dev_priv)) {
+		if (encoder->type == INTEL_OUTPUT_EDP)
+			bxt_get_buf_trans_edp(dev_priv, &n_entries);
+		else
+			bxt_get_buf_trans_dp(dev_priv, &n_entries);
 	} else {
 		if (encoder->type == INTEL_OUTPUT_EDP)
 			intel_ddi_get_buf_trans_edp(dev_priv, &n_entries);
@@ -2053,13 +2076,12 @@ u32 bxt_signal_levels(struct intel_dp *intel_dp)
 	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
 	struct intel_encoder *encoder = &dport->base;
-	enum port port = dport->port;
 	u32 level = intel_ddi_dp_level(intel_dp);
 
 	if (IS_CANNONLAKE(dev_priv))
 		cnl_ddi_vswing_sequence(encoder, level);
 	else
-		bxt_ddi_vswing_sequence(dev_priv, level, port, encoder->type);
+		bxt_ddi_vswing_sequence(encoder, level, encoder->type);
 
 	return 0;
 }
@@ -2158,7 +2180,7 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	if (IS_CANNONLAKE(dev_priv))
 		cnl_ddi_vswing_sequence(encoder, level);
 	else if (IS_GEN9_LP(dev_priv))
-		bxt_ddi_vswing_sequence(dev_priv, level, port, encoder->type);
+		bxt_ddi_vswing_sequence(encoder, level, encoder->type);
 	else
 		intel_prepare_dp_ddi_buffers(encoder);
 
@@ -2188,8 +2210,7 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
 	if (IS_CANNONLAKE(dev_priv))
 		cnl_ddi_vswing_sequence(encoder, level);
 	else if (IS_GEN9_LP(dev_priv))
-		bxt_ddi_vswing_sequence(dev_priv, level, port,
-					INTEL_OUTPUT_HDMI);
+		bxt_ddi_vswing_sequence(encoder, level, INTEL_OUTPUT_HDMI);
 	else
 		intel_prepare_hdmi_ddi_buffers(encoder, level);
 
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 887953c0f495..cc25a9b10fd9 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3147,9 +3147,7 @@ intel_dp_voltage_max(struct intel_dp *intel_dp)
 	struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp));
 	enum port port = dp_to_dig_port(intel_dp)->port;
 
-	if (IS_GEN9_LP(dev_priv))
-		return DP_TRAIN_VOLTAGE_SWING_LEVEL_3;
-	else if (INTEL_GEN(dev_priv) >= 9) {
+	if (INTEL_GEN(dev_priv) >= 9) {
 		struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
 		return intel_ddi_dp_voltage_max(encoder);
 	} else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 18/29] drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (16 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 17/29] drm/i915: Integrate BXT into intel_ddi_dp_voltage_max() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 19/29] drm/i915: Kill off the BXT buf_trans default_index Ville Syrjala
                   ` (17 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

encoder->type is unreliable for DP/HDMI, so pass it in explicity into
cnl_ddi_vswing_sequence(). This matches what we do for BXT.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 43 ++++++++++++++++++----------------------
 1 file changed, 19 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 406c76fe830a..dc32dfa23d07 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1914,16 +1914,15 @@ static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
 				    u32 level, enum port port, int type)
 {
 	const struct cnl_ddi_buf_trans *ddi_translations = NULL;
-	u32 n_entries, val;
-	int ln;
+	int n_entries, ln;
+	u32 val;
 
-	if (type == INTEL_OUTPUT_HDMI) {
+	if (type == INTEL_OUTPUT_HDMI)
 		ddi_translations = cnl_get_buf_trans_hdmi(dev_priv, &n_entries);
-	} else if (type == INTEL_OUTPUT_DP) {
-		ddi_translations = cnl_get_buf_trans_dp(dev_priv, &n_entries);
-	} else if (type == INTEL_OUTPUT_EDP) {
+	else if (type == INTEL_OUTPUT_EDP)
 		ddi_translations = cnl_get_buf_trans_edp(dev_priv, &n_entries);
-	}
+	else
+		ddi_translations = cnl_get_buf_trans_dp(dev_priv, &n_entries);
 
 	if (WARN_ON(ddi_translations == NULL))
 		return;
@@ -1976,26 +1975,22 @@ static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
 	I915_WRITE(CNL_PORT_TX_DW7_GRP(port), val);
 }
 
-static void cnl_ddi_vswing_sequence(struct intel_encoder *encoder, u32 level)
+static void cnl_ddi_vswing_sequence(struct intel_encoder *encoder,
+				    int level, int type)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	enum port port = intel_ddi_get_encoder_port(encoder);
-	int type = encoder->type;
-	int width = 0;
-	int rate = 0;
+	int width, rate, ln;
 	u32 val;
-	int ln = 0;
 
-	if ((intel_dp) && (type == INTEL_OUTPUT_EDP || type == INTEL_OUTPUT_DP)) {
-		width = intel_dp->lane_count;
-		rate = intel_dp->link_rate;
-	} else if (type == INTEL_OUTPUT_HDMI) {
+	if (type == INTEL_OUTPUT_HDMI) {
 		width = 4;
-		/* Rate is always < than 6GHz for HDMI */
+		rate = 0; /* Rate is always < than 6GHz for HDMI */
 	} else {
-		MISSING_CASE(type);
-		return;
+		struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
+
+		width = intel_dp->lane_count;
+		rate = intel_dp->link_rate;
 	}
 
 	/*
@@ -2004,7 +1999,7 @@ static void cnl_ddi_vswing_sequence(struct intel_encoder *encoder, u32 level)
 	 * else clear to 0b.
 	 */
 	val = I915_READ(CNL_PORT_PCS_DW1_LN0(port));
-	if (type == INTEL_OUTPUT_EDP || type == INTEL_OUTPUT_DP)
+	if (type != INTEL_OUTPUT_HDMI)
 		val |= COMMON_KEEPER_EN;
 	else
 		val &= ~COMMON_KEEPER_EN;
@@ -2079,7 +2074,7 @@ u32 bxt_signal_levels(struct intel_dp *intel_dp)
 	u32 level = intel_ddi_dp_level(intel_dp);
 
 	if (IS_CANNONLAKE(dev_priv))
-		cnl_ddi_vswing_sequence(encoder, level);
+		cnl_ddi_vswing_sequence(encoder, level, encoder->type);
 	else
 		bxt_ddi_vswing_sequence(encoder, level, encoder->type);
 
@@ -2178,7 +2173,7 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
 
 	if (IS_CANNONLAKE(dev_priv))
-		cnl_ddi_vswing_sequence(encoder, level);
+		cnl_ddi_vswing_sequence(encoder, level, encoder->type);
 	else if (IS_GEN9_LP(dev_priv))
 		bxt_ddi_vswing_sequence(encoder, level, encoder->type);
 	else
@@ -2208,7 +2203,7 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
 	intel_display_power_get(dev_priv, dig_port->ddi_io_power_domain);
 
 	if (IS_CANNONLAKE(dev_priv))
-		cnl_ddi_vswing_sequence(encoder, level);
+		cnl_ddi_vswing_sequence(encoder, level, INTEL_OUTPUT_HDMI);
 	else if (IS_GEN9_LP(dev_priv))
 		bxt_ddi_vswing_sequence(encoder, level, INTEL_OUTPUT_HDMI);
 	else
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 19/29] drm/i915: Kill off the BXT buf_trans default_index
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (17 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 18/29] drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 20/29] drm/i915: Don't use encoder->type in intel_ddi_set_pipe_settings() Ville Syrjala
                   ` (16 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

default_index contained in the BXT buf_trans tables is actually useless.
For DP we should always have a valid level selected (otherwise the link
training logic would be buggy), and for HDMI we can just do what the
other platforms do and pick the correct entry in intel_ddi_hdmi_level().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 80 +++++++++++++++++-----------------------
 1 file changed, 34 insertions(+), 46 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index dc32dfa23d07..18678b79afcb 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -305,35 +305,34 @@ struct bxt_ddi_buf_trans {
 	u8 scale;	/* scale value */
 	u8 enable;	/* scale enable */
 	u8 deemphasis;
-	bool default_index; /* true if the entry represents default value */
 };
 
 static const struct bxt_ddi_buf_trans bxt_ddi_translations_dp[] = {
 					/* Idx	NT mV diff	db  */
-	{ 52,  0x9A, 0, 128, true  },	/* 0:	400		0   */
-	{ 78,  0x9A, 0, 85,  false },	/* 1:	400		3.5 */
-	{ 104, 0x9A, 0, 64,  false },	/* 2:	400		6   */
-	{ 154, 0x9A, 0, 43,  false },	/* 3:	400		9.5 */
-	{ 77,  0x9A, 0, 128, false },	/* 4:	600		0   */
-	{ 116, 0x9A, 0, 85,  false },	/* 5:	600		3.5 */
-	{ 154, 0x9A, 0, 64,  false },	/* 6:	600		6   */
-	{ 102, 0x9A, 0, 128, false },	/* 7:	800		0   */
-	{ 154, 0x9A, 0, 85,  false },	/* 8:	800		3.5 */
-	{ 154, 0x9A, 1, 128, false },	/* 9:	1200		0   */
+	{ 52,  0x9A, 0, 128, },	/* 0:	400		0   */
+	{ 78,  0x9A, 0, 85,  },	/* 1:	400		3.5 */
+	{ 104, 0x9A, 0, 64,  },	/* 2:	400		6   */
+	{ 154, 0x9A, 0, 43,  },	/* 3:	400		9.5 */
+	{ 77,  0x9A, 0, 128, },	/* 4:	600		0   */
+	{ 116, 0x9A, 0, 85,  },	/* 5:	600		3.5 */
+	{ 154, 0x9A, 0, 64,  },	/* 6:	600		6   */
+	{ 102, 0x9A, 0, 128, },	/* 7:	800		0   */
+	{ 154, 0x9A, 0, 85,  },	/* 8:	800		3.5 */
+	{ 154, 0x9A, 1, 128, },	/* 9:	1200		0   */
 };
 
 static const struct bxt_ddi_buf_trans bxt_ddi_translations_edp[] = {
 					/* Idx	NT mV diff	db  */
-	{ 26, 0, 0, 128, false },	/* 0:	200		0   */
-	{ 38, 0, 0, 112, false },	/* 1:	200		1.5 */
-	{ 48, 0, 0, 96,  false },	/* 2:	200		4   */
-	{ 54, 0, 0, 69,  false },	/* 3:	200		6   */
-	{ 32, 0, 0, 128, false },	/* 4:	250		0   */
-	{ 48, 0, 0, 104, false },	/* 5:	250		1.5 */
-	{ 54, 0, 0, 85,  false },	/* 6:	250		4   */
-	{ 43, 0, 0, 128, false },	/* 7:	300		0   */
-	{ 54, 0, 0, 101, false },	/* 8:	300		1.5 */
-	{ 48, 0, 0, 128, false },	/* 9:	300		0   */
+	{ 26, 0, 0, 128, },	/* 0:	200		0   */
+	{ 38, 0, 0, 112, },	/* 1:	200		1.5 */
+	{ 48, 0, 0, 96,  },	/* 2:	200		4   */
+	{ 54, 0, 0, 69,  },	/* 3:	200		6   */
+	{ 32, 0, 0, 128, },	/* 4:	250		0   */
+	{ 48, 0, 0, 104, },	/* 5:	250		1.5 */
+	{ 54, 0, 0, 85,  },	/* 6:	250		4   */
+	{ 43, 0, 0, 128, },	/* 7:	300		0   */
+	{ 54, 0, 0, 101, },	/* 8:	300		1.5 */
+	{ 48, 0, 0, 128, },	/* 9:	300		0   */
 };
 
 /* BSpec has 2 recommended values - entries 0 and 8.
@@ -341,16 +340,16 @@ static const struct bxt_ddi_buf_trans bxt_ddi_translations_edp[] = {
  */
 static const struct bxt_ddi_buf_trans bxt_ddi_translations_hdmi[] = {
 					/* Idx	NT mV diff	db  */
-	{ 52,  0x9A, 0, 128, false },	/* 0:	400		0   */
-	{ 52,  0x9A, 0, 85,  false },	/* 1:	400		3.5 */
-	{ 52,  0x9A, 0, 64,  false },	/* 2:	400		6   */
-	{ 42,  0x9A, 0, 43,  false },	/* 3:	400		9.5 */
-	{ 77,  0x9A, 0, 128, false },	/* 4:	600		0   */
-	{ 77,  0x9A, 0, 85,  false },	/* 5:	600		3.5 */
-	{ 77,  0x9A, 0, 64,  false },	/* 6:	600		6   */
-	{ 102, 0x9A, 0, 128, false },	/* 7:	800		0   */
-	{ 102, 0x9A, 0, 85,  false },	/* 8:	800		3.5 */
-	{ 154, 0x9A, 1, 128, true },	/* 9:	1200		0   */
+	{ 52,  0x9A, 0, 128, },	/* 0:	400		0   */
+	{ 52,  0x9A, 0, 85,  },	/* 1:	400		3.5 */
+	{ 52,  0x9A, 0, 64,  },	/* 2:	400		6   */
+	{ 42,  0x9A, 0, 43,  },	/* 3:	400		9.5 */
+	{ 77,  0x9A, 0, 128, },	/* 4:	600		0   */
+	{ 77,  0x9A, 0, 85,  },	/* 5:	600		3.5 */
+	{ 77,  0x9A, 0, 64,  },	/* 6:	600		6   */
+	{ 102, 0x9A, 0, 128, },	/* 7:	800		0   */
+	{ 102, 0x9A, 0, 85,  },	/* 8:	800		3.5 */
+	{ 154, 0x9A, 1, 128, },	/* 9:	1200		0   */
 };
 
 struct cnl_ddi_buf_trans {
@@ -753,12 +752,12 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
 
 	hdmi_level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
 
-	if (IS_GEN9_LP(dev_priv))
-		return hdmi_level;
-
 	if (IS_CANNONLAKE(dev_priv)) {
 		cnl_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
 		hdmi_default_entry = n_hdmi_entries - 1;
+	} else if (IS_GEN9_LP(dev_priv)) {
+		bxt_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
+		hdmi_default_entry = n_hdmi_entries - 1;
 	} else if (IS_GEN9_BC(dev_priv)) {
 		intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
 		hdmi_default_entry = 8;
@@ -1852,7 +1851,7 @@ static void bxt_ddi_vswing_sequence(struct intel_encoder *encoder,
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	const struct bxt_ddi_buf_trans *ddi_translations;
 	enum port port = encoder->port;
-	int n_entries, i;
+	int n_entries;
 
 	if (type == INTEL_OUTPUT_HDMI)
 		ddi_translations = bxt_get_buf_trans_hdmi(dev_priv, &n_entries);
@@ -1861,17 +1860,6 @@ static void bxt_ddi_vswing_sequence(struct intel_encoder *encoder,
 	else
 		ddi_translations = bxt_get_buf_trans_dp(dev_priv, &n_entries);
 
-	/* Check if default value has to be used */
-	if (level >= n_entries ||
-	    (type == INTEL_OUTPUT_HDMI && level == HDMI_LEVEL_SHIFT_UNKNOWN)) {
-		for (i = 0; i < n_entries; i++) {
-			if (ddi_translations[i].default_index) {
-				level = i;
-				break;
-			}
-		}
-	}
-
 	bxt_ddi_phy_set_signal_level(dev_priv, port,
 				     ddi_translations[level].margin,
 				     ddi_translations[level].scale,
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 20/29] drm/i915: Don't use encoder->type in intel_ddi_set_pipe_settings()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (18 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 19/29] drm/i915: Kill off the BXT buf_trans default_index Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 21/29] drm/i915: Pass crtc state to intel_prepare_dp_ddi_buffers() Ville Syrjala
                   ` (15 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

encoder->type isn't reliable for DP/HDMI so instead extract the correct
type from the crtc state in intel_ddi_set_pipe_settings().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 47 ++++++++++++++++++++--------------------
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 18678b79afcb..343e7e3c96b2 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1474,33 +1474,34 @@ void intel_ddi_set_pipe_settings(const struct intel_crtc_state *crtc_state)
 {
 	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
-	struct intel_encoder *encoder = intel_ddi_get_crtc_encoder(crtc);
 	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
-	int type = encoder->type;
-	uint32_t temp;
+	u32 temp;
 
-	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP || type == INTEL_OUTPUT_DP_MST) {
-		WARN_ON(transcoder_is_dsi(cpu_transcoder));
+	if (!intel_crtc_has_dp_encoder(crtc_state))
+		return;
 
-		temp = TRANS_MSA_SYNC_CLK;
-		switch (crtc_state->pipe_bpp) {
-		case 18:
-			temp |= TRANS_MSA_6_BPC;
-			break;
-		case 24:
-			temp |= TRANS_MSA_8_BPC;
-			break;
-		case 30:
-			temp |= TRANS_MSA_10_BPC;
-			break;
-		case 36:
-			temp |= TRANS_MSA_12_BPC;
-			break;
-		default:
-			BUG();
-		}
-		I915_WRITE(TRANS_MSA_MISC(cpu_transcoder), temp);
+	WARN_ON(transcoder_is_dsi(cpu_transcoder));
+
+	temp = TRANS_MSA_SYNC_CLK;
+	switch (crtc_state->pipe_bpp) {
+	case 18:
+		temp |= TRANS_MSA_6_BPC;
+		break;
+	case 24:
+		temp |= TRANS_MSA_8_BPC;
+		break;
+	case 30:
+		temp |= TRANS_MSA_10_BPC;
+		break;
+	case 36:
+		temp |= TRANS_MSA_12_BPC;
+		break;
+	default:
+		MISSING_CASE(crtc_state->pipe_bpp);
+		break;
 	}
+
+	I915_WRITE(TRANS_MSA_MISC(cpu_transcoder), temp);
 }
 
 void intel_ddi_set_vc_payload_alloc(const struct intel_crtc_state *crtc_state,
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 21/29] drm/i915: Pass crtc state to intel_prepare_dp_ddi_buffers()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (19 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 20/29] drm/i915: Don't use encoder->type in intel_ddi_set_pipe_settings() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 22/29] drm/i915: Start using output_types for DPLL selection Ville Syrjala
                   ` (14 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

Eliminate intel_prepare_dp_ddi_buffers()'s reliance on the encoder->type
by passing in the crtc state.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 343e7e3c96b2..d98f6b86f1d3 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -785,7 +785,8 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
  * values in advance. This function programs the correct values for
  * DP/eDP/FDI use cases.
  */
-static void intel_prepare_dp_ddi_buffers(struct intel_encoder *encoder)
+static void intel_prepare_dp_ddi_buffers(struct intel_encoder *encoder,
+					 const struct intel_crtc_state *crtc_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	u32 iboost_bit = 0;
@@ -793,23 +794,15 @@ static void intel_prepare_dp_ddi_buffers(struct intel_encoder *encoder)
 	enum port port = intel_ddi_get_encoder_port(encoder);
 	const struct ddi_buf_trans *ddi_translations;
 
-	switch (encoder->type) {
-	case INTEL_OUTPUT_EDP:
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_ANALOG))
+		ddi_translations = intel_ddi_get_buf_trans_fdi(dev_priv,
+							       &n_entries);
+	else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP))
 		ddi_translations = intel_ddi_get_buf_trans_edp(dev_priv,
 							       &n_entries);
-		break;
-	case INTEL_OUTPUT_DP:
+	else
 		ddi_translations = intel_ddi_get_buf_trans_dp(dev_priv,
 							      &n_entries);
-		break;
-	case INTEL_OUTPUT_ANALOG:
-		ddi_translations = intel_ddi_get_buf_trans_fdi(dev_priv,
-							       &n_entries);
-		break;
-	default:
-		MISSING_CASE(encoder->type);
-		return;
-	}
 
 	if (IS_GEN9_BC(dev_priv)) {
 		/* If we're boosting the current, set bit 31 of trans1 */
@@ -912,7 +905,7 @@ void hsw_fdi_link_train(struct intel_crtc *crtc,
 
 	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
 		WARN_ON(encoder->type != INTEL_OUTPUT_ANALOG);
-		intel_prepare_dp_ddi_buffers(encoder);
+		intel_prepare_dp_ddi_buffers(encoder, crtc_state);
 	}
 
 	/* Set the FDI_RX_MISC pwrdn lanes and the 2 workarounds listed at the
@@ -2166,7 +2159,7 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	else if (IS_GEN9_LP(dev_priv))
 		bxt_ddi_vswing_sequence(encoder, level, encoder->type);
 	else
-		intel_prepare_dp_ddi_buffers(encoder);
+		intel_prepare_dp_ddi_buffers(encoder, crtc_state);
 
 	intel_ddi_init_dp_buf_reg(encoder);
 	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_ON);
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 22/29] drm/i915: Start using output_types for DPLL selection
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (20 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 21/29] drm/i915: Pass crtc state to intel_prepare_dp_ddi_buffers() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 23/29] drm/i915: Stop using encoder->type in intel_ddi_enable_transcoder_func() Ville Syrjala
                   ` (13 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

encoder->type is not realiable for DP/HDMI so let's switch the DPLL
selection over to using output_types.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_dpll_mgr.c | 36 +++++++++++++----------------------
 1 file changed, 13 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.c b/drivers/gpu/drm/i915/intel_dpll_mgr.c
index a2a3d93d67bd..c03d9ec458e6 100644
--- a/drivers/gpu/drm/i915/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/intel_dpll_mgr.c
@@ -813,15 +813,11 @@ hsw_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
 	memset(&crtc_state->dpll_hw_state, 0,
 	       sizeof(crtc_state->dpll_hw_state));
 
-	if (encoder->type == INTEL_OUTPUT_HDMI) {
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
 		pll = hsw_ddi_hdmi_get_dpll(clock, crtc, crtc_state);
-
-	} else if (encoder->type == INTEL_OUTPUT_DP ||
-		   encoder->type == INTEL_OUTPUT_DP_MST ||
-		   encoder->type == INTEL_OUTPUT_EDP) {
+	} else if (intel_crtc_has_dp_encoder(crtc_state)) {
 		pll = hsw_ddi_dp_get_dpll(encoder, clock);
-
-	} else if (encoder->type == INTEL_OUTPUT_ANALOG) {
+	} else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_ANALOG)) {
 		if (WARN_ON(crtc_state->port_clock / 2 != 135000))
 			return NULL;
 
@@ -1369,15 +1365,13 @@ skl_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
 
 	memset(&dpll_hw_state, 0, sizeof(dpll_hw_state));
 
-	if (encoder->type == INTEL_OUTPUT_HDMI) {
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
 		bret = skl_ddi_hdmi_pll_dividers(crtc, crtc_state, clock);
 		if (!bret) {
 			DRM_DEBUG_KMS("Could not get HDMI pll dividers.\n");
 			return NULL;
 		}
-	} else if (encoder->type == INTEL_OUTPUT_DP ||
-		   encoder->type == INTEL_OUTPUT_DP_MST ||
-		   encoder->type == INTEL_OUTPUT_EDP) {
+	} else if (intel_crtc_has_dp_encoder(crtc_state)) {
 		bret = skl_ddi_dp_set_dpll_hw_state(clock, &dpll_hw_state);
 		if (!bret) {
 			DRM_DEBUG_KMS("Could not set DP dpll HW state.\n");
@@ -1388,7 +1382,7 @@ skl_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
 		return NULL;
 	}
 
-	if (encoder->type == INTEL_OUTPUT_EDP)
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP))
 		pll = intel_find_shared_dpll(crtc, crtc_state,
 					     DPLL_ID_SKL_DPLL0,
 					     DPLL_ID_SKL_DPLL0);
@@ -1812,14 +1806,12 @@ bxt_get_dpll(struct intel_crtc *crtc,
 	struct intel_shared_dpll *pll;
 	int i, clock = crtc_state->port_clock;
 
-	if (encoder->type == INTEL_OUTPUT_HDMI &&
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI) &&
 	    !bxt_ddi_hdmi_set_dpll_hw_state(crtc, crtc_state, clock,
 					    &dpll_hw_state))
 		return NULL;
 
-	if ((encoder->type == INTEL_OUTPUT_DP ||
-	     encoder->type == INTEL_OUTPUT_EDP ||
-	     encoder->type == INTEL_OUTPUT_DP_MST) &&
+	if (intel_crtc_has_dp_encoder(crtc_state) &&
 	    !bxt_ddi_dp_set_dpll_hw_state(clock, &dpll_hw_state))
 		return NULL;
 
@@ -1828,7 +1820,7 @@ bxt_get_dpll(struct intel_crtc *crtc,
 
 	crtc_state->dpll_hw_state = dpll_hw_state;
 
-	if (encoder->type == INTEL_OUTPUT_DP_MST) {
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST)) {
 		struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder->base);
 
 		intel_dig_port = intel_mst->primary;
@@ -2345,15 +2337,13 @@ cnl_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
 
 	memset(&dpll_hw_state, 0, sizeof(dpll_hw_state));
 
-	if (encoder->type == INTEL_OUTPUT_HDMI) {
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
 		bret = cnl_ddi_hdmi_pll_dividers(crtc, crtc_state, clock);
 		if (!bret) {
 			DRM_DEBUG_KMS("Could not get HDMI pll dividers.\n");
 			return NULL;
 		}
-	} else if (encoder->type == INTEL_OUTPUT_DP ||
-		   encoder->type == INTEL_OUTPUT_DP_MST ||
-		   encoder->type == INTEL_OUTPUT_EDP) {
+	} else if (intel_crtc_has_dp_encoder(crtc_state)) {
 		bret = cnl_ddi_dp_set_dpll_hw_state(clock, &dpll_hw_state);
 		if (!bret) {
 			DRM_DEBUG_KMS("Could not set DP dpll HW state.\n");
@@ -2361,8 +2351,8 @@ cnl_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
 		}
 		crtc_state->dpll_hw_state = dpll_hw_state;
 	} else {
-		DRM_DEBUG_KMS("Skip DPLL setup for encoder %d\n",
-			      encoder->type);
+		DRM_DEBUG_KMS("Skip DPLL setup for output_types 0x%x\n",
+			      crtc_state->output_types);
 		return NULL;
 	}
 
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 23/29] drm/i915: Stop using encoder->type in intel_ddi_enable_transcoder_func()
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (21 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 22/29] drm/i915: Start using output_types for DPLL selection Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:25 ` [PATCH 24/29] drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling Ville Syrjala
                   ` (12 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

intel_ddi_enable_transcoder_func() already has the crtc state so we can
use that instead of the untrustworthy encoder->type.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index d98f6b86f1d3..c804f4e91036 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1520,7 +1520,6 @@ void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state)
 	enum pipe pipe = crtc->pipe;
 	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
 	enum port port = intel_ddi_get_encoder_port(encoder);
-	int type = encoder->type;
 	uint32_t temp;
 
 	/* Enable TRANS_DDI_FUNC_CTL for the pipe to work in HDMI mode */
@@ -1575,7 +1574,7 @@ void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state)
 		}
 	}
 
-	if (type == INTEL_OUTPUT_HDMI) {
+	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) {
 		if (crtc_state->has_hdmi_sink)
 			temp |= TRANS_DDI_MODE_SELECT_HDMI;
 		else
@@ -1585,19 +1584,15 @@ void intel_ddi_enable_transcoder_func(const struct intel_crtc_state *crtc_state)
 			temp |= TRANS_DDI_HDMI_SCRAMBLING_MASK;
 		if (crtc_state->hdmi_high_tmds_clock_ratio)
 			temp |= TRANS_DDI_HIGH_TMDS_CHAR_RATE;
-	} else if (type == INTEL_OUTPUT_ANALOG) {
+	} else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_ANALOG)) {
 		temp |= TRANS_DDI_MODE_SELECT_FDI;
 		temp |= (crtc_state->fdi_lanes - 1) << 1;
-	} else if (type == INTEL_OUTPUT_DP ||
-		   type == INTEL_OUTPUT_EDP) {
-		temp |= TRANS_DDI_MODE_SELECT_DP_SST;
-		temp |= DDI_PORT_WIDTH(crtc_state->lane_count);
-	} else if (type == INTEL_OUTPUT_DP_MST) {
+	} else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST)) {
 		temp |= TRANS_DDI_MODE_SELECT_DP_MST;
 		temp |= DDI_PORT_WIDTH(crtc_state->lane_count);
 	} else {
-		WARN(1, "Invalid encoder type %d for pipe %c\n",
-		     encoder->type, pipe_name(pipe));
+		temp |= TRANS_DDI_MODE_SELECT_DP_SST;
+		temp |= DDI_PORT_WIDTH(crtc_state->lane_count);
 	}
 
 	I915_WRITE(TRANS_DDI_FUNC_CTL(cpu_transcoder), temp);
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 24/29] drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (22 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 23/29] drm/i915: Stop using encoder->type in intel_ddi_enable_transcoder_func() Ville Syrjala
@ 2017-09-18 18:25 ` Ville Syrjala
  2017-09-18 18:26 ` [PATCH 25/29] drm/i915: Stop frobbing with DDI encoder->type Ville Syrjala
                   ` (11 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:25 UTC (permalink / raw)
  To: intel-gfx

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

SKL DDI B/C/D only have 9 usable buf trans registers for DP/eDP. That
matches the normal DP buf trans tables, but the low vswing eDP tables
have 10 entries. Thus the eDP tables can only be used safely with DDI A
and E.

We try to catch cases where DDI B/C/D gets used with the wrong number of
entires in some parts of the code, but not everywhere. Let's move the
code to deal with that deeper into intel_ddi_get_buf_trans_edp(). And
for sake of symmetry do the same in intel_ddi_get_buf_trans_dp(). That
would also avoid explosions in the rather unlikely case that the DP
tables would get revised to 10 entries as well.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 60 +++++++++++++++++++++++-----------------
 1 file changed, 34 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index c804f4e91036..d625bfe6d420 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -587,14 +587,29 @@ skl_get_buf_trans_hdmi(struct drm_i915_private *dev_priv, int *n_entries)
 	}
 }
 
+static int skl_buf_trans_num_entries(enum port port, int n_entries)
+{
+	/* Only DDIA and DDIE can select the 10th register with DP */
+	if (port == PORT_A || port == PORT_E)
+		return min(n_entries, 10);
+	else
+		return min(n_entries, 9);
+}
+
 static const struct ddi_buf_trans *
 intel_ddi_get_buf_trans_dp(struct drm_i915_private *dev_priv,
-			   int *n_entries)
+			   enum port port, int *n_entries)
 {
 	if (IS_KABYLAKE(dev_priv) || IS_COFFEELAKE(dev_priv)) {
-		return kbl_get_buf_trans_dp(dev_priv, n_entries);
+		const struct ddi_buf_trans *ddi_translations =
+			kbl_get_buf_trans_dp(dev_priv, n_entries);
+		*n_entries = skl_buf_trans_num_entries(port, *n_entries);
+		return ddi_translations;
 	} else if (IS_SKYLAKE(dev_priv)) {
-		return skl_get_buf_trans_dp(dev_priv, n_entries);
+		const struct ddi_buf_trans *ddi_translations =
+			skl_get_buf_trans_dp(dev_priv, n_entries);
+		*n_entries = skl_buf_trans_num_entries(port, *n_entries);
+		return ddi_translations;
 	} else if (IS_BROADWELL(dev_priv)) {
 		*n_entries = ARRAY_SIZE(bdw_ddi_translations_dp);
 		return  bdw_ddi_translations_dp;
@@ -609,10 +624,13 @@ intel_ddi_get_buf_trans_dp(struct drm_i915_private *dev_priv,
 
 static const struct ddi_buf_trans *
 intel_ddi_get_buf_trans_edp(struct drm_i915_private *dev_priv,
-			    int *n_entries)
+			    enum port port, int *n_entries)
 {
 	if (IS_GEN9_BC(dev_priv)) {
-		return skl_get_buf_trans_edp(dev_priv, n_entries);
+		const struct ddi_buf_trans *ddi_translations =
+			skl_get_buf_trans_edp(dev_priv, n_entries);
+		*n_entries = skl_buf_trans_num_entries(port, *n_entries);
+		return ddi_translations;
 	} else if (IS_BROADWELL(dev_priv)) {
 		return bdw_get_buf_trans_edp(dev_priv, n_entries);
 	} else if (IS_HASWELL(dev_priv)) {
@@ -798,22 +816,16 @@ static void intel_prepare_dp_ddi_buffers(struct intel_encoder *encoder,
 		ddi_translations = intel_ddi_get_buf_trans_fdi(dev_priv,
 							       &n_entries);
 	else if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_EDP))
-		ddi_translations = intel_ddi_get_buf_trans_edp(dev_priv,
+		ddi_translations = intel_ddi_get_buf_trans_edp(dev_priv, port,
 							       &n_entries);
 	else
-		ddi_translations = intel_ddi_get_buf_trans_dp(dev_priv,
+		ddi_translations = intel_ddi_get_buf_trans_dp(dev_priv, port,
 							      &n_entries);
 
-	if (IS_GEN9_BC(dev_priv)) {
-		/* If we're boosting the current, set bit 31 of trans1 */
-		if (dev_priv->vbt.ddi_port_info[port].dp_boost_level)
-			iboost_bit = DDI_BUF_BALANCE_LEG_ENABLE;
-
-		if (WARN_ON(encoder->type == INTEL_OUTPUT_EDP &&
-			    port != PORT_A && port != PORT_E &&
-			    n_entries > 9))
-			n_entries = 9;
-	}
+	/* If we're boosting the current, set bit 31 of trans1 */
+	if (IS_GEN9_BC(dev_priv) &&
+	    dev_priv->vbt.ddi_port_info[port].dp_boost_level)
+		iboost_bit = DDI_BUF_BALANCE_LEG_ENABLE;
 
 	for (i = 0; i < n_entries; i++) {
 		I915_WRITE(DDI_BUF_TRANS_LO(port, i),
@@ -1810,14 +1822,9 @@ static void skl_ddi_set_iboost(struct intel_encoder *encoder,
 		if (type == INTEL_OUTPUT_HDMI)
 			ddi_translations = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_entries);
 		else if (type == INTEL_OUTPUT_EDP)
-			ddi_translations = intel_ddi_get_buf_trans_edp(dev_priv, &n_entries);
+			ddi_translations = intel_ddi_get_buf_trans_edp(dev_priv, port, &n_entries);
 		else
-			ddi_translations = intel_ddi_get_buf_trans_dp(dev_priv, &n_entries);
-
-		if (WARN_ON(type != INTEL_OUTPUT_HDMI &&
-			    port != PORT_A &&
-			    port != PORT_E && n_entries > 9))
-			n_entries = 9;
+			ddi_translations = intel_ddi_get_buf_trans_dp(dev_priv, port, &n_entries);
 
 		iboost = ddi_translations[level].i_boost;
 	}
@@ -1859,6 +1866,7 @@ static void bxt_ddi_vswing_sequence(struct intel_encoder *encoder,
 u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
+	enum port port = encoder->port;
 	int n_entries;
 
 	if (IS_CANNONLAKE(dev_priv)) {
@@ -1873,9 +1881,9 @@ u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder)
 			bxt_get_buf_trans_dp(dev_priv, &n_entries);
 	} else {
 		if (encoder->type == INTEL_OUTPUT_EDP)
-			intel_ddi_get_buf_trans_edp(dev_priv, &n_entries);
+			intel_ddi_get_buf_trans_edp(dev_priv, port, &n_entries);
 		else
-			intel_ddi_get_buf_trans_dp(dev_priv, &n_entries);
+			intel_ddi_get_buf_trans_dp(dev_priv, port, &n_entries);
 	}
 
 	if (WARN_ON(n_entries < 1))
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 25/29] drm/i915: Stop frobbing with DDI encoder->type
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (23 preceding siblings ...)
  2017-09-18 18:25 ` [PATCH 24/29] drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling Ville Syrjala
@ 2017-09-18 18:26 ` Ville Syrjala
  2017-09-21 11:06   ` [PATCH v2 " Ville Syrjala
  2017-09-21 14:56   ` [PATCH v3 " Ville Syrjala
  2017-09-18 18:26 ` [PATCH 26/29] drm/i915: Unify error handling for missing DDI buf trans tables Ville Syrjala
                   ` (10 subsequent siblings)
  35 siblings, 2 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:26 UTC (permalink / raw)
  To: intel-gfx

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

Currently the DDI encoder->type will change at runtime depending on
what kind of hotplugs we've processed. That's quite bad since we can't
really trust that that current value of encoder->type actually matches
the type of signal we're trying to drive through it.

Let's eliminate that problem by declaring that non-eDP DDI port will
always have the encoder type as INTEL_OUTPUT_DDI. This means the code
can no longer try to distinguish DP vs. HDMI based on encoder->type.
We'll eDP as INTEL_OUTPUT_EDP, since it'll never change and there's a
bunch of code that relies on that value to identofy eDP.

We'll introduce a new encoder .compute_output_type() hook. This allows
us to compute the full output_types before any encoder .compute_config()
hooks get called, thus those hooks can rely on output_types being
correct, which is useful for cloning on oldr platforms. For now we'll
just look at the connector type and pick the correct mode based on that.
In the future the new hook could be used to implement dynamic switching
between LS and PCON modes for LSPCON.

TODO: maybe make .get_config() populate output_types rather than doing
the default encoder->type thing in caller and then undoing it for
DDI in .get_config().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |  2 +-
 drivers/gpu/drm/i915/intel_ddi.c      | 49 +++++++++++++++++++++++++++++------
 drivers/gpu/drm/i915/intel_display.c  | 11 +++++---
 drivers/gpu/drm/i915/intel_dp.c       | 15 ++---------
 drivers/gpu/drm/i915/intel_drv.h      |  7 +++--
 drivers/gpu/drm/i915/intel_hdmi.c     | 10 ++-----
 drivers/gpu/drm/i915/intel_opregion.c |  2 +-
 7 files changed, 60 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index ca6fa6d122c6..73601464240d 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3053,7 +3053,7 @@ static void intel_connector_info(struct seq_file *m,
 		break;
 	case DRM_MODE_CONNECTOR_HDMIA:
 		if (intel_encoder->type == INTEL_OUTPUT_HDMI ||
-		    intel_encoder->type == INTEL_OUTPUT_UNKNOWN)
+		    intel_encoder->type == INTEL_OUTPUT_DDI)
 			intel_hdmi_info(m, intel_connector);
 		break;
 	default:
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index d625bfe6d420..e93ed0d31738 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -497,10 +497,8 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *encoder)
 	switch (encoder->type) {
 	case INTEL_OUTPUT_DP_MST:
 		return enc_to_mst(&encoder->base)->primary->port;
-	case INTEL_OUTPUT_DP:
 	case INTEL_OUTPUT_EDP:
-	case INTEL_OUTPUT_HDMI:
-	case INTEL_OUTPUT_UNKNOWN:
+	case INTEL_OUTPUT_DDI:
 		return enc_to_dig_port(&encoder->base)->port;
 	case INTEL_OUTPUT_ANALOG:
 		return PORT_E;
@@ -1516,6 +1514,7 @@ void intel_ddi_set_vc_payload_alloc(const struct intel_crtc_state *crtc_state,
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
 	uint32_t temp;
+
 	temp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
 	if (state == true)
 		temp |= TRANS_DDI_DP_VC_PAYLOAD_ALLOC;
@@ -2489,6 +2488,13 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 	struct intel_digital_port *intel_dig_port;
 	u32 temp, flags = 0;
 
+	/*
+	 * Can be set by the caller based on encoder->type.
+	 * Undo that since we don't want INTEL_OUTPUT_DDI
+	 * to appear in output_types.
+	 */
+	pipe_config->output_types &= ~BIT(INTEL_OUTPUT_DDI);
+
 	/* XXX: DSI transcoder paranoia */
 	if (WARN_ON(transcoder_is_dsi(cpu_transcoder)))
 		return;
@@ -2537,12 +2543,23 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 			pipe_config->hdmi_high_tmds_clock_ratio = true;
 		/* fall through */
 	case TRANS_DDI_MODE_SELECT_DVI:
+		pipe_config->output_types |= BIT(INTEL_OUTPUT_HDMI);
 		pipe_config->lane_count = 4;
 		break;
 	case TRANS_DDI_MODE_SELECT_FDI:
+		pipe_config->output_types |= BIT(INTEL_OUTPUT_ANALOG);
 		break;
 	case TRANS_DDI_MODE_SELECT_DP_SST:
+		if (encoder->type == INTEL_OUTPUT_EDP)
+			pipe_config->output_types |= BIT(INTEL_OUTPUT_EDP);
+		else
+			pipe_config->output_types |= BIT(INTEL_OUTPUT_DP);
+		pipe_config->lane_count =
+			((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1;
+		intel_dp_get_m_n(intel_crtc, pipe_config);
+		break;
 	case TRANS_DDI_MODE_SELECT_DP_MST:
+		pipe_config->output_types |= BIT(INTEL_OUTPUT_DP_MST);
 		pipe_config->lane_count =
 			((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1;
 		intel_dp_get_m_n(intel_crtc, pipe_config);
@@ -2581,21 +2598,36 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 			bxt_ddi_phy_get_lane_lat_optim_mask(encoder);
 }
 
+static enum intel_output_type
+intel_ddi_compute_output_type(struct intel_encoder *encoder,
+			      struct intel_crtc_state *crtc_state,
+			      struct drm_connector_state *conn_state)
+{
+	switch (conn_state->connector->connector_type) {
+	case DRM_MODE_CONNECTOR_HDMIA:
+		return INTEL_OUTPUT_HDMI;
+	case DRM_MODE_CONNECTOR_eDP:
+		return INTEL_OUTPUT_EDP;
+	case DRM_MODE_CONNECTOR_DisplayPort:
+		return INTEL_OUTPUT_DP;
+	default:
+		MISSING_CASE(conn_state->connector->connector_type);
+		return INTEL_OUTPUT_UNUSED;
+	}
+}
+
 static bool intel_ddi_compute_config(struct intel_encoder *encoder,
 				     struct intel_crtc_state *pipe_config,
 				     struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	int type = encoder->type;
 	int port = intel_ddi_get_encoder_port(encoder);
 	int ret;
 
-	WARN(type == INTEL_OUTPUT_UNKNOWN, "compute_config() on unknown output!\n");
-
 	if (port == PORT_A)
 		pipe_config->cpu_transcoder = TRANSCODER_EDP;
 
-	if (type == INTEL_OUTPUT_HDMI)
+	if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_HDMI))
 		ret = intel_hdmi_compute_config(encoder, pipe_config, conn_state);
 	else
 		ret = intel_dp_compute_config(encoder, pipe_config, conn_state);
@@ -2715,6 +2747,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	drm_encoder_init(&dev_priv->drm, encoder, &intel_ddi_funcs,
 			 DRM_MODE_ENCODER_TMDS, "DDI %c", port_name(port));
 
+	intel_encoder->compute_output_type = intel_ddi_compute_output_type;
 	intel_encoder->compute_config = intel_ddi_compute_config;
 	intel_encoder->enable = intel_enable_ddi;
 	if (IS_GEN9_LP(dev_priv))
@@ -2774,7 +2807,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 
 	intel_dig_port->max_lanes = max_lanes;
 
-	intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
+	intel_encoder->type = INTEL_OUTPUT_DDI;
 	intel_encoder->power_domain = intel_port_to_power_domain(port);
 	intel_encoder->port = port;
 	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 192b07a92e76..8f4f5f3a1c75 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10696,7 +10696,7 @@ static const char * const output_type_str[] = {
 	OUTPUT_TYPE(DP),
 	OUTPUT_TYPE(EDP),
 	OUTPUT_TYPE(DSI),
-	OUTPUT_TYPE(UNKNOWN),
+	OUTPUT_TYPE(DDI),
 	OUTPUT_TYPE(DP_MST),
 };
 
@@ -10866,7 +10866,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state)
 
 		switch (encoder->type) {
 			unsigned int port_mask;
-		case INTEL_OUTPUT_UNKNOWN:
+		case INTEL_OUTPUT_DDI:
 			if (WARN_ON(!HAS_DDI(to_i915(dev))))
 				break;
 		case INTEL_OUTPUT_DP:
@@ -10999,7 +10999,12 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
 		 * Determine output_types before calling the .compute_config()
 		 * hooks so that the hooks can use this information safely.
 		 */
-		pipe_config->output_types |= 1 << encoder->type;
+		if (encoder->compute_output_type)
+			pipe_config->output_types |=
+				BIT(encoder->compute_output_type(encoder, pipe_config,
+								 connector_state));
+		else
+			pipe_config->output_types |= BIT(encoder->type);
 	}
 
 encoder_retry:
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index cc25a9b10fd9..4196435ae17e 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -768,7 +768,8 @@ void intel_power_sequencer_reset(struct drm_i915_private *dev_priv)
 	for_each_intel_encoder(dev, encoder) {
 		struct intel_dp *intel_dp;
 
-		if (encoder->type != INTEL_OUTPUT_DP &&
+		if (!IS_GEN9_LP(dev_priv) &&
+		    encoder->type != INTEL_OUTPUT_DP &&
 		    encoder->type != INTEL_OUTPUT_EDP)
 			continue;
 
@@ -4697,8 +4698,6 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
 {
 	struct drm_connector *connector = &intel_connector->base;
 	struct intel_dp *intel_dp = intel_attached_dp(connector);
-	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
-	struct intel_encoder *intel_encoder = &intel_dig_port->base;
 	struct drm_device *dev = connector->dev;
 	enum drm_connector_status status;
 	u8 sink_irq_vector = 0;
@@ -4731,9 +4730,6 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
 		goto out;
 	}
 
-	if (intel_encoder->type != INTEL_OUTPUT_EDP)
-		intel_encoder->type = INTEL_OUTPUT_DP;
-
 	DRM_DEBUG_KMS("Display Port TPS3 support: source %s, sink %s\n",
 		      yesno(intel_dp_source_supports_hbr2(intel_dp)),
 		      yesno(drm_dp_tps3_supported(intel_dp->dpcd)));
@@ -4854,9 +4850,6 @@ intel_dp_force(struct drm_connector *connector)
 	intel_dp_set_edid(intel_dp);
 
 	intel_display_power_put(dev_priv, intel_dp->aux_power_domain);
-
-	if (intel_encoder->type != INTEL_OUTPUT_EDP)
-		intel_encoder->type = INTEL_OUTPUT_DP;
 }
 
 static int intel_dp_get_modes(struct drm_connector *connector)
@@ -5075,10 +5068,6 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	enum irqreturn ret = IRQ_NONE;
 
-	if (intel_dig_port->base.type != INTEL_OUTPUT_EDP &&
-	    intel_dig_port->base.type != INTEL_OUTPUT_HDMI)
-		intel_dig_port->base.type = INTEL_OUTPUT_DP;
-
 	if (long_hpd && intel_dig_port->base.type == INTEL_OUTPUT_EDP) {
 		/*
 		 * vdd off can generate a long pulse on eDP which
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 307807672896..6e375d2e052c 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -173,7 +173,7 @@ enum intel_output_type {
 	INTEL_OUTPUT_DP = 7,
 	INTEL_OUTPUT_EDP = 8,
 	INTEL_OUTPUT_DSI = 9,
-	INTEL_OUTPUT_UNKNOWN = 10,
+	INTEL_OUTPUT_DDI = 10,
 	INTEL_OUTPUT_DP_MST = 11,
 };
 
@@ -216,6 +216,9 @@ struct intel_encoder {
 	enum port port;
 	unsigned int cloneable;
 	void (*hot_plug)(struct intel_encoder *);
+	enum intel_output_type (*compute_output_type)(struct intel_encoder *,
+						      struct intel_crtc_state *,
+						      struct drm_connector_state *);
 	bool (*compute_config)(struct intel_encoder *,
 			       struct intel_crtc_state *,
 			       struct drm_connector_state *);
@@ -1151,7 +1154,7 @@ enc_to_dig_port(struct drm_encoder *encoder)
 	struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
 
 	switch (intel_encoder->type) {
-	case INTEL_OUTPUT_UNKNOWN:
+	case INTEL_OUTPUT_DDI:
 		WARN_ON(!HAS_DDI(to_i915(encoder->dev)));
 	case INTEL_OUTPUT_DP:
 	case INTEL_OUTPUT_EDP:
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index e6f8f30ce7bd..ab8f8d751081 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1604,12 +1604,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 
 	intel_hdmi_unset_edid(connector);
 
-	if (intel_hdmi_set_edid(connector)) {
-		struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-
-		hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
+	if (intel_hdmi_set_edid(connector))
 		status = connector_status_connected;
-	} else
+	else
 		status = connector_status_disconnected;
 
 	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
@@ -1620,8 +1617,6 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 static void
 intel_hdmi_force(struct drm_connector *connector)
 {
-	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
@@ -1631,7 +1626,6 @@ intel_hdmi_force(struct drm_connector *connector)
 		return;
 
 	intel_hdmi_set_edid(connector);
-	hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
 }
 
 static int intel_hdmi_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index 98154efcb2f4..d57ade0b652a 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -383,7 +383,7 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
 	case INTEL_OUTPUT_ANALOG:
 		type = DISPLAY_TYPE_CRT;
 		break;
-	case INTEL_OUTPUT_UNKNOWN:
+	case INTEL_OUTPUT_DDI:
 	case INTEL_OUTPUT_DP:
 	case INTEL_OUTPUT_HDMI:
 	case INTEL_OUTPUT_DP_MST:
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 26/29] drm/i915: Unify error handling for missing DDI buf trans tables
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (24 preceding siblings ...)
  2017-09-18 18:26 ` [PATCH 25/29] drm/i915: Stop frobbing with DDI encoder->type Ville Syrjala
@ 2017-09-18 18:26 ` Ville Syrjala
  2017-09-18 18:26 ` [PATCH 27/29] drm/i915: Clear up the types we use for DDI buf trans level/n_entries Ville Syrjala
                   ` (9 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:26 UTC (permalink / raw)
  To: intel-gfx

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

Handle missing buf trans tables, or out of bounds buf trans levels
the same way everywhere. These should never be hit under normal
conditions, but let's play it safe for now.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index e93ed0d31738..b33b35757b34 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -793,6 +793,9 @@ static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port por
 	    hdmi_level >= n_hdmi_entries)
 		hdmi_level = hdmi_default_entry;
 
+	if (WARN_ON_ONCE(hdmi_level >= n_hdmi_entries))
+		hdmi_level = n_hdmi_entries - 1;
+
 	return hdmi_level;
 }
 
@@ -849,6 +852,11 @@ static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder,
 
 	ddi_translations_hdmi = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
 
+	if (WARN_ON_ONCE(!ddi_translations_hdmi))
+		return;
+	if (WARN_ON_ONCE(hdmi_level >= n_hdmi_entries))
+		hdmi_level = n_hdmi_entries - 1;
+
 	/* If we're boosting the current, set bit 31 of trans1 */
 	if (IS_GEN9_BC(dev_priv) &&
 	    dev_priv->vbt.ddi_port_info[port].hdmi_boost_level)
@@ -1825,6 +1833,11 @@ static void skl_ddi_set_iboost(struct intel_encoder *encoder,
 		else
 			ddi_translations = intel_ddi_get_buf_trans_dp(dev_priv, port, &n_entries);
 
+		if (WARN_ON_ONCE(!ddi_translations))
+			return;
+		if (WARN_ON_ONCE(level >= n_entries))
+			level = n_entries - 1;
+
 		iboost = ddi_translations[level].i_boost;
 	}
 
@@ -1855,6 +1868,11 @@ static void bxt_ddi_vswing_sequence(struct intel_encoder *encoder,
 	else
 		ddi_translations = bxt_get_buf_trans_dp(dev_priv, &n_entries);
 
+	if (WARN_ON_ONCE(!ddi_translations))
+		return;
+	if (WARN_ON_ONCE(level >= n_entries))
+		level = n_entries - 1;
+
 	bxt_ddi_phy_set_signal_level(dev_priv, port,
 				     ddi_translations[level].margin,
 				     ddi_translations[level].scale,
@@ -1908,13 +1926,10 @@ static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
 	else
 		ddi_translations = cnl_get_buf_trans_dp(dev_priv, &n_entries);
 
-	if (WARN_ON(ddi_translations == NULL))
+	if (WARN_ON_ONCE(!ddi_translations))
 		return;
-
-	if (level >= n_entries) {
-		DRM_DEBUG_KMS("DDI translation not found for level %d. Using %d instead.", level, n_entries - 1);
+	if (WARN_ON_ONCE(level >= n_entries))
 		level = n_entries - 1;
-	}
 
 	/* Set PORT_TX_DW5 Scaling Mode Sel to 010b. */
 	val = I915_READ(CNL_PORT_TX_DW5_LN0(port));
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 27/29] drm/i915: Clear up the types we use for DDI buf trans level/n_entries
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (25 preceding siblings ...)
  2017-09-18 18:26 ` [PATCH 26/29] drm/i915: Unify error handling for missing DDI buf trans tables Ville Syrjala
@ 2017-09-18 18:26 ` Ville Syrjala
  2017-09-18 18:26 ` [PATCH 28/29] drm/i915: Replace most intel_ddi_get_encoder_port() alls with encoder->port Ville Syrjala
                   ` (8 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:26 UTC (permalink / raw)
  To: intel-gfx

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

Use plain int for the DDI buf trans levels and number of entries. While
at it drop the redundant "hdmi" from some of the variable names.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 65 +++++++++++++++++++---------------------
 1 file changed, 31 insertions(+), 34 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index b33b35757b34..111289d6f44f 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -762,41 +762,38 @@ cnl_get_buf_trans_edp(struct drm_i915_private *dev_priv, int *n_entries)
 
 static int intel_ddi_hdmi_level(struct drm_i915_private *dev_priv, enum port port)
 {
-	int n_hdmi_entries;
-	int hdmi_level;
-	int hdmi_default_entry;
+	int n_entries, level, default_entry;
 
-	hdmi_level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
+	level = dev_priv->vbt.ddi_port_info[port].hdmi_level_shift;
 
 	if (IS_CANNONLAKE(dev_priv)) {
-		cnl_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
-		hdmi_default_entry = n_hdmi_entries - 1;
+		cnl_get_buf_trans_hdmi(dev_priv, &n_entries);
+		default_entry = n_entries - 1;
 	} else if (IS_GEN9_LP(dev_priv)) {
-		bxt_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
-		hdmi_default_entry = n_hdmi_entries - 1;
+		bxt_get_buf_trans_hdmi(dev_priv, &n_entries);
+		default_entry = n_entries - 1;
 	} else if (IS_GEN9_BC(dev_priv)) {
-		intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
-		hdmi_default_entry = 8;
+		intel_ddi_get_buf_trans_hdmi(dev_priv, &n_entries);
+		default_entry = 8;
 	} else if (IS_BROADWELL(dev_priv)) {
-		intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
-		hdmi_default_entry = 7;
+		intel_ddi_get_buf_trans_hdmi(dev_priv, &n_entries);
+		default_entry = 7;
 	} else if (IS_HASWELL(dev_priv)) {
-		intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
-		hdmi_default_entry = 6;
+		intel_ddi_get_buf_trans_hdmi(dev_priv, &n_entries);
+		default_entry = 6;
 	} else {
 		WARN(1, "ddi translation table missing\n");
 		return 0;
 	}
 
 	/* Choose a good default if VBT is badly populated */
-	if (hdmi_level == HDMI_LEVEL_SHIFT_UNKNOWN ||
-	    hdmi_level >= n_hdmi_entries)
-		hdmi_level = hdmi_default_entry;
+	if (level == HDMI_LEVEL_SHIFT_UNKNOWN || level >= n_entries)
+		level = default_entry;
 
-	if (WARN_ON_ONCE(hdmi_level >= n_hdmi_entries))
-		hdmi_level = n_hdmi_entries - 1;
+	if (WARN_ON_ONCE(level >= n_entries))
+		level = n_entries - 1;
 
-	return hdmi_level;
+	return level;
 }
 
 /*
@@ -842,20 +839,20 @@ static void intel_prepare_dp_ddi_buffers(struct intel_encoder *encoder,
  * HDMI/DVI use cases.
  */
 static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder,
-					   int hdmi_level)
+					   int level)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	u32 iboost_bit = 0;
-	int n_hdmi_entries;
+	int n_entries;
 	enum port port = intel_ddi_get_encoder_port(encoder);
-	const struct ddi_buf_trans *ddi_translations_hdmi;
+	const struct ddi_buf_trans *ddi_translations;
 
-	ddi_translations_hdmi = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_hdmi_entries);
+	ddi_translations = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_entries);
 
-	if (WARN_ON_ONCE(!ddi_translations_hdmi))
+	if (WARN_ON_ONCE(!ddi_translations))
 		return;
-	if (WARN_ON_ONCE(hdmi_level >= n_hdmi_entries))
-		hdmi_level = n_hdmi_entries - 1;
+	if (WARN_ON_ONCE(level >= n_entries))
+		level = n_entries - 1;
 
 	/* If we're boosting the current, set bit 31 of trans1 */
 	if (IS_GEN9_BC(dev_priv) &&
@@ -864,9 +861,9 @@ static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder,
 
 	/* Entry 9 is for HDMI: */
 	I915_WRITE(DDI_BUF_TRANS_LO(port, 9),
-		   ddi_translations_hdmi[hdmi_level].trans1 | iboost_bit);
+		   ddi_translations[level].trans1 | iboost_bit);
 	I915_WRITE(DDI_BUF_TRANS_HI(port, 9),
-		   ddi_translations_hdmi[hdmi_level].trans2);
+		   ddi_translations[level].trans2);
 }
 
 static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,
@@ -1810,7 +1807,7 @@ static void _skl_ddi_set_iboost(struct drm_i915_private *dev_priv,
 }
 
 static void skl_ddi_set_iboost(struct intel_encoder *encoder,
-			       u32 level, int type)
+			       int level, int type)
 {
 	struct intel_digital_port *intel_dig_port = enc_to_dig_port(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(intel_dig_port->base.base.dev);
@@ -1913,7 +1910,7 @@ u8 intel_ddi_dp_voltage_max(struct intel_encoder *encoder)
 }
 
 static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
-				    u32 level, enum port port, int type)
+				   int level, enum port port, int type)
 {
 	const struct cnl_ddi_buf_trans *ddi_translations = NULL;
 	int n_entries, ln;
@@ -2070,7 +2067,7 @@ u32 bxt_signal_levels(struct intel_dp *intel_dp)
 	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
 	struct intel_encoder *encoder = &dport->base;
-	u32 level = intel_ddi_dp_level(intel_dp);
+	int level = intel_ddi_dp_level(intel_dp);
 
 	if (IS_CANNONLAKE(dev_priv))
 		cnl_ddi_vswing_sequence(encoder, level, encoder->type);
@@ -2085,7 +2082,7 @@ uint32_t ddi_signal_levels(struct intel_dp *intel_dp)
 	struct intel_digital_port *dport = dp_to_dig_port(intel_dp);
 	struct drm_i915_private *dev_priv = to_i915(dport->base.base.dev);
 	struct intel_encoder *encoder = &dport->base;
-	uint32_t level = intel_ddi_dp_level(intel_dp);
+	int level = intel_ddi_dp_level(intel_dp);
 
 	if (IS_GEN9_BC(dev_priv))
 		skl_ddi_set_iboost(encoder, level, encoder->type);
@@ -2158,7 +2155,7 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 	enum port port = intel_ddi_get_encoder_port(encoder);
 	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 	bool is_mst = intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST);
-	uint32_t level = intel_ddi_dp_level(intel_dp);
+	int level = intel_ddi_dp_level(intel_dp);
 
 	WARN_ON(is_mst && (port == PORT_A || port == PORT_E));
 
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 28/29] drm/i915: Replace most intel_ddi_get_encoder_port() alls with encoder->port
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (26 preceding siblings ...)
  2017-09-18 18:26 ` [PATCH 27/29] drm/i915: Clear up the types we use for DDI buf trans level/n_entries Ville Syrjala
@ 2017-09-18 18:26 ` Ville Syrjala
  2017-09-18 18:26 ` [PATCH 29/29] drm/i915: Pass a crtc state to ddi post_disable from MST code Ville Syrjala
                   ` (7 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:26 UTC (permalink / raw)
  To: intel-gfx

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

Most of the callers of intel_ddi_get_encoder_port() can just use
encoder->port directly instead of going through all these gynmastics.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 111289d6f44f..672ce1356545 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -807,7 +807,7 @@ static void intel_prepare_dp_ddi_buffers(struct intel_encoder *encoder,
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	u32 iboost_bit = 0;
 	int i, n_entries;
-	enum port port = intel_ddi_get_encoder_port(encoder);
+	enum port port = encoder->port;
 	const struct ddi_buf_trans *ddi_translations;
 
 	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_ANALOG))
@@ -844,7 +844,7 @@ static void intel_prepare_hdmi_ddi_buffers(struct intel_encoder *encoder,
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	u32 iboost_bit = 0;
 	int n_entries;
-	enum port port = intel_ddi_get_encoder_port(encoder);
+	enum port port = encoder->port;
 	const struct ddi_buf_trans *ddi_translations;
 
 	ddi_translations = intel_ddi_get_buf_trans_hdmi(dev_priv, &n_entries);
@@ -1455,7 +1455,7 @@ static void bxt_ddi_clock_get(struct intel_encoder *encoder,
 				struct intel_crtc_state *pipe_config)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	enum port port = intel_ddi_get_encoder_port(encoder);
+	enum port port = encoder->port;
 	uint32_t dpll = port;
 
 	pipe_config->port_clock = bxt_calc_pll_link(dev_priv, dpll);
@@ -1631,7 +1631,7 @@ bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct intel_encoder *encoder = intel_connector->encoder;
 	int type = intel_connector->base.connector_type;
-	enum port port = intel_ddi_get_encoder_port(encoder);
+	enum port port = encoder->port;
 	enum pipe pipe = 0;
 	enum transcoder cpu_transcoder;
 	uint32_t tmp;
@@ -1690,7 +1690,7 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
 {
 	struct drm_device *dev = encoder->base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	enum port port = intel_ddi_get_encoder_port(encoder);
+	enum port port = encoder->port;
 	u32 tmp;
 	int i;
 	bool ret;
@@ -1975,7 +1975,7 @@ static void cnl_ddi_vswing_sequence(struct intel_encoder *encoder,
 				    int level, int type)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	enum port port = intel_ddi_get_encoder_port(encoder);
+	enum port port = encoder->port;
 	int width, rate, ln;
 	u32 val;
 
@@ -2094,7 +2094,7 @@ static void intel_ddi_clk_select(struct intel_encoder *encoder,
 				 const struct intel_shared_dpll *pll)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	enum port port = intel_ddi_get_encoder_port(encoder);
+	enum port port = encoder->port;
 	uint32_t val;
 
 	if (WARN_ON(!pll))
@@ -2152,7 +2152,7 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
 {
 	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	enum port port = intel_ddi_get_encoder_port(encoder);
+	enum port port = encoder->port;
 	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 	bool is_mst = intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST);
 	int level = intel_ddi_dp_level(intel_dp);
@@ -2189,7 +2189,7 @@ static void intel_ddi_pre_enable_hdmi(struct intel_encoder *encoder,
 	struct intel_digital_port *intel_dig_port = enc_to_dig_port(&encoder->base);
 	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	enum port port = intel_ddi_get_encoder_port(encoder);
+	enum port port = encoder->port;
 	int level = intel_ddi_hdmi_level(dev_priv, port);
 	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 
@@ -2633,7 +2633,7 @@ static bool intel_ddi_compute_config(struct intel_encoder *encoder,
 				     struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	int port = intel_ddi_get_encoder_port(encoder);
+	enum port port = encoder->port;
 	int ret;
 
 	if (port == PORT_A)
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 29/29] drm/i915: Pass a crtc state to ddi post_disable from MST code
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (27 preceding siblings ...)
  2017-09-18 18:26 ` [PATCH 28/29] drm/i915: Replace most intel_ddi_get_encoder_port() alls with encoder->port Ville Syrjala
@ 2017-09-18 18:26 ` Ville Syrjala
  2017-09-18 19:02   ` Jani Nikula
  2017-09-18 19:04 ` [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Jani Nikula
                   ` (6 subsequent siblings)
  35 siblings, 1 reply; 58+ messages in thread
From: Ville Syrjala @ 2017-09-18 18:26 UTC (permalink / raw)
  To: intel-gfx

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

Pass an old crtc state to intel_ddi_post_disable() from the MST code.

Note that this crtc state won't necessaitly match the one that was
passed to intel_ddi_pre_enable() if the first stream to be enabled isn't
the last stream to be disabled. But this is fine since the states should
be identical in every important way. This does mean people frobbing
the DDI pre_enable/post_disable hooks have to pay attention in what
parts of the state they consult.

The alternative would be to inline the relevant code into the MST code.
That is actually what we used to do for pre_enable before
commit e081c8463ac9 ("drm/i915: Remove duplicate DDI enabling logic
from MST path"). For post_disable we've always called the DDI hook.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c    | 4 +---
 drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 672ce1356545..5d043a320f99 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2290,9 +2290,7 @@ static void intel_ddi_post_disable(struct intel_encoder *encoder,
 				   const struct intel_crtc_state *old_crtc_state,
 				   const struct drm_connector_state *old_conn_state)
 {
-	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
-	if (old_crtc_state &&
-	    intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
+	if (intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
 		intel_ddi_post_disable_hdmi(encoder,
 					    old_crtc_state, old_conn_state);
 	else
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
index 8e3aad0ea60b..cb01d0dc46cd 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -169,7 +169,7 @@ static void intel_mst_post_disable_dp(struct intel_encoder *encoder,
 	intel_mst->connector = NULL;
 	if (intel_dp->active_mst_links == 0) {
 		intel_dig_port->base.post_disable(&intel_dig_port->base,
-						  NULL, NULL);
+						  old_crtc_state, NULL);
 
 		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
 	}
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* Re: [PATCH 01/29] drm/i915: Replace some spaces with tabs
  2017-09-18 18:25 ` [PATCH 01/29] drm/i915: Replace some spaces with tabs Ville Syrjala
@ 2017-09-18 18:38   ` Chris Wilson
  2017-09-18 18:53   ` Jani Nikula
  1 sibling, 0 replies; 58+ messages in thread
From: Chris Wilson @ 2017-09-18 18:38 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2017-09-18 19:25:36)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Some comments in intel_ddi.c are indented with spaces instead of tabs.
> Fix that up.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 03/29] drm/i915: Shrink cnl_ddi_buf_trans
  2017-09-18 18:25 ` [PATCH 03/29] drm/i915: Shrink cnl_ddi_buf_trans Ville Syrjala
@ 2017-09-18 18:39   ` Chris Wilson
  2017-09-18 18:40   ` Chris Wilson
  1 sibling, 0 replies; 58+ messages in thread
From: Chris Wilson @ 2017-09-18 18:39 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2017-09-18 19:25:38)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> All the values we put into the CNL buf_trans tables fit into 8 bits.
> So switch over to u8 from the u32 we use currently.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 03/29] drm/i915: Shrink cnl_ddi_buf_trans
  2017-09-18 18:25 ` [PATCH 03/29] drm/i915: Shrink cnl_ddi_buf_trans Ville Syrjala
  2017-09-18 18:39   ` Chris Wilson
@ 2017-09-18 18:40   ` Chris Wilson
  2017-09-18 19:02     ` Chris Wilson
  1 sibling, 1 reply; 58+ messages in thread
From: Chris Wilson @ 2017-09-18 18:40 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2017-09-18 19:25:38)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> All the values we put into the CNL buf_trans tables fit into 8 bits.
> So switch over to u8 from the u32 we use currently.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 04/29] drm/i915: Dump 'output_types' in crtc state dump
  2017-09-18 18:25 ` [PATCH 04/29] drm/i915: Dump 'output_types' in crtc state dump Ville Syrjala
@ 2017-09-18 18:43   ` Chris Wilson
  2017-09-18 18:56     ` Ville Syrjälä
  2017-09-18 18:54   ` Jani Nikula
  2017-09-20 14:03   ` [PATCH v2 " Ville Syrjala
  2 siblings, 1 reply; 58+ messages in thread
From: Chris Wilson @ 2017-09-18 18:43 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2017-09-18 19:25:39)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> To make it easier to debug things let's dump the output types bitmask in
> the crtc state dump. And to make life that much better, let's pretty
> print it as a a human reaadable string as well.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 50 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 8599e425abb1..192b07a92e76 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10683,6 +10683,53 @@ intel_dump_m_n_config(struct intel_crtc_state *pipe_config, char *id,
>                       m_n->link_m, m_n->link_n, m_n->tu);
>  }
>  
> +#define OUTPUT_TYPE(x) [INTEL_OUTPUT_ ## x] = #x
> +
> +static const char * const output_type_str[] = {
> +       OUTPUT_TYPE(UNUSED),
> +       OUTPUT_TYPE(ANALOG),
> +       OUTPUT_TYPE(DVO),
> +       OUTPUT_TYPE(SDVO),
> +       OUTPUT_TYPE(LVDS),
> +       OUTPUT_TYPE(TVOUT),
> +       OUTPUT_TYPE(HDMI),
> +       OUTPUT_TYPE(DP),
> +       OUTPUT_TYPE(EDP),
> +       OUTPUT_TYPE(DSI),
> +       OUTPUT_TYPE(UNKNOWN),
> +       OUTPUT_TYPE(DP_MST),
> +};
> +
> +static const char *output_types_str(unsigned int output_types)
> +{
> +       static char buf[64];

Bleh. Push to caller?

> +       size_t len = sizeof(buf);
> +       char *str = buf;
> +       int i;
> +
> +       str[0] = '\0';
> +
> +       for (i = 0; i < ARRAY_SIZE(output_type_str); i++) {
> +               int r;
> +
> +               if ((output_types & BIT(i)) == 0)
> +                       continue;
> +
> +               r = snprintf(str, len, "%s%s",
> +                            str != buf ? "," : "", output_type_str[i]);

No space after the comma? Heathen.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 05/29] drm/i915: Extract intel_ddi_clk_disable()
  2017-09-18 18:25 ` [PATCH 05/29] drm/i915: Extract intel_ddi_clk_disable() Ville Syrjala
@ 2017-09-18 18:45   ` Chris Wilson
  2017-09-18 19:09     ` Ville Syrjälä
  0 siblings, 1 reply; 58+ messages in thread
From: Chris Wilson @ 2017-09-18 18:45 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Ville Syrjala (2017-09-18 19:25:40)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Pull the code to disable the port clock into a function. We already have
> the intel_ddi_clk_select() counterpart.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 24 ++++++++++++++++--------
>  1 file changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 93cbbcbbc193..2b4de7d03ff0 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2131,6 +2131,21 @@ static void intel_ddi_clk_select(struct intel_encoder *encoder,
>         }
>  }
>  
> +static void intel_ddi_clk_disable(struct intel_encoder *encoder)
> +{
> +       struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> +       enum port port = encoder->port;

port was previously intel_ddi_get_encoder_port(encoder).

> +
> +       if (IS_CANNONLAKE(dev_priv))
> +               I915_WRITE(DPCLKA_CFGCR0, I915_READ(DPCLKA_CFGCR0) |
> +                          DPCLKA_CFGCR0_DDI_CLK_OFF(port));
> +       else if (IS_GEN9_BC(dev_priv))
> +               I915_WRITE(DPLL_CTRL2, I915_READ(DPLL_CTRL2) |
> +                          DPLL_CTRL2_DDI_CLK_OFF(port));
> +       else if (INTEL_GEN(dev_priv) < 9)
> +               I915_WRITE(PORT_CLK_SEL(port), PORT_CLK_SEL_NONE);
> +}
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 01/29] drm/i915: Replace some spaces with tabs
  2017-09-18 18:25 ` [PATCH 01/29] drm/i915: Replace some spaces with tabs Ville Syrjala
  2017-09-18 18:38   ` Chris Wilson
@ 2017-09-18 18:53   ` Jani Nikula
  1 sibling, 0 replies; 58+ messages in thread
From: Jani Nikula @ 2017-09-18 18:53 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

On Mon, 18 Sep 2017, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Some comments in intel_ddi.c are indented with spaces instead of tabs.
> Fix that up.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 31d14587ad86..797008033089 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1939,7 +1939,7 @@ static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
>  	val |= RCOMP_SCALAR(0x98);
>  	I915_WRITE(CNL_PORT_TX_DW2_GRP(port), val);
>  
> -        /* Program PORT_TX_DW4 */
> +	/* Program PORT_TX_DW4 */
>  	/* We cannot write to GRP. It would overrite individual loadgen */
>  	for (ln = 0; ln < 4; ln++) {
>  		val = I915_READ(CNL_PORT_TX_DW4_LN(port, ln));
> @@ -1951,7 +1951,7 @@ static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
>  		I915_WRITE(CNL_PORT_TX_DW4_LN(port, ln), val);
>  	}
>  
> -        /* Program PORT_TX_DW5 */
> +	/* Program PORT_TX_DW5 */
>  	/* All DW5 values are fixed for every table entry */
>  	val = I915_READ(CNL_PORT_TX_DW5_LN0(port));
>  	val &= ~RTERM_SELECT_MASK;
> @@ -1959,7 +1959,7 @@ static void cnl_ddi_vswing_program(struct drm_i915_private *dev_priv,
>  	val |= TAP3_DISABLE;
>  	I915_WRITE(CNL_PORT_TX_DW5_GRP(port), val);
>  
> -        /* Program PORT_TX_DW7 */
> +	/* Program PORT_TX_DW7 */
>  	val = I915_READ(CNL_PORT_TX_DW7_LN0(port));
>  	val &= ~N_SCALAR_MASK;
>  	val |= N_SCALAR(ddi_translations[level].dw7_n_scalar);

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 02/29] drm/i915: Shrink bxt_ddi_buf_trans
  2017-09-18 18:25 ` [PATCH 02/29] drm/i915: Shrink bxt_ddi_buf_trans Ville Syrjala
@ 2017-09-18 18:54   ` Jani Nikula
  0 siblings, 0 replies; 58+ messages in thread
From: Jani Nikula @ 2017-09-18 18:54 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

On Mon, 18 Sep 2017, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> All the values we put into the BXT buf_trans tables fit into 8 bits.
> So switch over to u8 from the u32 we use currently.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 797008033089..5c709985904e 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -301,10 +301,10 @@ static const struct ddi_buf_trans skl_y_ddi_translations_hdmi[] = {
>  };
>  
>  struct bxt_ddi_buf_trans {
> -	u32 margin;	/* swing value */
> -	u32 scale;	/* scale value */
> -	u32 enable;	/* scale enable */
> -	u32 deemphasis;
> +	u8 margin;	/* swing value */
> +	u8 scale;	/* scale value */
> +	u8 enable;	/* scale enable */
> +	u8 deemphasis;
>  	bool default_index; /* true if the entry represents default value */
>  };

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 04/29] drm/i915: Dump 'output_types' in crtc state dump
  2017-09-18 18:25 ` [PATCH 04/29] drm/i915: Dump 'output_types' in crtc state dump Ville Syrjala
  2017-09-18 18:43   ` Chris Wilson
@ 2017-09-18 18:54   ` Jani Nikula
  2017-09-20 14:03   ` [PATCH v2 " Ville Syrjala
  2 siblings, 0 replies; 58+ messages in thread
From: Jani Nikula @ 2017-09-18 18:54 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

On Mon, 18 Sep 2017, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> To make it easier to debug things let's dump the output types bitmask in
> the crtc state dump. And to make life that much better, let's pretty
> print it as a a human reaadable string as well.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_display.c | 50 ++++++++++++++++++++++++++++++++++++
>  1 file changed, 50 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 8599e425abb1..192b07a92e76 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -10683,6 +10683,53 @@ intel_dump_m_n_config(struct intel_crtc_state *pipe_config, char *id,
>  		      m_n->link_m, m_n->link_n, m_n->tu);
>  }
>  
> +#define OUTPUT_TYPE(x) [INTEL_OUTPUT_ ## x] = #x
> +
> +static const char * const output_type_str[] = {
> +	OUTPUT_TYPE(UNUSED),
> +	OUTPUT_TYPE(ANALOG),
> +	OUTPUT_TYPE(DVO),
> +	OUTPUT_TYPE(SDVO),
> +	OUTPUT_TYPE(LVDS),
> +	OUTPUT_TYPE(TVOUT),
> +	OUTPUT_TYPE(HDMI),
> +	OUTPUT_TYPE(DP),
> +	OUTPUT_TYPE(EDP),
> +	OUTPUT_TYPE(DSI),
> +	OUTPUT_TYPE(UNKNOWN),
> +	OUTPUT_TYPE(DP_MST),
> +};
> +

#undef OUTPUT_TYPE

> +static const char *output_types_str(unsigned int output_types)
> +{
> +	static char buf[64];
> +	size_t len = sizeof(buf);
> +	char *str = buf;
> +	int i;
> +
> +	str[0] = '\0';
> +
> +	for (i = 0; i < ARRAY_SIZE(output_type_str); i++) {
> +		int r;
> +
> +		if ((output_types & BIT(i)) == 0)
> +			continue;
> +
> +		r = snprintf(str, len, "%s%s",
> +			     str != buf ? "," : "", output_type_str[i]);
> +		if (r >= len)
> +			break;
> +		str += r;
> +		len -= r;
> +
> +		output_types &= ~BIT(i);
> +	}
> +
> +	WARN_ON_ONCE(output_types != 0);
> +
> +	return buf;
> +}
> +
>  static void intel_dump_pipe_config(struct intel_crtc *crtc,
>  				   struct intel_crtc_state *pipe_config,
>  				   const char *context)
> @@ -10696,6 +10743,9 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
>  
>  	DRM_DEBUG_KMS("[CRTC:%d:%s]%s\n",
>  		      crtc->base.base.id, crtc->base.name, context);
> +	DRM_DEBUG_KMS("output_types: %s (0x%x)\n",
> +		      output_types_str(pipe_config->output_types),
> +		      pipe_config->output_types);
>  
>  	DRM_DEBUG_KMS("cpu_transcoder: %s, pipe bpp: %i, dithering: %i\n",
>  		      transcoder_name(pipe_config->cpu_transcoder),

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 06/29] drm/i915: Extract intel_disable_ddi_buf()
  2017-09-18 18:25 ` [PATCH 06/29] drm/i915: Extract intel_disable_ddi_buf() Ville Syrjala
@ 2017-09-18 18:55   ` Jani Nikula
  0 siblings, 0 replies; 58+ messages in thread
From: Jani Nikula @ 2017-09-18 18:55 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

On Mon, 18 Sep 2017, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Extract the code to disable the DDI_BUF_CTL into small helper. This
> will allows us to detangle the encoder type mess in
> intel_ddi_post_disable().
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 41 +++++++++++++++++++++++-----------------
>  1 file changed, 24 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 2b4de7d03ff0..2dbbd47665de 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2238,25 +2238,12 @@ static void intel_ddi_pre_enable(struct intel_encoder *encoder,
>  	}
>  }
>  
> -static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,
> -				   const struct intel_crtc_state *old_crtc_state,
> -				   const struct drm_connector_state *old_conn_state)
> +static void intel_disable_ddi_buf(struct intel_encoder *encoder)
>  {
> -	struct drm_encoder *encoder = &intel_encoder->base;
> -	struct drm_i915_private *dev_priv = to_i915(encoder->dev);
> -	enum port port = intel_ddi_get_encoder_port(intel_encoder);
> -	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
> -	int type = intel_encoder->type;
> -	uint32_t val;
> +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> +	enum port port = encoder->port;
>  	bool wait = false;
> -
> -	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
> -
> -	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP) {
> -		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
> -
> -		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
> -	}
> +	u32 val;
>  
>  	val = I915_READ(DDI_BUF_CTL(port));
>  	if (val & DDI_BUF_CTL_ENABLE) {
> @@ -2272,6 +2259,26 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,
>  
>  	if (wait)
>  		intel_wait_ddi_buf_idle(dev_priv, port);
> +}
> +
> +static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,
> +				   const struct intel_crtc_state *old_crtc_state,
> +				   const struct drm_connector_state *old_conn_state)
> +{
> +	struct drm_encoder *encoder = &intel_encoder->base;
> +	struct drm_i915_private *dev_priv = to_i915(encoder->dev);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
> +	int type = intel_encoder->type;
> +
> +	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
> +
> +	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP) {
> +		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
> +
> +		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
> +	}
> +
> +	intel_disable_ddi_buf(intel_encoder);
>  
>  	if (type == INTEL_OUTPUT_HDMI) {
>  		dig_port->set_infoframes(encoder, false,

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 07/29] drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable()
  2017-09-18 18:25 ` [PATCH 07/29] drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable() Ville Syrjala
@ 2017-09-18 18:55   ` Jani Nikula
  0 siblings, 0 replies; 58+ messages in thread
From: Jani Nikula @ 2017-09-18 18:55 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

On Mon, 18 Sep 2017, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> To untangle the mess that is intel_ddi_post_disable() move the the bits
> needed by FDI into intel_ddi_fdi_post_disable(). This way we can stop
> worrying about FDI in intel_ddi_post_disable().
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 2dbbd47665de..bbb08c6f0bba 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2321,7 +2321,8 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *encoder,
>  	val &= ~FDI_RX_ENABLE;
>  	I915_WRITE(FDI_RX_CTL(PIPE_A), val);
>  
> -	intel_ddi_post_disable(encoder, old_crtc_state, old_conn_state);
> +	intel_disable_ddi_buf(encoder);
> +	intel_ddi_clk_disable(encoder);
>  
>  	val = I915_READ(FDI_RX_MISC(PIPE_A));
>  	val &= ~(FDI_RX_PWRDN_LANE1_MASK | FDI_RX_PWRDN_LANE0_MASK);

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 08/29] drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants
  2017-09-18 18:25 ` [PATCH 08/29] drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants Ville Syrjala
@ 2017-09-18 18:56   ` Jani Nikula
  0 siblings, 0 replies; 58+ messages in thread
From: Jani Nikula @ 2017-09-18 18:56 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

On Mon, 18 Sep 2017, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> To clean up the mess in intel_ddi_post_disable() split it into two
> clean variants for HDMI and DP.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 69 +++++++++++++++++++++++-----------------
>  1 file changed, 40 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index bbb08c6f0bba..c38cbdc87545 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2261,47 +2261,58 @@ static void intel_disable_ddi_buf(struct intel_encoder *encoder)
>  		intel_wait_ddi_buf_idle(dev_priv, port);
>  }
>  
> -static void intel_ddi_post_disable(struct intel_encoder *intel_encoder,
> -				   const struct intel_crtc_state *old_crtc_state,
> -				   const struct drm_connector_state *old_conn_state)
> +static void intel_ddi_post_disable_dp(struct intel_encoder *encoder,
> +				      const struct intel_crtc_state *old_crtc_state,
> +				      const struct drm_connector_state *old_conn_state)
>  {
> -	struct drm_encoder *encoder = &intel_encoder->base;
> -	struct drm_i915_private *dev_priv = to_i915(encoder->dev);
> -	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
> -	int type = intel_encoder->type;
> +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
> +	struct intel_dp *intel_dp = &dig_port->dp;
>  
> -	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
> +	intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
>  
> -	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP) {
> -		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
> +	intel_disable_ddi_buf(encoder);
>  
> -		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
> -	}
> +	intel_edp_panel_vdd_on(intel_dp);
> +	intel_edp_panel_off(intel_dp);
>  
> -	intel_disable_ddi_buf(intel_encoder);
> +	intel_display_power_put(dev_priv, dig_port->ddi_io_power_domain);
>  
> -	if (type == INTEL_OUTPUT_HDMI) {
> -		dig_port->set_infoframes(encoder, false,
> -					 old_crtc_state, old_conn_state);
> -	}
> +	intel_ddi_clk_disable(encoder);
> +}
>  
> -	if (type == INTEL_OUTPUT_DP || type == INTEL_OUTPUT_EDP) {
> -		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
> +static void intel_ddi_post_disable_hdmi(struct intel_encoder *encoder,
> +					const struct intel_crtc_state *old_crtc_state,
> +					const struct drm_connector_state *old_conn_state)
> +{
> +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
> +	struct intel_hdmi *intel_hdmi = &dig_port->hdmi;
>  
> -		intel_edp_panel_vdd_on(intel_dp);
> -		intel_edp_panel_off(intel_dp);
> -	}
> +	intel_disable_ddi_buf(encoder);
>  
> -	if (dig_port)
> -		intel_display_power_put(dev_priv, dig_port->ddi_io_power_domain);
> +	dig_port->set_infoframes(&encoder->base, false,
> +				 old_crtc_state, old_conn_state);
>  
> -	intel_ddi_clk_disable(intel_encoder);
> +	intel_display_power_put(dev_priv, dig_port->ddi_io_power_domain);
>  
> -	if (type == INTEL_OUTPUT_HDMI) {
> -		struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
> +	intel_ddi_clk_disable(encoder);
>  
> -		intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
> -	}
> +	intel_dp_dual_mode_set_tmds_output(intel_hdmi, false);
> +}
> +
> +static void intel_ddi_post_disable(struct intel_encoder *encoder,
> +				   const struct intel_crtc_state *old_crtc_state,
> +				   const struct drm_connector_state *old_conn_state)
> +{
> +	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
> +	if (old_crtc_state &&
> +	    intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
> +		intel_ddi_post_disable_hdmi(encoder,
> +					    old_crtc_state, old_conn_state);
> +	else
> +		intel_ddi_post_disable_dp(encoder,
> +					  old_crtc_state, old_conn_state);
>  }
>  
>  void intel_ddi_fdi_post_disable(struct intel_encoder *encoder,

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 09/29] drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp()
  2017-09-18 18:25 ` [PATCH 09/29] drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp() Ville Syrjala
@ 2017-09-18 18:56   ` Jani Nikula
  0 siblings, 0 replies; 58+ messages in thread
From: Jani Nikula @ 2017-09-18 18:56 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

On Mon, 18 Sep 2017, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> intel_edp_panel_on() will itself do the is_edp() check, so the caller
> doesn't have to bother. Pre-DDI code doesn't bother, so let's follow the
> same approach for DDI.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index c38cbdc87545..a3e579ee9962 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2161,8 +2161,8 @@ static void intel_ddi_pre_enable_dp(struct intel_encoder *encoder,
>  
>  	intel_dp_set_link_params(intel_dp, link_rate, lane_count,
>  				 link_mst);
> -	if (encoder->type == INTEL_OUTPUT_EDP)
> -		intel_edp_panel_on(intel_dp);
> +
> +	intel_edp_panel_on(intel_dp);
>  
>  	intel_ddi_clk_select(encoder, pll);

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 04/29] drm/i915: Dump 'output_types' in crtc state dump
  2017-09-18 18:43   ` Chris Wilson
@ 2017-09-18 18:56     ` Ville Syrjälä
  0 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjälä @ 2017-09-18 18:56 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Mon, Sep 18, 2017 at 07:43:43PM +0100, Chris Wilson wrote:
> Quoting Ville Syrjala (2017-09-18 19:25:39)
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > To make it easier to debug things let's dump the output types bitmask in
> > the crtc state dump. And to make life that much better, let's pretty
> > print it as a a human reaadable string as well.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 50 ++++++++++++++++++++++++++++++++++++
> >  1 file changed, 50 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 8599e425abb1..192b07a92e76 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -10683,6 +10683,53 @@ intel_dump_m_n_config(struct intel_crtc_state *pipe_config, char *id,
> >                       m_n->link_m, m_n->link_n, m_n->tu);
> >  }
> >  
> > +#define OUTPUT_TYPE(x) [INTEL_OUTPUT_ ## x] = #x
> > +
> > +static const char * const output_type_str[] = {
> > +       OUTPUT_TYPE(UNUSED),
> > +       OUTPUT_TYPE(ANALOG),
> > +       OUTPUT_TYPE(DVO),
> > +       OUTPUT_TYPE(SDVO),
> > +       OUTPUT_TYPE(LVDS),
> > +       OUTPUT_TYPE(TVOUT),
> > +       OUTPUT_TYPE(HDMI),
> > +       OUTPUT_TYPE(DP),
> > +       OUTPUT_TYPE(EDP),
> > +       OUTPUT_TYPE(DSI),
> > +       OUTPUT_TYPE(UNKNOWN),
> > +       OUTPUT_TYPE(DP_MST),
> > +};
> > +
> > +static const char *output_types_str(unsigned int output_types)
> > +{
> > +       static char buf[64];
> 
> Bleh. Push to caller?

It's a debug thing so I wasn't too worried about making it entirely
robust. But I guess these things tend to come back and bite us
later, so with that in mind I can respin this to use a caller
provided buffer.

> > +       size_t len = sizeof(buf);
> > +       char *str = buf;
> > +       int i;
> > +
> > +       str[0] = '\0';
> > +
> > +       for (i = 0; i < ARRAY_SIZE(output_type_str); i++) {
> > +               int r;
> > +
> > +               if ((output_types & BIT(i)) == 0)
> > +                       continue;
> > +
> > +               r = snprintf(str, len, "%s%s",
> > +                            str != buf ? "," : "", output_type_str[i]);
> 
> No space after the comma? Heathen.

I had it there originally, but it looked a bit weird to me when I had
more than one bit set. I think the problem is that we alrady use a
comma for separating different pieces of state when we print them on
the same line. And so not having a space in there makes it more
clear that these things are in fact part of the same piece of state.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 29/29] drm/i915: Pass a crtc state to ddi post_disable from MST code
  2017-09-18 18:26 ` [PATCH 29/29] drm/i915: Pass a crtc state to ddi post_disable from MST code Ville Syrjala
@ 2017-09-18 19:02   ` Jani Nikula
  0 siblings, 0 replies; 58+ messages in thread
From: Jani Nikula @ 2017-09-18 19:02 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

On Mon, 18 Sep 2017, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Pass an old crtc state to intel_ddi_post_disable() from the MST code.
>
> Note that this crtc state won't necessaitly match the one that was
> passed to intel_ddi_pre_enable() if the first stream to be enabled isn't
> the last stream to be disabled. But this is fine since the states should
> be identical in every important way. This does mean people frobbing
> the DDI pre_enable/post_disable hooks have to pay attention in what
> parts of the state they consult.

I wouldn't mind having some comments about this sprinkled here and
there, independent of this patch...

BR,
Jani.



>
> The alternative would be to inline the relevant code into the MST code.
> That is actually what we used to do for pre_enable before
> commit e081c8463ac9 ("drm/i915: Remove duplicate DDI enabling logic
> from MST path"). For post_disable we've always called the DDI hook.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_ddi.c    | 4 +---
>  drivers/gpu/drm/i915/intel_dp_mst.c | 2 +-
>  2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 672ce1356545..5d043a320f99 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -2290,9 +2290,7 @@ static void intel_ddi_post_disable(struct intel_encoder *encoder,
>  				   const struct intel_crtc_state *old_crtc_state,
>  				   const struct drm_connector_state *old_conn_state)
>  {
> -	/* old_crtc_state and old_conn_state are NULL when called from DP_MST */
> -	if (old_crtc_state &&
> -	    intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
> +	if (intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
>  		intel_ddi_post_disable_hdmi(encoder,
>  					    old_crtc_state, old_conn_state);
>  	else
> diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> index 8e3aad0ea60b..cb01d0dc46cd 100644
> --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> @@ -169,7 +169,7 @@ static void intel_mst_post_disable_dp(struct intel_encoder *encoder,
>  	intel_mst->connector = NULL;
>  	if (intel_dp->active_mst_links == 0) {
>  		intel_dig_port->base.post_disable(&intel_dig_port->base,
> -						  NULL, NULL);
> +						  old_crtc_state, NULL);
>  
>  		intel_dp_sink_dpms(intel_dp, DRM_MODE_DPMS_OFF);
>  	}

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 03/29] drm/i915: Shrink cnl_ddi_buf_trans
  2017-09-18 18:40   ` Chris Wilson
@ 2017-09-18 19:02     ` Chris Wilson
  0 siblings, 0 replies; 58+ messages in thread
From: Chris Wilson @ 2017-09-18 19:02 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

Quoting Chris Wilson (2017-09-18 19:40:45)
> Quoting Ville Syrjala (2017-09-18 19:25:38)
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > All the values we put into the CNL buf_trans tables fit into 8 bits.
> > So switch over to u8 from the u32 we use currently.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

One of these r-b was meant for the previous u32 -> u8 patch.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (28 preceding siblings ...)
  2017-09-18 18:26 ` [PATCH 29/29] drm/i915: Pass a crtc state to ddi post_disable from MST code Ville Syrjala
@ 2017-09-18 19:04 ` Jani Nikula
  2017-09-18 19:46 ` ✗ Fi.CI.BAT: failure for " Patchwork
                   ` (5 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Jani Nikula @ 2017-09-18 19:04 UTC (permalink / raw)
  To: Ville Syrjala, intel-gfx

On Mon, 18 Sep 2017, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> This series aims to eliminate the DDI encoder->type shenanigans.
> Afterwards encoder->type will permanently be "DDI" for DDI DP/HDMI
> ports, and "EDP" for DDI eDP ports. To figure out in which mode
> we want to drive the port we use the output_types bitmask, which
> for DDI will be computed by the new .compute_output_type() encoder
> hook.
>
> Originally (some years ago?) I simply planned to avoid this role 
> switching for the DDI encoders by splitting each encoders into two
> two separate instances (which is how the pre-DDI platforms work).
> I even posted a patch series achieving this. But the series didn't
> land before LSPCON happened and at that point I figured that we
> actually might want to switch the encoder mode as needed. So I
> came up with this alternative apporach (and introduced the
> output_types bitmask). Unfortunately I never managed to land the
> remaining bits.
>
> Having a single encoder per DDI port does have the benefit of
> giving userspace a hint that there's no way to enable both the DP
> and HDMI connectors handing off it at the same time. With pre-DDI
> platforms userspace has no idea which connectors are tied to the
> same port. So one might argue that this is indeed the better
> approach.
>
> Since I last posted this stuff a lot has changed in the DDI code
> (BXT and CNL at least, can't recall if SKL was a thing when
> I originally posted this stuff). So this series actually turned
> out into a rather massive "clean up DDI" series. I regret it
> ending up this big, but I don't think I want to start spliting
> it up at this point. So I'll just offer my apologies and post
> the series as is. The patches shouldn't be too tricky to read
> since it's basically just refactoring all over.

I reviewed the ones I replied to, maybe I'll continue when I'm less X_x.

But I glanced over the rest, and, FWIW, the series is

Acked-by: Jani Nikula <jani.nikula@intel.com>


>
> Entire series is available here:
> git://github.com/vsyrjala/linux.git ddi_output_types
>
> Ville Syrjälä (29):
>   drm/i915: Replace some spaces with tabs
>   drm/i915: Shrink bxt_ddi_buf_trans
>   drm/i915: Shrink cnl_ddi_buf_trans
>   drm/i915: Dump 'output_types' in crtc state dump
>   drm/i915: Extract intel_ddi_clk_disable()
>   drm/i915: Extract intel_disable_ddi_buf()
>   drm/i915: Inline the required bits of intel_ddi_post_disable() into
>     intel_ddi_fdi_post_disable()
>   drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants
>   drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp()
>   drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants
>   drm/i915: Plump crtc_state etc. directly to
>     intel_ddi_pre_enable_{dp,hdmi}()
>   drm/i915: Split intel_enable_ddi() into DP and HDMI variants
>   drm/i915: Relocate intel_ddi_get_buf_trans_*() functions
>   drm/i915: Extract intel_ddi_get_buf_trans_hdmi()
>   drm/i915: Pass the encoder type explicitly to skl_set_iboost()
>   drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers()
>   drm/i915: Integrate BXT into intel_ddi_dp_voltage_max()
>   drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly
>   drm/i915: Kill off the BXT buf_trans default_index
>   drm/i915: Don't use encoder->type in intel_ddi_set_pipe_settings()
>   drm/i915: Pass crtc state to intel_prepare_dp_ddi_buffers()
>   drm/i915: Start using output_types for DPLL selection
>   drm/i915: Stop using encoder->type in
>     intel_ddi_enable_transcoder_func()
>   drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling
>   drm/i915: Stop frobbing with DDI encoder->type
>   drm/i915: Unify error handling for missing DDI buf trans tables
>   drm/i915: Clear up the types we use for DDI buf trans level/n_entries
>   drm/i915: Replace most intel_ddi_get_encoder_port() alls with
>     encoder->port
>   drm/i915: Pass a crtc state to ddi post_disable from MST code
>
>  drivers/gpu/drm/i915/i915_debugfs.c   |   2 +-
>  drivers/gpu/drm/i915/intel_ddi.c      | 973 ++++++++++++++++++----------------
>  drivers/gpu/drm/i915/intel_display.c  |  59 ++-
>  drivers/gpu/drm/i915/intel_dp.c       |  19 +-
>  drivers/gpu/drm/i915/intel_dp_mst.c   |   2 +-
>  drivers/gpu/drm/i915/intel_dpll_mgr.c |  36 +-
>  drivers/gpu/drm/i915/intel_drv.h      |   7 +-
>  drivers/gpu/drm/i915/intel_hdmi.c     |  10 +-
>  drivers/gpu/drm/i915/intel_opregion.c |   2 +-
>  9 files changed, 603 insertions(+), 507 deletions(-)

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 05/29] drm/i915: Extract intel_ddi_clk_disable()
  2017-09-18 18:45   ` Chris Wilson
@ 2017-09-18 19:09     ` Ville Syrjälä
  0 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjälä @ 2017-09-18 19:09 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Mon, Sep 18, 2017 at 07:45:14PM +0100, Chris Wilson wrote:
> Quoting Ville Syrjala (2017-09-18 19:25:40)
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Pull the code to disable the port clock into a function. We already have
> > the intel_ddi_clk_select() counterpart.
> > 
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_ddi.c | 24 ++++++++++++++++--------
> >  1 file changed, 16 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> > index 93cbbcbbc193..2b4de7d03ff0 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -2131,6 +2131,21 @@ static void intel_ddi_clk_select(struct intel_encoder *encoder,
> >         }
> >  }
> >  
> > +static void intel_ddi_clk_disable(struct intel_encoder *encoder)
> > +{
> > +       struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> > +       enum port port = encoder->port;
> 
> port was previously intel_ddi_get_encoder_port(encoder).

encoder->port is fine in this case. The main two reasons for
the existence of intel_ddi_get_encoder_port() were FDI and MST.

The FDI problem disappeared as soon as we got encoder->port.
Previously we only had dig_port->port, and FDI doesn't have a
dig_port. In fact we should try to eliminate dig_port->port since
it's redundant now.

Hmm. And we even populate encoder->port for the fake MST encoders
so even that shouldn't pose a problem anymore. But in this case
we actually get passed the "real" DP encoder (ie. mst->primary)
so even if encoder->port wasn't populated for the fake MST encoders
this would still work.

I have another patch in the series to convert a lot more
intel_ddi_get_encoder_port()s into encoder->port. But that patch
is near the end, and apparently I already converted some of them
along the way.

I guess I should at leaast add some notes to the commit messages
whenever I'm doing this.

> 
> > +
> > +       if (IS_CANNONLAKE(dev_priv))
> > +               I915_WRITE(DPCLKA_CFGCR0, I915_READ(DPCLKA_CFGCR0) |
> > +                          DPCLKA_CFGCR0_DDI_CLK_OFF(port));
> > +       else if (IS_GEN9_BC(dev_priv))
> > +               I915_WRITE(DPLL_CTRL2, I915_READ(DPLL_CTRL2) |
> > +                          DPLL_CTRL2_DDI_CLK_OFF(port));
> > +       else if (INTEL_GEN(dev_priv) < 9)
> > +               I915_WRITE(PORT_CLK_SEL(port), PORT_CLK_SEL_NONE);
> > +}

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (29 preceding siblings ...)
  2017-09-18 19:04 ` [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Jani Nikula
@ 2017-09-18 19:46 ` Patchwork
  2017-09-20 14:26 ` ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev2) Patchwork
                   ` (4 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Patchwork @ 2017-09-18 19:46 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Eliminate DDI encoder->type frobbery redux
URL   : https://patchwork.freedesktop.org/series/30548/
State : failure

== Summary ==

Series 30548v1 drm/i915: Eliminate DDI encoder->type frobbery redux
https://patchwork.freedesktop.org/api/1.0/series/30548/revisions/1/mbox/

Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> INCOMPLETE (fi-bxt-j4205)
                pass       -> INCOMPLETE (fi-glk-2a) fdo#102456
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                pass       -> FAIL       (fi-snb-2600) fdo#100215 +1
Test kms_frontbuffer_tracking:
        Subgroup basic:
                pass       -> DMESG-WARN (fi-bdw-5557u) fdo#102473
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-a:
                dmesg-warn -> INCOMPLETE (fi-cfl-s) fdo#102294

fdo#102456 https://bugs.freedesktop.org/show_bug.cgi?id=102456
fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#102473 https://bugs.freedesktop.org/show_bug.cgi?id=102473
fdo#102294 https://bugs.freedesktop.org/show_bug.cgi?id=102294

fi-bdw-5557u     total:289  pass:267  dwarn:1   dfail:0   fail:0   skip:21  time:448s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:479s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:425s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:514s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:279s
fi-bxt-j4205     total:118  pass:97   dwarn:0   dfail:0   fail:0   skip:20 
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:500s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:494s
fi-cfl-s         total:230  pass:188  dwarn:16  dfail:0   fail:0   skip:25 
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:422s
fi-glk-2a        total:118  pass:96   dwarn:0   dfail:0   fail:0   skip:21 
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:439s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:406s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:430s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:492s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:464s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:472s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:585s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:594s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:547s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:454s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:754s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:494s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:480s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:571s
fi-snb-2600      total:289  pass:248  dwarn:0   dfail:0   fail:2   skip:39  time:415s

8df48428bfcc51ccef4090d492be55456aaa9550 drm-tip: 2017y-09m-18d-18h-50m-09s UTC integration manifest
e50c40089e3a drm/i915: Pass a crtc state to ddi post_disable from MST code
e279afc23903 drm/i915: Replace most intel_ddi_get_encoder_port() alls with encoder->port
eabfc5adc061 drm/i915: Clear up the types we use for DDI buf trans level/n_entries
127b08ca7d8d drm/i915: Unify error handling for missing DDI buf trans tables
a71dab9be96d drm/i915: Stop frobbing with DDI encoder->type
c149f08629da drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling
d5650c006e55 drm/i915: Stop using encoder->type in intel_ddi_enable_transcoder_func()
898298f086c0 drm/i915: Start using output_types for DPLL selection
a8af5fe2b6ca drm/i915: Pass crtc state to intel_prepare_dp_ddi_buffers()
f0df0ff84d08 drm/i915: Don't use encoder->type in intel_ddi_set_pipe_settings()
49792d580f97 drm/i915: Kill off the BXT buf_trans default_index
23b57b623392 drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly
9b8ce7171f8d drm/i915: Integrate BXT into intel_ddi_dp_voltage_max()
16d8b06c277e drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers()
f5372a3b5300 drm/i915: Pass the encoder type explicitly to skl_set_iboost()
396c9c156652 drm/i915: Extract intel_ddi_get_buf_trans_hdmi()
2a144725b34a drm/i915: Relocate intel_ddi_get_buf_trans_*() functions
f80c3f6fe116 drm/i915: Split intel_enable_ddi() into DP and HDMI variants
b98f298aa0c4 drm/i915: Plump crtc_state etc. directly to intel_ddi_pre_enable_{dp, hdmi}()
4cc762ddd4ec drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants
d63c46e7fd94 drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp()
e0d0a67712d3 drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants
773310ba18fe drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable()
a6748bdf5fd6 drm/i915: Extract intel_disable_ddi_buf()
cb79df55727f drm/i915: Extract intel_ddi_clk_disable()
b5c00b114c6d drm/i915: Dump 'output_types' in crtc state dump
d75366c31f10 drm/i915: Shrink cnl_ddi_buf_trans
fd81258187e6 drm/i915: Shrink bxt_ddi_buf_trans
28402a1e6661 drm/i915: Replace some spaces with tabs

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5740/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* [PATCH v2 04/29] drm/i915: Dump 'output_types' in crtc state dump
  2017-09-18 18:25 ` [PATCH 04/29] drm/i915: Dump 'output_types' in crtc state dump Ville Syrjala
  2017-09-18 18:43   ` Chris Wilson
  2017-09-18 18:54   ` Jani Nikula
@ 2017-09-20 14:03   ` Ville Syrjala
  2 siblings, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-20 14:03 UTC (permalink / raw)
  To: intel-gfx

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

To make it easier to debug things let's dump the output types bitmask in
the crtc state dump. And to make life that much better, let's pretty
print it as a a human reaadable string as well.

v2: Have the caller pass in the buffer (Chris)
    #undef OUTPUT_TYPE (Jani)

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_display.c | 51 ++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8599e425abb1..9221f613643a 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10683,6 +10683,52 @@ intel_dump_m_n_config(struct intel_crtc_state *pipe_config, char *id,
 		      m_n->link_m, m_n->link_n, m_n->tu);
 }
 
+#define OUTPUT_TYPE(x) [INTEL_OUTPUT_ ## x] = #x
+
+static const char * const output_type_str[] = {
+	OUTPUT_TYPE(UNUSED),
+	OUTPUT_TYPE(ANALOG),
+	OUTPUT_TYPE(DVO),
+	OUTPUT_TYPE(SDVO),
+	OUTPUT_TYPE(LVDS),
+	OUTPUT_TYPE(TVOUT),
+	OUTPUT_TYPE(HDMI),
+	OUTPUT_TYPE(DP),
+	OUTPUT_TYPE(EDP),
+	OUTPUT_TYPE(DSI),
+	OUTPUT_TYPE(UNKNOWN),
+	OUTPUT_TYPE(DP_MST),
+};
+
+#undef OUTPUT_TYPE
+
+static void snprintf_output_types(char *buf, size_t len,
+				  unsigned int output_types)
+{
+	char *str = buf;
+	int i;
+
+	str[0] = '\0';
+
+	for (i = 0; i < ARRAY_SIZE(output_type_str); i++) {
+		int r;
+
+		if ((output_types & BIT(i)) == 0)
+			continue;
+
+		r = snprintf(str, len, "%s%s",
+			     str != buf ? "," : "", output_type_str[i]);
+		if (r >= len)
+			break;
+		str += r;
+		len -= r;
+
+		output_types &= ~BIT(i);
+	}
+
+	WARN_ON_ONCE(output_types != 0);
+}
+
 static void intel_dump_pipe_config(struct intel_crtc *crtc,
 				   struct intel_crtc_state *pipe_config,
 				   const char *context)
@@ -10693,10 +10739,15 @@ static void intel_dump_pipe_config(struct intel_crtc *crtc,
 	struct intel_plane *intel_plane;
 	struct intel_plane_state *state;
 	struct drm_framebuffer *fb;
+	char buf[64];
 
 	DRM_DEBUG_KMS("[CRTC:%d:%s]%s\n",
 		      crtc->base.base.id, crtc->base.name, context);
 
+	snprintf_output_types(buf, sizeof(buf), pipe_config->output_types);
+	DRM_DEBUG_KMS("output_types: %s (0x%x)\n",
+		      buf, pipe_config->output_types);
+
 	DRM_DEBUG_KMS("cpu_transcoder: %s, pipe bpp: %i, dithering: %i\n",
 		      transcoder_name(pipe_config->cpu_transcoder),
 		      pipe_config->pipe_bpp, pipe_config->dither);
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev2)
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (30 preceding siblings ...)
  2017-09-18 19:46 ` ✗ Fi.CI.BAT: failure for " Patchwork
@ 2017-09-20 14:26 ` Patchwork
  2017-09-20 15:40 ` Patchwork
                   ` (3 subsequent siblings)
  35 siblings, 0 replies; 58+ messages in thread
From: Patchwork @ 2017-09-20 14:26 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Eliminate DDI encoder->type frobbery redux (rev2)
URL   : https://patchwork.freedesktop.org/series/30548/
State : failure

== Summary ==

Series 30548v2 drm/i915: Eliminate DDI encoder->type frobbery redux
https://patchwork.freedesktop.org/api/1.0/series/30548/revisions/2/mbox/

Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> INCOMPLETE (fi-bxt-j4205)
                incomplete -> PASS       (fi-kbl-7500u) fdo#102850
                pass       -> INCOMPLETE (fi-glk-1)
Test kms_force_connector_basic:
        Subgroup force-connector-state:
                skip       -> PASS       (fi-ivb-3520m)
        Subgroup force-edid:
                skip       -> PASS       (fi-ivb-3520m)
        Subgroup force-load-detect:
                skip       -> PASS       (fi-ivb-3520m)
        Subgroup prune-stale-modes:
                skip       -> PASS       (fi-ivb-3520m)
Test pm_rpm:
        Subgroup basic-rte:
                dmesg-warn -> PASS       (fi-cfl-s) fdo#102294

fdo#102850 https://bugs.freedesktop.org/show_bug.cgi?id=102850
fdo#102294 https://bugs.freedesktop.org/show_bug.cgi?id=102294

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:450s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:467s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:422s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:517s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:280s
fi-bxt-j4205     total:118  pass:97   dwarn:0   dfail:0   fail:0   skip:20 
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:500s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:494s
fi-cfl-s         total:289  pass:223  dwarn:34  dfail:0   fail:0   skip:32  time:540s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:418s
fi-glk-1         total:118  pass:96   dwarn:0   dfail:0   fail:0   skip:21 
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:428s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:406s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:434s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:492s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:462s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:476s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:580s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:588s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:541s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:454s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:757s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:495s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:474s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:581s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:1   skip:39  time:422s

ed7a99bf23cea2276e77ba26d219e58e069d1e32 drm-tip: 2017y-09m-20d-11h-03m-37s UTC integration manifest
1a3cc94fd8a2 drm/i915: Pass a crtc state to ddi post_disable from MST code
fe29fba4c99a drm/i915: Replace most intel_ddi_get_encoder_port() alls with encoder->port
16cf6a4a256f drm/i915: Clear up the types we use for DDI buf trans level/n_entries
4879849898e3 drm/i915: Unify error handling for missing DDI buf trans tables
a268529d63e0 drm/i915: Stop frobbing with DDI encoder->type
08833641db2d drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling
2eac6ef17b52 drm/i915: Stop using encoder->type in intel_ddi_enable_transcoder_func()
50dfaa9fe719 drm/i915: Start using output_types for DPLL selection
22a4439a1fc3 drm/i915: Pass crtc state to intel_prepare_dp_ddi_buffers()
225af3872bee drm/i915: Don't use encoder->type in intel_ddi_set_pipe_settings()
57076a4e4999 drm/i915: Kill off the BXT buf_trans default_index
c54c4ebe5188 drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly
2da510f28eea drm/i915: Integrate BXT into intel_ddi_dp_voltage_max()
732f6537f3c7 drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers()
64ddfd7839a0 drm/i915: Pass the encoder type explicitly to skl_set_iboost()
7ec30a4df53d drm/i915: Extract intel_ddi_get_buf_trans_hdmi()
0414a981af1d drm/i915: Relocate intel_ddi_get_buf_trans_*() functions
9dc0432deb03 drm/i915: Split intel_enable_ddi() into DP and HDMI variants
0273999dbbc4 drm/i915: Plump crtc_state etc. directly to intel_ddi_pre_enable_{dp, hdmi}()
f0128eeec610 drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants
1deea5bbfcb6 drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp()
e7d37699f8d8 drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants
42da9cda7afe drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable()
fe28dbeddd65 drm/i915: Extract intel_disable_ddi_buf()
98a742399fda drm/i915: Extract intel_ddi_clk_disable()
6da3b4b7cfd9 drm/i915: Dump 'output_types' in crtc state dump

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5764/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev2)
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (31 preceding siblings ...)
  2017-09-20 14:26 ` ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev2) Patchwork
@ 2017-09-20 15:40 ` Patchwork
  2017-09-20 15:46   ` Ville Syrjälä
  2017-09-21 13:18 ` ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev3) Patchwork
                   ` (2 subsequent siblings)
  35 siblings, 1 reply; 58+ messages in thread
From: Patchwork @ 2017-09-20 15:40 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Eliminate DDI encoder->type frobbery redux (rev2)
URL   : https://patchwork.freedesktop.org/series/30548/
State : failure

== Summary ==

Series 30548v2 drm/i915: Eliminate DDI encoder->type frobbery redux
https://patchwork.freedesktop.org/api/1.0/series/30548/revisions/2/mbox/

Test chamelium:
        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#102514
Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> INCOMPLETE (fi-bxt-j4205)
                incomplete -> PASS       (fi-kbl-7500u) fdo#102850
                pass       -> INCOMPLETE (fi-glk-1)
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                pass       -> FAIL       (fi-snb-2600) fdo#100215 +1
Test kms_force_connector_basic:
        Subgroup force-connector-state:
                skip       -> PASS       (fi-ivb-3520m)
        Subgroup force-edid:
                skip       -> PASS       (fi-ivb-3520m)
        Subgroup force-load-detect:
                skip       -> PASS       (fi-ivb-3520m)
        Subgroup prune-stale-modes:
                skip       -> PASS       (fi-ivb-3520m)
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-c:
                pass       -> INCOMPLETE (fi-kbl-r)
Test pm_rpm:
        Subgroup basic-rte:
                dmesg-warn -> PASS       (fi-cfl-s) fdo#102294

fdo#102514 https://bugs.freedesktop.org/show_bug.cgi?id=102514
fdo#102850 https://bugs.freedesktop.org/show_bug.cgi?id=102850
fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#102294 https://bugs.freedesktop.org/show_bug.cgi?id=102294

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:440s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:470s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:421s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:508s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:277s
fi-bxt-j4205     total:118  pass:97   dwarn:0   dfail:0   fail:0   skip:20 
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:489s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:491s
fi-cfl-s         total:289  pass:223  dwarn:34  dfail:0   fail:0   skip:32  time:544s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:416s
fi-glk-1         total:118  pass:96   dwarn:0   dfail:0   fail:0   skip:21 
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:425s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:407s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:429s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:498s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:465s
fi-kbl-7500u     total:289  pass:263  dwarn:1   dfail:0   fail:1   skip:24  time:456s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:575s
fi-kbl-r         total:247  pass:222  dwarn:0   dfail:0   fail:0   skip:24 
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:552s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:454s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:752s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:485s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:475s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:562s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:1   skip:39  time:419s

ed7a99bf23cea2276e77ba26d219e58e069d1e32 drm-tip: 2017y-09m-20d-11h-03m-37s UTC integration manifest
890d6dc6b2aa drm/i915: Pass a crtc state to ddi post_disable from MST code
7b7455924657 drm/i915: Replace most intel_ddi_get_encoder_port() alls with encoder->port
978b911cca2d drm/i915: Clear up the types we use for DDI buf trans level/n_entries
fb971aa20d2a drm/i915: Unify error handling for missing DDI buf trans tables
694adc37f601 drm/i915: Stop frobbing with DDI encoder->type
eb1e0a33a9cf drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling
e381f6681ece drm/i915: Stop using encoder->type in intel_ddi_enable_transcoder_func()
b55f585b033b drm/i915: Start using output_types for DPLL selection
b22c723225d8 drm/i915: Pass crtc state to intel_prepare_dp_ddi_buffers()
e6166993c1a5 drm/i915: Don't use encoder->type in intel_ddi_set_pipe_settings()
fb0aac2a617e drm/i915: Kill off the BXT buf_trans default_index
c5c8d13588ba drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly
80c0dd1f3c9a drm/i915: Integrate BXT into intel_ddi_dp_voltage_max()
0710cd26cc3e drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers()
76737af9ab89 drm/i915: Pass the encoder type explicitly to skl_set_iboost()
d9417ff3e3c2 drm/i915: Extract intel_ddi_get_buf_trans_hdmi()
1c4530c335a9 drm/i915: Relocate intel_ddi_get_buf_trans_*() functions
49ab57d7a0e4 drm/i915: Split intel_enable_ddi() into DP and HDMI variants
019b8ee5fe96 drm/i915: Plump crtc_state etc. directly to intel_ddi_pre_enable_{dp, hdmi}()
fb7f9bb1b8cf drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants
2762aa278a8f drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp()
7f2ce0ba9564 drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants
c3ca3bcf5f9f drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable()
f1e5c7891191 drm/i915: Extract intel_disable_ddi_buf()
aa887ee4b31f drm/i915: Extract intel_ddi_clk_disable()
a50c14868185 drm/i915: Dump 'output_types' in crtc state dump

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5767/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev2)
  2017-09-20 15:40 ` Patchwork
@ 2017-09-20 15:46   ` Ville Syrjälä
  2017-09-25 11:40     ` Jani Nikula
  0 siblings, 1 reply; 58+ messages in thread
From: Ville Syrjälä @ 2017-09-20 15:46 UTC (permalink / raw)
  To: intel-gfx

On Wed, Sep 20, 2017 at 03:40:06PM -0000, Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915: Eliminate DDI encoder->type frobbery redux (rev2)
> URL   : https://patchwork.freedesktop.org/series/30548/
> State : failure
> 
> == Summary ==
> 
> Series 30548v2 drm/i915: Eliminate DDI encoder->type frobbery redux
> https://patchwork.freedesktop.org/api/1.0/series/30548/revisions/2/mbox/
> 
> Test chamelium:
>         Subgroup dp-crc-fast:
>                 pass       -> FAIL       (fi-kbl-7500u) fdo#102514
> Test gem_exec_suspend:
>         Subgroup basic-s3:
>                 pass       -> INCOMPLETE (fi-bxt-j4205)
>                 pass       -> INCOMPLETE (fi-glk-1)

3 out of 3. I guess I'll have to believe that there's a real
problem somewhere :(

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* [PATCH v2 25/29] drm/i915: Stop frobbing with DDI encoder->type
  2017-09-18 18:26 ` [PATCH 25/29] drm/i915: Stop frobbing with DDI encoder->type Ville Syrjala
@ 2017-09-21 11:06   ` Ville Syrjala
  2017-09-21 14:56   ` [PATCH v3 " Ville Syrjala
  1 sibling, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-21 11:06 UTC (permalink / raw)
  To: intel-gfx

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

Currently the DDI encoder->type will change at runtime depending on
what kind of hotplugs we've processed. That's quite bad since we can't
really trust that that current value of encoder->type actually matches
the type of signal we're trying to drive through it.

Let's eliminate that problem by declaring that non-eDP DDI port will
always have the encoder type as INTEL_OUTPUT_DDI. This means the code
can no longer try to distinguish DP vs. HDMI based on encoder->type.
We'll eDP as INTEL_OUTPUT_EDP, since it'll never change and there's a
bunch of code that relies on that value to identofy eDP.

We'll introduce a new encoder .compute_output_type() hook. This allows
us to compute the full output_types before any encoder .compute_config()
hooks get called, thus those hooks can rely on output_types being
correct, which is useful for cloning on oldr platforms. For now we'll
just look at the connector type and pick the correct mode based on that.
In the future the new hook could be used to implement dynamic switching
between LS and PCON modes for LSPCON.

TODO: maybe make .get_config() populate output_types rather than doing
the default encoder->type thing in caller and then undoing it for
DDI in .get_config().

v2: Fix BXT/GLK PPS explosion with DSI/MST encoders

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |  2 +-
 drivers/gpu/drm/i915/intel_ddi.c      | 49 +++++++++++++++++++++++++++++------
 drivers/gpu/drm/i915/intel_display.c  | 11 +++++---
 drivers/gpu/drm/i915/intel_dp.c       | 15 ++---------
 drivers/gpu/drm/i915/intel_drv.h      |  7 +++--
 drivers/gpu/drm/i915/intel_hdmi.c     | 10 ++-----
 drivers/gpu/drm/i915/intel_opregion.c |  2 +-
 7 files changed, 60 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index ca6fa6d122c6..73601464240d 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3053,7 +3053,7 @@ static void intel_connector_info(struct seq_file *m,
 		break;
 	case DRM_MODE_CONNECTOR_HDMIA:
 		if (intel_encoder->type == INTEL_OUTPUT_HDMI ||
-		    intel_encoder->type == INTEL_OUTPUT_UNKNOWN)
+		    intel_encoder->type == INTEL_OUTPUT_DDI)
 			intel_hdmi_info(m, intel_connector);
 		break;
 	default:
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index d625bfe6d420..e93ed0d31738 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -497,10 +497,8 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *encoder)
 	switch (encoder->type) {
 	case INTEL_OUTPUT_DP_MST:
 		return enc_to_mst(&encoder->base)->primary->port;
-	case INTEL_OUTPUT_DP:
 	case INTEL_OUTPUT_EDP:
-	case INTEL_OUTPUT_HDMI:
-	case INTEL_OUTPUT_UNKNOWN:
+	case INTEL_OUTPUT_DDI:
 		return enc_to_dig_port(&encoder->base)->port;
 	case INTEL_OUTPUT_ANALOG:
 		return PORT_E;
@@ -1516,6 +1514,7 @@ void intel_ddi_set_vc_payload_alloc(const struct intel_crtc_state *crtc_state,
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
 	uint32_t temp;
+
 	temp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
 	if (state == true)
 		temp |= TRANS_DDI_DP_VC_PAYLOAD_ALLOC;
@@ -2489,6 +2488,13 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 	struct intel_digital_port *intel_dig_port;
 	u32 temp, flags = 0;
 
+	/*
+	 * Can be set by the caller based on encoder->type.
+	 * Undo that since we don't want INTEL_OUTPUT_DDI
+	 * to appear in output_types.
+	 */
+	pipe_config->output_types &= ~BIT(INTEL_OUTPUT_DDI);
+
 	/* XXX: DSI transcoder paranoia */
 	if (WARN_ON(transcoder_is_dsi(cpu_transcoder)))
 		return;
@@ -2537,12 +2543,23 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 			pipe_config->hdmi_high_tmds_clock_ratio = true;
 		/* fall through */
 	case TRANS_DDI_MODE_SELECT_DVI:
+		pipe_config->output_types |= BIT(INTEL_OUTPUT_HDMI);
 		pipe_config->lane_count = 4;
 		break;
 	case TRANS_DDI_MODE_SELECT_FDI:
+		pipe_config->output_types |= BIT(INTEL_OUTPUT_ANALOG);
 		break;
 	case TRANS_DDI_MODE_SELECT_DP_SST:
+		if (encoder->type == INTEL_OUTPUT_EDP)
+			pipe_config->output_types |= BIT(INTEL_OUTPUT_EDP);
+		else
+			pipe_config->output_types |= BIT(INTEL_OUTPUT_DP);
+		pipe_config->lane_count =
+			((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1;
+		intel_dp_get_m_n(intel_crtc, pipe_config);
+		break;
 	case TRANS_DDI_MODE_SELECT_DP_MST:
+		pipe_config->output_types |= BIT(INTEL_OUTPUT_DP_MST);
 		pipe_config->lane_count =
 			((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1;
 		intel_dp_get_m_n(intel_crtc, pipe_config);
@@ -2581,21 +2598,36 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 			bxt_ddi_phy_get_lane_lat_optim_mask(encoder);
 }
 
+static enum intel_output_type
+intel_ddi_compute_output_type(struct intel_encoder *encoder,
+			      struct intel_crtc_state *crtc_state,
+			      struct drm_connector_state *conn_state)
+{
+	switch (conn_state->connector->connector_type) {
+	case DRM_MODE_CONNECTOR_HDMIA:
+		return INTEL_OUTPUT_HDMI;
+	case DRM_MODE_CONNECTOR_eDP:
+		return INTEL_OUTPUT_EDP;
+	case DRM_MODE_CONNECTOR_DisplayPort:
+		return INTEL_OUTPUT_DP;
+	default:
+		MISSING_CASE(conn_state->connector->connector_type);
+		return INTEL_OUTPUT_UNUSED;
+	}
+}
+
 static bool intel_ddi_compute_config(struct intel_encoder *encoder,
 				     struct intel_crtc_state *pipe_config,
 				     struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	int type = encoder->type;
 	int port = intel_ddi_get_encoder_port(encoder);
 	int ret;
 
-	WARN(type == INTEL_OUTPUT_UNKNOWN, "compute_config() on unknown output!\n");
-
 	if (port == PORT_A)
 		pipe_config->cpu_transcoder = TRANSCODER_EDP;
 
-	if (type == INTEL_OUTPUT_HDMI)
+	if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_HDMI))
 		ret = intel_hdmi_compute_config(encoder, pipe_config, conn_state);
 	else
 		ret = intel_dp_compute_config(encoder, pipe_config, conn_state);
@@ -2715,6 +2747,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	drm_encoder_init(&dev_priv->drm, encoder, &intel_ddi_funcs,
 			 DRM_MODE_ENCODER_TMDS, "DDI %c", port_name(port));
 
+	intel_encoder->compute_output_type = intel_ddi_compute_output_type;
 	intel_encoder->compute_config = intel_ddi_compute_config;
 	intel_encoder->enable = intel_enable_ddi;
 	if (IS_GEN9_LP(dev_priv))
@@ -2774,7 +2807,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 
 	intel_dig_port->max_lanes = max_lanes;
 
-	intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
+	intel_encoder->type = INTEL_OUTPUT_DDI;
 	intel_encoder->power_domain = intel_port_to_power_domain(port);
 	intel_encoder->port = port;
 	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9221f613643a..18bffb883a65 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10696,7 +10696,7 @@ static const char * const output_type_str[] = {
 	OUTPUT_TYPE(DP),
 	OUTPUT_TYPE(EDP),
 	OUTPUT_TYPE(DSI),
-	OUTPUT_TYPE(UNKNOWN),
+	OUTPUT_TYPE(DDI),
 	OUTPUT_TYPE(DP_MST),
 };
 
@@ -10867,7 +10867,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state)
 
 		switch (encoder->type) {
 			unsigned int port_mask;
-		case INTEL_OUTPUT_UNKNOWN:
+		case INTEL_OUTPUT_DDI:
 			if (WARN_ON(!HAS_DDI(to_i915(dev))))
 				break;
 		case INTEL_OUTPUT_DP:
@@ -11000,7 +11000,12 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
 		 * Determine output_types before calling the .compute_config()
 		 * hooks so that the hooks can use this information safely.
 		 */
-		pipe_config->output_types |= 1 << encoder->type;
+		if (encoder->compute_output_type)
+			pipe_config->output_types |=
+				BIT(encoder->compute_output_type(encoder, pipe_config,
+								 connector_state));
+		else
+			pipe_config->output_types |= BIT(encoder->type);
 	}
 
 encoder_retry:
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 2ef68d28ea1e..5b2cf5677c6a 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -769,7 +769,8 @@ void intel_power_sequencer_reset(struct drm_i915_private *dev_priv)
 		struct intel_dp *intel_dp;
 
 		if (encoder->type != INTEL_OUTPUT_DP &&
-		    encoder->type != INTEL_OUTPUT_EDP)
+		    encoder->type != INTEL_OUTPUT_EDP &&
+		    encoder->type != INTEL_OUTPUT_DDI)
 			continue;
 
 		intel_dp = enc_to_intel_dp(&encoder->base);
@@ -4719,8 +4720,6 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
 {
 	struct drm_connector *connector = &intel_connector->base;
 	struct intel_dp *intel_dp = intel_attached_dp(connector);
-	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
-	struct intel_encoder *intel_encoder = &intel_dig_port->base;
 	struct drm_device *dev = connector->dev;
 	enum drm_connector_status status;
 	u8 sink_irq_vector = 0;
@@ -4753,9 +4752,6 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
 		goto out;
 	}
 
-	if (intel_encoder->type != INTEL_OUTPUT_EDP)
-		intel_encoder->type = INTEL_OUTPUT_DP;
-
 	DRM_DEBUG_KMS("Display Port TPS3 support: source %s, sink %s\n",
 		      yesno(intel_dp_source_supports_hbr2(intel_dp)),
 		      yesno(drm_dp_tps3_supported(intel_dp->dpcd)));
@@ -4876,9 +4872,6 @@ intel_dp_force(struct drm_connector *connector)
 	intel_dp_set_edid(intel_dp);
 
 	intel_display_power_put(dev_priv, intel_dp->aux_power_domain);
-
-	if (intel_encoder->type != INTEL_OUTPUT_EDP)
-		intel_encoder->type = INTEL_OUTPUT_DP;
 }
 
 static int intel_dp_get_modes(struct drm_connector *connector)
@@ -5097,10 +5090,6 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	enum irqreturn ret = IRQ_NONE;
 
-	if (intel_dig_port->base.type != INTEL_OUTPUT_EDP &&
-	    intel_dig_port->base.type != INTEL_OUTPUT_HDMI)
-		intel_dig_port->base.type = INTEL_OUTPUT_DP;
-
 	if (long_hpd && intel_dig_port->base.type == INTEL_OUTPUT_EDP) {
 		/*
 		 * vdd off can generate a long pulse on eDP which
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 307807672896..6e375d2e052c 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -173,7 +173,7 @@ enum intel_output_type {
 	INTEL_OUTPUT_DP = 7,
 	INTEL_OUTPUT_EDP = 8,
 	INTEL_OUTPUT_DSI = 9,
-	INTEL_OUTPUT_UNKNOWN = 10,
+	INTEL_OUTPUT_DDI = 10,
 	INTEL_OUTPUT_DP_MST = 11,
 };
 
@@ -216,6 +216,9 @@ struct intel_encoder {
 	enum port port;
 	unsigned int cloneable;
 	void (*hot_plug)(struct intel_encoder *);
+	enum intel_output_type (*compute_output_type)(struct intel_encoder *,
+						      struct intel_crtc_state *,
+						      struct drm_connector_state *);
 	bool (*compute_config)(struct intel_encoder *,
 			       struct intel_crtc_state *,
 			       struct drm_connector_state *);
@@ -1151,7 +1154,7 @@ enc_to_dig_port(struct drm_encoder *encoder)
 	struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
 
 	switch (intel_encoder->type) {
-	case INTEL_OUTPUT_UNKNOWN:
+	case INTEL_OUTPUT_DDI:
 		WARN_ON(!HAS_DDI(to_i915(encoder->dev)));
 	case INTEL_OUTPUT_DP:
 	case INTEL_OUTPUT_EDP:
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index e6f8f30ce7bd..ab8f8d751081 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1604,12 +1604,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 
 	intel_hdmi_unset_edid(connector);
 
-	if (intel_hdmi_set_edid(connector)) {
-		struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-
-		hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
+	if (intel_hdmi_set_edid(connector))
 		status = connector_status_connected;
-	} else
+	else
 		status = connector_status_disconnected;
 
 	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
@@ -1620,8 +1617,6 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 static void
 intel_hdmi_force(struct drm_connector *connector)
 {
-	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
@@ -1631,7 +1626,6 @@ intel_hdmi_force(struct drm_connector *connector)
 		return;
 
 	intel_hdmi_set_edid(connector);
-	hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
 }
 
 static int intel_hdmi_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index 98154efcb2f4..d57ade0b652a 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -383,7 +383,7 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
 	case INTEL_OUTPUT_ANALOG:
 		type = DISPLAY_TYPE_CRT;
 		break;
-	case INTEL_OUTPUT_UNKNOWN:
+	case INTEL_OUTPUT_DDI:
 	case INTEL_OUTPUT_DP:
 	case INTEL_OUTPUT_HDMI:
 	case INTEL_OUTPUT_DP_MST:
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev3)
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (32 preceding siblings ...)
  2017-09-20 15:40 ` Patchwork
@ 2017-09-21 13:18 ` Patchwork
  2017-09-21 15:36 ` ✓ Fi.CI.BAT: success for drm/i915: Eliminate DDI encoder->type frobbery redux (rev4) Patchwork
  2017-09-21 18:26 ` ✗ Fi.CI.IGT: failure " Patchwork
  35 siblings, 0 replies; 58+ messages in thread
From: Patchwork @ 2017-09-21 13:18 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Eliminate DDI encoder->type frobbery redux (rev3)
URL   : https://patchwork.freedesktop.org/series/30548/
State : failure

== Summary ==

Series 30548v3 drm/i915: Eliminate DDI encoder->type frobbery redux
https://patchwork.freedesktop.org/api/1.0/series/30548/revisions/3/mbox/

Test gem_exec_suspend:
        Subgroup basic-s3:
                pass       -> DMESG-WARN (fi-bxt-j4205)
                pass       -> DMESG-WARN (fi-glk-1)
Test gem_ringfill:
        Subgroup basic-default-hang:
                pass       -> DMESG-WARN (fi-pnv-d510) fdo#101600
Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                fail       -> PASS       (fi-snb-2600) fdo#100215 +1
Test kms_pipe_crc_basic:
        Subgroup nonblocking-crc-pipe-b-frame-sequence:
                dmesg-warn -> DMESG-FAIL (fi-cfl-s) fdo#102294
        Subgroup nonblocking-crc-pipe-c:
                skip       -> INCOMPLETE (fi-cfl-s)
        Subgroup suspend-read-crc-pipe-a:
                pass       -> DMESG-WARN (fi-bxt-j4205)
                pass       -> DMESG-WARN (fi-glk-1)
        Subgroup suspend-read-crc-pipe-b:
                pass       -> DMESG-WARN (fi-bxt-j4205)
                pass       -> DMESG-WARN (fi-glk-1)
        Subgroup suspend-read-crc-pipe-c:
                pass       -> DMESG-WARN (fi-bxt-j4205)
                pass       -> DMESG-WARN (fi-glk-1)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                pass       -> DMESG-WARN (fi-bxt-j4205)
                pass       -> DMESG-WARN (fi-glk-1)
        Subgroup basic-rte:
                pass       -> DMESG-WARN (fi-bxt-j4205)
                pass       -> DMESG-WARN (fi-glk-1)
Test prime_vgem:
        Subgroup basic-fence-flip:
                pass       -> DMESG-WARN (fi-bxt-j4205)
Test drv_module_reload:
        Subgroup basic-no-display:
                pass       -> DMESG-WARN (fi-glk-1) fdo#102777 +1

fdo#101600 https://bugs.freedesktop.org/show_bug.cgi?id=101600
fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#102294 https://bugs.freedesktop.org/show_bug.cgi?id=102294
fdo#102777 https://bugs.freedesktop.org/show_bug.cgi?id=102777

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:437s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:475s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:427s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:518s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:278s
fi-bxt-j4205     total:289  pass:253  dwarn:7   dfail:0   fail:0   skip:29  time:499s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:491s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:492s
fi-cfl-s         total:237  pass:188  dwarn:21  dfail:1   fail:0   skip:26 
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:419s
fi-glk-1         total:289  pass:252  dwarn:8   dfail:0   fail:0   skip:29  time:565s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:427s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:403s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:435s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:491s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:465s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:472s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:575s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:588s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:539s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:446s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:755s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:483s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:466s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:566s
fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:415s

bed15796ff696a0a77324b69cfad9e61b50a70a4 drm-tip: 2017y-09m-20d-20h-05m-31s UTC integration manifest
e27cac9ba960 drm/i915: Pass a crtc state to ddi post_disable from MST code
0de78b80d54d drm/i915: Replace most intel_ddi_get_encoder_port() alls with encoder->port
512bce39587a drm/i915: Clear up the types we use for DDI buf trans level/n_entries
0bfc26bcb85a drm/i915: Unify error handling for missing DDI buf trans tables
acd739878a0d drm/i915: Stop frobbing with DDI encoder->type
fe543e6e9956 drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling
53dc033bc713 drm/i915: Stop using encoder->type in intel_ddi_enable_transcoder_func()
bf43d01f9b85 drm/i915: Start using output_types for DPLL selection
82110cd8fcdc drm/i915: Pass crtc state to intel_prepare_dp_ddi_buffers()
d6e133e0c390 drm/i915: Don't use encoder->type in intel_ddi_set_pipe_settings()
e4dddbd46d4a drm/i915: Kill off the BXT buf_trans default_index
1727a8a0d78f drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly
6fc3b1ac84ac drm/i915: Integrate BXT into intel_ddi_dp_voltage_max()
77f8db0d5f2a drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers()
f413603092a8 drm/i915: Pass the encoder type explicitly to skl_set_iboost()
27ce6fab642a drm/i915: Extract intel_ddi_get_buf_trans_hdmi()
647d8866ce4d drm/i915: Relocate intel_ddi_get_buf_trans_*() functions
c5be6cf39218 drm/i915: Split intel_enable_ddi() into DP and HDMI variants
cfd67d118732 drm/i915: Plump crtc_state etc. directly to intel_ddi_pre_enable_{dp, hdmi}()
5135c85b0717 drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants
f81e433332dd drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp()
b24ce6e13762 drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants
e7ecb9c0cf68 drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable()
8e68ed089e02 drm/i915: Extract intel_disable_ddi_buf()
2f0de2f3995a drm/i915: Extract intel_ddi_clk_disable()
931ac08eaae4 drm/i915: Dump 'output_types' in crtc state dump

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5777/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* [PATCH v3 25/29] drm/i915: Stop frobbing with DDI encoder->type
  2017-09-18 18:26 ` [PATCH 25/29] drm/i915: Stop frobbing with DDI encoder->type Ville Syrjala
  2017-09-21 11:06   ` [PATCH v2 " Ville Syrjala
@ 2017-09-21 14:56   ` Ville Syrjala
  1 sibling, 0 replies; 58+ messages in thread
From: Ville Syrjala @ 2017-09-21 14:56 UTC (permalink / raw)
  To: intel-gfx

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

Currently the DDI encoder->type will change at runtime depending on
what kind of hotplugs we've processed. That's quite bad since we can't
really trust that that current value of encoder->type actually matches
the type of signal we're trying to drive through it.

Let's eliminate that problem by declaring that non-eDP DDI port will
always have the encoder type as INTEL_OUTPUT_DDI. This means the code
can no longer try to distinguish DP vs. HDMI based on encoder->type.
We'll eDP as INTEL_OUTPUT_EDP, since it'll never change and there's a
bunch of code that relies on that value to identofy eDP.

We'll introduce a new encoder .compute_output_type() hook. This allows
us to compute the full output_types before any encoder .compute_config()
hooks get called, thus those hooks can rely on output_types being
correct, which is useful for cloning on oldr platforms. For now we'll
just look at the connector type and pick the correct mode based on that.
In the future the new hook could be used to implement dynamic switching
between LS and PCON modes for LSPCON.

TODO: maybe make .get_config() populate output_types rather than doing
the default encoder->type thing in caller and then undoing it for
DDI in .get_config().

v2: Fix BXT/GLK PPS explosion with DSI/MST encoders
v3: Avoid the PPS warn on pure HDMI/DVI DDI encoders by checking dp.output_reg

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |  2 +-
 drivers/gpu/drm/i915/intel_ddi.c      | 50 +++++++++++++++++++++++++++++------
 drivers/gpu/drm/i915/intel_display.c  | 11 +++++---
 drivers/gpu/drm/i915/intel_dp.c       | 19 +++++--------
 drivers/gpu/drm/i915/intel_drv.h      |  7 +++--
 drivers/gpu/drm/i915/intel_hdmi.c     | 10 ++-----
 drivers/gpu/drm/i915/intel_opregion.c |  2 +-
 7 files changed, 65 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index ca6fa6d122c6..73601464240d 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -3053,7 +3053,7 @@ static void intel_connector_info(struct seq_file *m,
 		break;
 	case DRM_MODE_CONNECTOR_HDMIA:
 		if (intel_encoder->type == INTEL_OUTPUT_HDMI ||
-		    intel_encoder->type == INTEL_OUTPUT_UNKNOWN)
+		    intel_encoder->type == INTEL_OUTPUT_DDI)
 			intel_hdmi_info(m, intel_connector);
 		break;
 	default:
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index d625bfe6d420..17b9bb80fb09 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -497,10 +497,8 @@ enum port intel_ddi_get_encoder_port(struct intel_encoder *encoder)
 	switch (encoder->type) {
 	case INTEL_OUTPUT_DP_MST:
 		return enc_to_mst(&encoder->base)->primary->port;
-	case INTEL_OUTPUT_DP:
 	case INTEL_OUTPUT_EDP:
-	case INTEL_OUTPUT_HDMI:
-	case INTEL_OUTPUT_UNKNOWN:
+	case INTEL_OUTPUT_DDI:
 		return enc_to_dig_port(&encoder->base)->port;
 	case INTEL_OUTPUT_ANALOG:
 		return PORT_E;
@@ -1516,6 +1514,7 @@ void intel_ddi_set_vc_payload_alloc(const struct intel_crtc_state *crtc_state,
 	struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
 	enum transcoder cpu_transcoder = crtc_state->cpu_transcoder;
 	uint32_t temp;
+
 	temp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
 	if (state == true)
 		temp |= TRANS_DDI_DP_VC_PAYLOAD_ALLOC;
@@ -2489,6 +2488,13 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 	struct intel_digital_port *intel_dig_port;
 	u32 temp, flags = 0;
 
+	/*
+	 * Can be set by the caller based on encoder->type.
+	 * Undo that since we don't want INTEL_OUTPUT_DDI
+	 * to appear in output_types.
+	 */
+	pipe_config->output_types &= ~BIT(INTEL_OUTPUT_DDI);
+
 	/* XXX: DSI transcoder paranoia */
 	if (WARN_ON(transcoder_is_dsi(cpu_transcoder)))
 		return;
@@ -2537,12 +2543,23 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 			pipe_config->hdmi_high_tmds_clock_ratio = true;
 		/* fall through */
 	case TRANS_DDI_MODE_SELECT_DVI:
+		pipe_config->output_types |= BIT(INTEL_OUTPUT_HDMI);
 		pipe_config->lane_count = 4;
 		break;
 	case TRANS_DDI_MODE_SELECT_FDI:
+		pipe_config->output_types |= BIT(INTEL_OUTPUT_ANALOG);
 		break;
 	case TRANS_DDI_MODE_SELECT_DP_SST:
+		if (encoder->type == INTEL_OUTPUT_EDP)
+			pipe_config->output_types |= BIT(INTEL_OUTPUT_EDP);
+		else
+			pipe_config->output_types |= BIT(INTEL_OUTPUT_DP);
+		pipe_config->lane_count =
+			((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1;
+		intel_dp_get_m_n(intel_crtc, pipe_config);
+		break;
 	case TRANS_DDI_MODE_SELECT_DP_MST:
+		pipe_config->output_types |= BIT(INTEL_OUTPUT_DP_MST);
 		pipe_config->lane_count =
 			((temp & DDI_PORT_WIDTH_MASK) >> DDI_PORT_WIDTH_SHIFT) + 1;
 		intel_dp_get_m_n(intel_crtc, pipe_config);
@@ -2581,21 +2598,36 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
 			bxt_ddi_phy_get_lane_lat_optim_mask(encoder);
 }
 
+static enum intel_output_type
+intel_ddi_compute_output_type(struct intel_encoder *encoder,
+			      struct intel_crtc_state *crtc_state,
+			      struct drm_connector_state *conn_state)
+{
+	switch (conn_state->connector->connector_type) {
+	case DRM_MODE_CONNECTOR_HDMIA:
+		return INTEL_OUTPUT_HDMI;
+	case DRM_MODE_CONNECTOR_eDP:
+		return INTEL_OUTPUT_EDP;
+	case DRM_MODE_CONNECTOR_DisplayPort:
+		return INTEL_OUTPUT_DP;
+	default:
+		MISSING_CASE(conn_state->connector->connector_type);
+		return INTEL_OUTPUT_UNUSED;
+	}
+}
+
 static bool intel_ddi_compute_config(struct intel_encoder *encoder,
 				     struct intel_crtc_state *pipe_config,
 				     struct drm_connector_state *conn_state)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	int type = encoder->type;
 	int port = intel_ddi_get_encoder_port(encoder);
 	int ret;
 
-	WARN(type == INTEL_OUTPUT_UNKNOWN, "compute_config() on unknown output!\n");
-
 	if (port == PORT_A)
 		pipe_config->cpu_transcoder = TRANSCODER_EDP;
 
-	if (type == INTEL_OUTPUT_HDMI)
+	if (intel_crtc_has_type(pipe_config, INTEL_OUTPUT_HDMI))
 		ret = intel_hdmi_compute_config(encoder, pipe_config, conn_state);
 	else
 		ret = intel_dp_compute_config(encoder, pipe_config, conn_state);
@@ -2715,6 +2747,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 	drm_encoder_init(&dev_priv->drm, encoder, &intel_ddi_funcs,
 			 DRM_MODE_ENCODER_TMDS, "DDI %c", port_name(port));
 
+	intel_encoder->compute_output_type = intel_ddi_compute_output_type;
 	intel_encoder->compute_config = intel_ddi_compute_config;
 	intel_encoder->enable = intel_enable_ddi;
 	if (IS_GEN9_LP(dev_priv))
@@ -2772,9 +2805,10 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
 		}
 	}
 
+	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
 	intel_dig_port->max_lanes = max_lanes;
 
-	intel_encoder->type = INTEL_OUTPUT_UNKNOWN;
+	intel_encoder->type = INTEL_OUTPUT_DDI;
 	intel_encoder->power_domain = intel_port_to_power_domain(port);
 	intel_encoder->port = port;
 	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 9221f613643a..18bffb883a65 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -10696,7 +10696,7 @@ static const char * const output_type_str[] = {
 	OUTPUT_TYPE(DP),
 	OUTPUT_TYPE(EDP),
 	OUTPUT_TYPE(DSI),
-	OUTPUT_TYPE(UNKNOWN),
+	OUTPUT_TYPE(DDI),
 	OUTPUT_TYPE(DP_MST),
 };
 
@@ -10867,7 +10867,7 @@ static bool check_digital_port_conflicts(struct drm_atomic_state *state)
 
 		switch (encoder->type) {
 			unsigned int port_mask;
-		case INTEL_OUTPUT_UNKNOWN:
+		case INTEL_OUTPUT_DDI:
 			if (WARN_ON(!HAS_DDI(to_i915(dev))))
 				break;
 		case INTEL_OUTPUT_DP:
@@ -11000,7 +11000,12 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
 		 * Determine output_types before calling the .compute_config()
 		 * hooks so that the hooks can use this information safely.
 		 */
-		pipe_config->output_types |= 1 << encoder->type;
+		if (encoder->compute_output_type)
+			pipe_config->output_types |=
+				BIT(encoder->compute_output_type(encoder, pipe_config,
+								 connector_state));
+		else
+			pipe_config->output_types |= BIT(encoder->type);
 	}
 
 encoder_retry:
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 2ef68d28ea1e..f30fabc802c5 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -769,11 +769,16 @@ void intel_power_sequencer_reset(struct drm_i915_private *dev_priv)
 		struct intel_dp *intel_dp;
 
 		if (encoder->type != INTEL_OUTPUT_DP &&
-		    encoder->type != INTEL_OUTPUT_EDP)
+		    encoder->type != INTEL_OUTPUT_EDP &&
+		    encoder->type != INTEL_OUTPUT_DDI)
 			continue;
 
 		intel_dp = enc_to_intel_dp(&encoder->base);
 
+		/* Skip pure DVI/HDMI DDI encoders */
+		if (!i915_mmio_reg_valid(intel_dp->output_reg))
+			continue;
+
 		WARN_ON(intel_dp->active_pipe != INVALID_PIPE);
 
 		if (encoder->type != INTEL_OUTPUT_EDP)
@@ -4719,8 +4724,6 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
 {
 	struct drm_connector *connector = &intel_connector->base;
 	struct intel_dp *intel_dp = intel_attached_dp(connector);
-	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
-	struct intel_encoder *intel_encoder = &intel_dig_port->base;
 	struct drm_device *dev = connector->dev;
 	enum drm_connector_status status;
 	u8 sink_irq_vector = 0;
@@ -4753,9 +4756,6 @@ intel_dp_long_pulse(struct intel_connector *intel_connector)
 		goto out;
 	}
 
-	if (intel_encoder->type != INTEL_OUTPUT_EDP)
-		intel_encoder->type = INTEL_OUTPUT_DP;
-
 	DRM_DEBUG_KMS("Display Port TPS3 support: source %s, sink %s\n",
 		      yesno(intel_dp_source_supports_hbr2(intel_dp)),
 		      yesno(drm_dp_tps3_supported(intel_dp->dpcd)));
@@ -4876,9 +4876,6 @@ intel_dp_force(struct drm_connector *connector)
 	intel_dp_set_edid(intel_dp);
 
 	intel_display_power_put(dev_priv, intel_dp->aux_power_domain);
-
-	if (intel_encoder->type != INTEL_OUTPUT_EDP)
-		intel_encoder->type = INTEL_OUTPUT_DP;
 }
 
 static int intel_dp_get_modes(struct drm_connector *connector)
@@ -5097,10 +5094,6 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	enum irqreturn ret = IRQ_NONE;
 
-	if (intel_dig_port->base.type != INTEL_OUTPUT_EDP &&
-	    intel_dig_port->base.type != INTEL_OUTPUT_HDMI)
-		intel_dig_port->base.type = INTEL_OUTPUT_DP;
-
 	if (long_hpd && intel_dig_port->base.type == INTEL_OUTPUT_EDP) {
 		/*
 		 * vdd off can generate a long pulse on eDP which
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 307807672896..6e375d2e052c 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -173,7 +173,7 @@ enum intel_output_type {
 	INTEL_OUTPUT_DP = 7,
 	INTEL_OUTPUT_EDP = 8,
 	INTEL_OUTPUT_DSI = 9,
-	INTEL_OUTPUT_UNKNOWN = 10,
+	INTEL_OUTPUT_DDI = 10,
 	INTEL_OUTPUT_DP_MST = 11,
 };
 
@@ -216,6 +216,9 @@ struct intel_encoder {
 	enum port port;
 	unsigned int cloneable;
 	void (*hot_plug)(struct intel_encoder *);
+	enum intel_output_type (*compute_output_type)(struct intel_encoder *,
+						      struct intel_crtc_state *,
+						      struct drm_connector_state *);
 	bool (*compute_config)(struct intel_encoder *,
 			       struct intel_crtc_state *,
 			       struct drm_connector_state *);
@@ -1151,7 +1154,7 @@ enc_to_dig_port(struct drm_encoder *encoder)
 	struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
 
 	switch (intel_encoder->type) {
-	case INTEL_OUTPUT_UNKNOWN:
+	case INTEL_OUTPUT_DDI:
 		WARN_ON(!HAS_DDI(to_i915(encoder->dev)));
 	case INTEL_OUTPUT_DP:
 	case INTEL_OUTPUT_EDP:
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index e6f8f30ce7bd..ab8f8d751081 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1604,12 +1604,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 
 	intel_hdmi_unset_edid(connector);
 
-	if (intel_hdmi_set_edid(connector)) {
-		struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-
-		hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
+	if (intel_hdmi_set_edid(connector))
 		status = connector_status_connected;
-	} else
+	else
 		status = connector_status_disconnected;
 
 	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
@@ -1620,8 +1617,6 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 static void
 intel_hdmi_force(struct drm_connector *connector)
 {
-	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-
 	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
 		      connector->base.id, connector->name);
 
@@ -1631,7 +1626,6 @@ intel_hdmi_force(struct drm_connector *connector)
 		return;
 
 	intel_hdmi_set_edid(connector);
-	hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
 }
 
 static int intel_hdmi_get_modes(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index 98154efcb2f4..d57ade0b652a 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -383,7 +383,7 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
 	case INTEL_OUTPUT_ANALOG:
 		type = DISPLAY_TYPE_CRT;
 		break;
-	case INTEL_OUTPUT_UNKNOWN:
+	case INTEL_OUTPUT_DDI:
 	case INTEL_OUTPUT_DP:
 	case INTEL_OUTPUT_HDMI:
 	case INTEL_OUTPUT_DP_MST:
-- 
2.13.5

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 58+ messages in thread

* ✓ Fi.CI.BAT: success for drm/i915: Eliminate DDI encoder->type frobbery redux (rev4)
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (33 preceding siblings ...)
  2017-09-21 13:18 ` ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev3) Patchwork
@ 2017-09-21 15:36 ` Patchwork
  2017-09-21 18:26 ` ✗ Fi.CI.IGT: failure " Patchwork
  35 siblings, 0 replies; 58+ messages in thread
From: Patchwork @ 2017-09-21 15:36 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Eliminate DDI encoder->type frobbery redux (rev4)
URL   : https://patchwork.freedesktop.org/series/30548/
State : success

== Summary ==

Series 30548v4 drm/i915: Eliminate DDI encoder->type frobbery redux
https://patchwork.freedesktop.org/api/1.0/series/30548/revisions/4/mbox/

Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                fail       -> PASS       (fi-snb-2600) fdo#100215
Test drv_module_reload:
        Subgroup basic-reload:
                pass       -> DMESG-WARN (fi-glk-1) fdo#102777

fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215
fdo#102777 https://bugs.freedesktop.org/show_bug.cgi?id=102777

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:442s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:468s
fi-blb-e6850     total:289  pass:224  dwarn:1   dfail:0   fail:0   skip:64  time:419s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:514s
fi-bwr-2160      total:289  pass:184  dwarn:0   dfail:0   fail:0   skip:105 time:279s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:495s
fi-byt-j1900     total:289  pass:254  dwarn:1   dfail:0   fail:0   skip:34  time:494s
fi-byt-n2820     total:289  pass:250  dwarn:1   dfail:0   fail:0   skip:38  time:490s
fi-cfl-s         total:289  pass:223  dwarn:34  dfail:0   fail:0   skip:32  time:545s
fi-elk-e7500     total:289  pass:230  dwarn:0   dfail:0   fail:0   skip:59  time:419s
fi-glk-1         total:289  pass:259  dwarn:1   dfail:0   fail:0   skip:29  time:564s
fi-hsw-4770      total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:423s
fi-hsw-4770r     total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:401s
fi-ilk-650       total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:432s
fi-ivb-3520m     total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:487s
fi-ivb-3770      total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:462s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:471s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:579s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:584s
fi-pnv-d510      total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:542s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:452s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:759s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:490s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:476s
fi-snb-2520m     total:289  pass:251  dwarn:0   dfail:0   fail:0   skip:38  time:570s
fi-snb-2600      total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:416s

01a2040bb790263c0d32ec30d83bd2ddf3b922c2 drm-tip: 2017y-09m-21d-13h-23m-06s UTC integration manifest
0d436ce0607c drm/i915: Pass a crtc state to ddi post_disable from MST code
06ee9d5e1968 drm/i915: Replace most intel_ddi_get_encoder_port() alls with encoder->port
35f95362bef7 drm/i915: Clear up the types we use for DDI buf trans level/n_entries
75d4c084aa69 drm/i915: Unify error handling for missing DDI buf trans tables
b740892f7d5f drm/i915: Stop frobbing with DDI encoder->type
b8b0743053f6 drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling
c9ecfc1b6dae drm/i915: Stop using encoder->type in intel_ddi_enable_transcoder_func()
9df2b07256dc drm/i915: Start using output_types for DPLL selection
c395dd510660 drm/i915: Pass crtc state to intel_prepare_dp_ddi_buffers()
67099547f5c4 drm/i915: Don't use encoder->type in intel_ddi_set_pipe_settings()
934c4f1c46db drm/i915: Kill off the BXT buf_trans default_index
b4c12f00b0ab drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly
9265fe78bec2 drm/i915: Integrate BXT into intel_ddi_dp_voltage_max()
bae07ed9119f drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers()
5e1400daa0af drm/i915: Pass the encoder type explicitly to skl_set_iboost()
2d0d93dba6ac drm/i915: Extract intel_ddi_get_buf_trans_hdmi()
bc6bf91f6815 drm/i915: Relocate intel_ddi_get_buf_trans_*() functions
5da01d6a42c6 drm/i915: Split intel_enable_ddi() into DP and HDMI variants
17f0fa8b4714 drm/i915: Plump crtc_state etc. directly to intel_ddi_pre_enable_{dp, hdmi}()
3fc8810273fc drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants
578f4af09991 drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp()
e43133e54173 drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants
66dc29cdd552 drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable()
6bca6d71144f drm/i915: Extract intel_disable_ddi_buf()
a0cc3a170cf3 drm/i915: Extract intel_ddi_clk_disable()
f5f173ad95f3 drm/i915: Dump 'output_types' in crtc state dump

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5782/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* ✗ Fi.CI.IGT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev4)
  2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
                   ` (34 preceding siblings ...)
  2017-09-21 15:36 ` ✓ Fi.CI.BAT: success for drm/i915: Eliminate DDI encoder->type frobbery redux (rev4) Patchwork
@ 2017-09-21 18:26 ` Patchwork
  35 siblings, 0 replies; 58+ messages in thread
From: Patchwork @ 2017-09-21 18:26 UTC (permalink / raw)
  To: Ville Syrjala; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Eliminate DDI encoder->type frobbery redux (rev4)
URL   : https://patchwork.freedesktop.org/series/30548/
State : failure

== Summary ==

Test perf:
        Subgroup polling:
                fail       -> PASS       (shard-hsw) fdo#102252 +1
Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912
Test kms_flip:
        Subgroup plain-flip-ts-check-interruptible:
                pass       -> FAIL       (shard-hsw)

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

shard-hsw        total:2429 pass:1330 dwarn:4   dfail:0   fail:12  skip:1083 time:9788s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_5782/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev2)
  2017-09-20 15:46   ` Ville Syrjälä
@ 2017-09-25 11:40     ` Jani Nikula
  0 siblings, 0 replies; 58+ messages in thread
From: Jani Nikula @ 2017-09-25 11:40 UTC (permalink / raw)
  To: Ville Syrjälä, intel-gfx

On Wed, 20 Sep 2017, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> 3 out of 3. I guess I'll have to believe that there's a real
> problem somewhere :(

I don't think it's unreasonable to send the obviously good and reviewed
prep patches first in a separate thread and have them tested and merged.

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2017-09-25 11:40 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-18 18:25 [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Ville Syrjala
2017-09-18 18:25 ` [PATCH 01/29] drm/i915: Replace some spaces with tabs Ville Syrjala
2017-09-18 18:38   ` Chris Wilson
2017-09-18 18:53   ` Jani Nikula
2017-09-18 18:25 ` [PATCH 02/29] drm/i915: Shrink bxt_ddi_buf_trans Ville Syrjala
2017-09-18 18:54   ` Jani Nikula
2017-09-18 18:25 ` [PATCH 03/29] drm/i915: Shrink cnl_ddi_buf_trans Ville Syrjala
2017-09-18 18:39   ` Chris Wilson
2017-09-18 18:40   ` Chris Wilson
2017-09-18 19:02     ` Chris Wilson
2017-09-18 18:25 ` [PATCH 04/29] drm/i915: Dump 'output_types' in crtc state dump Ville Syrjala
2017-09-18 18:43   ` Chris Wilson
2017-09-18 18:56     ` Ville Syrjälä
2017-09-18 18:54   ` Jani Nikula
2017-09-20 14:03   ` [PATCH v2 " Ville Syrjala
2017-09-18 18:25 ` [PATCH 05/29] drm/i915: Extract intel_ddi_clk_disable() Ville Syrjala
2017-09-18 18:45   ` Chris Wilson
2017-09-18 19:09     ` Ville Syrjälä
2017-09-18 18:25 ` [PATCH 06/29] drm/i915: Extract intel_disable_ddi_buf() Ville Syrjala
2017-09-18 18:55   ` Jani Nikula
2017-09-18 18:25 ` [PATCH 07/29] drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable() Ville Syrjala
2017-09-18 18:55   ` Jani Nikula
2017-09-18 18:25 ` [PATCH 08/29] drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants Ville Syrjala
2017-09-18 18:56   ` Jani Nikula
2017-09-18 18:25 ` [PATCH 09/29] drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp() Ville Syrjala
2017-09-18 18:56   ` Jani Nikula
2017-09-18 18:25 ` [PATCH 10/29] drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants Ville Syrjala
2017-09-18 18:25 ` [PATCH 11/29] drm/i915: Plump crtc_state etc. directly to intel_ddi_pre_enable_{dp, hdmi}() Ville Syrjala
2017-09-18 18:25 ` [PATCH 12/29] drm/i915: Split intel_enable_ddi() into DP and HDMI variants Ville Syrjala
2017-09-18 18:25 ` [PATCH 13/29] drm/i915: Relocate intel_ddi_get_buf_trans_*() functions Ville Syrjala
2017-09-18 18:25 ` [PATCH 14/29] drm/i915: Extract intel_ddi_get_buf_trans_hdmi() Ville Syrjala
2017-09-18 18:25 ` [PATCH 15/29] drm/i915: Pass the encoder type explicitly to skl_set_iboost() Ville Syrjala
2017-09-18 18:25 ` [PATCH 16/29] drm/i915: Pass the level to intel_prepare_hdmi_ddi_buffers() Ville Syrjala
2017-09-18 18:25 ` [PATCH 17/29] drm/i915: Integrate BXT into intel_ddi_dp_voltage_max() Ville Syrjala
2017-09-18 18:25 ` [PATCH 18/29] drm/i915: Pass encoder type to cnl_ddi_vswing_sequence() explicitly Ville Syrjala
2017-09-18 18:25 ` [PATCH 19/29] drm/i915: Kill off the BXT buf_trans default_index Ville Syrjala
2017-09-18 18:25 ` [PATCH 20/29] drm/i915: Don't use encoder->type in intel_ddi_set_pipe_settings() Ville Syrjala
2017-09-18 18:25 ` [PATCH 21/29] drm/i915: Pass crtc state to intel_prepare_dp_ddi_buffers() Ville Syrjala
2017-09-18 18:25 ` [PATCH 22/29] drm/i915: Start using output_types for DPLL selection Ville Syrjala
2017-09-18 18:25 ` [PATCH 23/29] drm/i915: Stop using encoder->type in intel_ddi_enable_transcoder_func() Ville Syrjala
2017-09-18 18:25 ` [PATCH 24/29] drm/i915: Centralize the SKL DDI A/E vs. B/C/D buf trans handling Ville Syrjala
2017-09-18 18:26 ` [PATCH 25/29] drm/i915: Stop frobbing with DDI encoder->type Ville Syrjala
2017-09-21 11:06   ` [PATCH v2 " Ville Syrjala
2017-09-21 14:56   ` [PATCH v3 " Ville Syrjala
2017-09-18 18:26 ` [PATCH 26/29] drm/i915: Unify error handling for missing DDI buf trans tables Ville Syrjala
2017-09-18 18:26 ` [PATCH 27/29] drm/i915: Clear up the types we use for DDI buf trans level/n_entries Ville Syrjala
2017-09-18 18:26 ` [PATCH 28/29] drm/i915: Replace most intel_ddi_get_encoder_port() alls with encoder->port Ville Syrjala
2017-09-18 18:26 ` [PATCH 29/29] drm/i915: Pass a crtc state to ddi post_disable from MST code Ville Syrjala
2017-09-18 19:02   ` Jani Nikula
2017-09-18 19:04 ` [PATCH 00/29] drm/i915: Eliminate DDI encoder->type frobbery redux Jani Nikula
2017-09-18 19:46 ` ✗ Fi.CI.BAT: failure for " Patchwork
2017-09-20 14:26 ` ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev2) Patchwork
2017-09-20 15:40 ` Patchwork
2017-09-20 15:46   ` Ville Syrjälä
2017-09-25 11:40     ` Jani Nikula
2017-09-21 13:18 ` ✗ Fi.CI.BAT: failure for drm/i915: Eliminate DDI encoder->type frobbery redux (rev3) Patchwork
2017-09-21 15:36 ` ✓ Fi.CI.BAT: success for drm/i915: Eliminate DDI encoder->type frobbery redux (rev4) Patchwork
2017-09-21 18:26 ` ✗ Fi.CI.IGT: failure " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.