Skip to contentSkip to conversation

drm/i915: Fix bogus dig_port_map[] assignment for pre-HSW

PATCH In review Takashi Iwai 5 participants 10 messages Feb 24, 2016 – Mar 7, 2016

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

PATCH 1/1 drm/i915: Fix bogus dig_port_map[] assignment for pre-HSW

The recent commit [0bdf5a05647a: drm/i915: Add reverse mapping between port and intel_encoder] introduced a reverse mapping to retrieve intel_dig_port object from the port number. The code assumed that the port vs intel_dig_port are 1:1 mapping. But in reality, this was a too naive assumption.

As Martin reported about the missing HDMI audio on his SNB machine, pre-HSW chips may have multiple intel_dig_port objects corresponding to the same port. Since we assign the mapping statically at the init time and the multiple objects override the map, it may not match with the actually enabled output.

This patch tries to address the regression above. The reverse mapping is provided basically only for the audio callbacks, so now we set / clear the mapping dynamically at enabling and disabling HDMI/DP audio, so that we can always track the latest and correct object corresponding to the given port.

Fixes 0bdf5a05647a ('drm/i915: Add reverse mapping between port and intel_encoder')
---
 drivers/gpu/drm/i915/intel_audio.c | 3 +++
 drivers/gpu/drm/i915/intel_ddi.c   | 1 -
 drivers/gpu/drm/i915/intel_dp.c    | 1 -
 drivers/gpu/drm/i915/intel_hdmi.c  | 2 --
 4 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_audio.c +3 -0
index 31f6d212fb1b..30f921421b0c 100644
@@ -527,6 +527,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = connector;
+	/* referred in audio callbacks */
+	dev_priv->dig_port_map[port] = intel_encoder;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
@@ -554,6 +556,7 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = NULL;
+	dev_priv->dig_port_map[port] = NULL;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
drivers/gpu/drm/i915/intel_ddi.c +0 -1
index 54a165b9c92d..a50fc452d5f1 100644
@@ -3312,7 +3312,6 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_encoder->get_config = intel_ddi_get_config;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
 					  (DDI_BUF_PORT_REVERSAL |
 					   DDI_A_4_LANES);
drivers/gpu/drm/i915/intel_dp.c +0 -1
index 1bbd67b046da..acf918728492 100644
@@ -6035,7 +6035,6 @@ intel_dp_init(struct drm_device *dev,
 	}
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->dp.output_reg = output_reg;
 
 	intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
drivers/gpu/drm/i915/intel_hdmi.c +0 -2
index 4a77639a489d..23ee48dc765f 100644
@@ -2146,7 +2146,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 void intel_hdmi_init(struct drm_device *dev,
 		     i915_reg_t hdmi_reg, enum port port)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *intel_encoder;
 	struct intel_connector *intel_connector;
@@ -2215,7 +2214,6 @@ void intel_hdmi_init(struct drm_device *dev,
 		intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
 	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
 
Signature · 6 lines
2.7.2

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

Sorry, Cc to Jani was missing mistakenly.

Please check this. It's a regression in 4.5-rc.

thanks,

Takashi

Quoted 101 lines · Takashi Iwai

The recent commit [0bdf5a05647a: drm/i915: Add reverse mapping between port and intel_encoder] introduced a reverse mapping to retrieve intel_dig_port object from the port number. The code assumed that the port vs intel_dig_port are 1:1 mapping. But in reality, this was a too naive assumption.

As Martin reported about the missing HDMI audio on his SNB machine, pre-HSW chips may have multiple intel_dig_port objects corresponding to the same port. Since we assign the mapping statically at the init time and the multiple objects override the map, it may not match with the actually enabled output.

This patch tries to address the regression above. The reverse mapping is provided basically only for the audio callbacks, so now we set / clear the mapping dynamically at enabling and disabling HDMI/DP audio, so that we can always track the latest and correct object corresponding to the given port.

Fixes 0bdf5a05647a ('drm/i915: Add reverse mapping between port and intel_encoder')
---
 drivers/gpu/drm/i915/intel_audio.c | 3 +++
 drivers/gpu/drm/i915/intel_ddi.c   | 1 -
 drivers/gpu/drm/i915/intel_dp.c    | 1 -
 drivers/gpu/drm/i915/intel_hdmi.c  | 2 --
 4 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_audio.c +3 -0
index 31f6d212fb1b..30f921421b0c 100644
@@ -527,6 +527,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = connector;
+	/* referred in audio callbacks */
+	dev_priv->dig_port_map[port] = intel_encoder;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
@@ -554,6 +556,7 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = NULL;
+	dev_priv->dig_port_map[port] = NULL;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
drivers/gpu/drm/i915/intel_ddi.c +0 -1
index 54a165b9c92d..a50fc452d5f1 100644
@@ -3312,7 +3312,6 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_encoder->get_config = intel_ddi_get_config;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
 					  (DDI_BUF_PORT_REVERSAL |
 					   DDI_A_4_LANES);
drivers/gpu/drm/i915/intel_dp.c +0 -1
index 1bbd67b046da..acf918728492 100644
@@ -6035,7 +6035,6 @@ intel_dp_init(struct drm_device *dev,
 	}
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->dp.output_reg = output_reg;
 
 	intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
drivers/gpu/drm/i915/intel_hdmi.c +0 -2
index 4a77639a489d..23ee48dc765f 100644
@@ -2146,7 +2146,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 void intel_hdmi_init(struct drm_device *dev,
 		     i915_reg_t hdmi_reg, enum port port)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *intel_encoder;
 	struct intel_connector *intel_connector;
@@ -2215,7 +2214,6 @@ void intel_hdmi_init(struct drm_device *dev,
 		intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
 	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
 
Signature · 6 lines
2.7.2

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

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

#2 lore raw

Am 2016-02-26 um 20:59 schrieb Takashi Iwai:

Quoted 9 lines

Sorry, Cc to Jani was missing mistakenly.

Please check this. It's a regression in 4.5-rc.

thanks,

Takashi

I can confirm that with -rc6 nothing changed and this fixes audio over HDMI for me. I added David Airlie and dri-devel to CC aswell and hope that this can go in for 4.5 in the last minute.

thanks
martin

Quoted 96 lines
Quoted 94 lines · Takashi Iwai

The recent commit [0bdf5a05647a: drm/i915: Add reverse mapping between port and intel_encoder] introduced a reverse mapping to retrieve intel_dig_port object from the port number. The code assumed that the port vs intel_dig_port are 1:1 mapping. But in reality, this was a too naive assumption.

As Martin reported about the missing HDMI audio on his SNB machine, pre-HSW chips may have multiple intel_dig_port objects corresponding to the same port. Since we assign the mapping statically at the init time and the multiple objects override the map, it may not match with the actually enabled output.

This patch tries to address the regression above. The reverse mapping is provided basically only for the audio callbacks, so now we set / clear the mapping dynamically at enabling and disabling HDMI/DP audio, so that we can always track the latest and correct object corresponding to the given port.

Fixes 0bdf5a05647a ('drm/i915: Add reverse mapping between port and intel_encoder')
---
 drivers/gpu/drm/i915/intel_audio.c | 3 +++
 drivers/gpu/drm/i915/intel_ddi.c   | 1 -
 drivers/gpu/drm/i915/intel_dp.c    | 1 -
 drivers/gpu/drm/i915/intel_hdmi.c  | 2 --
 4 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_audio.c +3 -0
index 31f6d212fb1b..30f921421b0c 100644
@@ -527,6 +527,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = connector;
+	/* referred in audio callbacks */
+	dev_priv->dig_port_map[port] = intel_encoder;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
@@ -554,6 +556,7 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = NULL;
+	dev_priv->dig_port_map[port] = NULL;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
drivers/gpu/drm/i915/intel_ddi.c +0 -1
index 54a165b9c92d..a50fc452d5f1 100644
@@ -3312,7 +3312,6 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_encoder->get_config = intel_ddi_get_config;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
 					  (DDI_BUF_PORT_REVERSAL |
 					   DDI_A_4_LANES);
drivers/gpu/drm/i915/intel_dp.c +0 -1
index 1bbd67b046da..acf918728492 100644
@@ -6035,7 +6035,6 @@ intel_dp_init(struct drm_device *dev,
 	}
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->dp.output_reg = output_reg;
 
 	intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
drivers/gpu/drm/i915/intel_hdmi.c +0 -2
index 4a77639a489d..23ee48dc765f 100644
@@ -2146,7 +2146,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 void intel_hdmi_init(struct drm_device *dev,
 		     i915_reg_t hdmi_reg, enum port port)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *intel_encoder;
 	struct intel_connector *intel_connector;
@@ -2215,7 +2214,6 @@ void intel_hdmi_init(struct drm_device *dev,
 		intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
 	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
 
Quoted 7 lines
Quoted 7 lines
Signature · 6 lines
2.7.2

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

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

maintainer
#3 lore raw
Quoted 6 lines · Martin Kepplinger

Am 2016-02-26 um 20:59 schrieb Takashi Iwai:

Quoted 5 lines

Sorry, Cc to Jani was missing mistakenly.

Please check this. It's a regression in 4.5-rc.

Quoted 8 lines
Quoted 4 lines

thanks,

Takashi

I can confirm that with -rc6 nothing changed and this fixes audio over HDMI for me. I added David Airlie and dri-devel to CC aswell and hope that this can go in for 4.5 in the last minute.

I'll pick this up when we get the CI results. (This had fallen between the cracks...)

BR,
Jani.

Quoted 109 lines

thanks
martin

Quoted 103 lines
Quoted 101 lines · Takashi Iwai

The recent commit [0bdf5a05647a: drm/i915: Add reverse mapping between port and intel_encoder] introduced a reverse mapping to retrieve intel_dig_port object from the port number. The code assumed that the port vs intel_dig_port are 1:1 mapping. But in reality, this was a too naive assumption.

As Martin reported about the missing HDMI audio on his SNB machine, pre-HSW chips may have multiple intel_dig_port objects corresponding to the same port. Since we assign the mapping statically at the init time and the multiple objects override the map, it may not match with the actually enabled output.

This patch tries to address the regression above. The reverse mapping is provided basically only for the audio callbacks, so now we set / clear the mapping dynamically at enabling and disabling HDMI/DP audio, so that we can always track the latest and correct object corresponding to the given port.

Fixes 0bdf5a05647a ('drm/i915: Add reverse mapping between port and intel_encoder')
---
 drivers/gpu/drm/i915/intel_audio.c | 3 +++
 drivers/gpu/drm/i915/intel_ddi.c   | 1 -
 drivers/gpu/drm/i915/intel_dp.c    | 1 -
 drivers/gpu/drm/i915/intel_hdmi.c  | 2 --
 4 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_audio.c +3 -0
index 31f6d212fb1b..30f921421b0c 100644
@@ -527,6 +527,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = connector;
+	/* referred in audio callbacks */
+	dev_priv->dig_port_map[port] = intel_encoder;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
@@ -554,6 +556,7 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = NULL;
+	dev_priv->dig_port_map[port] = NULL;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
drivers/gpu/drm/i915/intel_ddi.c +0 -1
index 54a165b9c92d..a50fc452d5f1 100644
@@ -3312,7 +3312,6 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_encoder->get_config = intel_ddi_get_config;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
 					  (DDI_BUF_PORT_REVERSAL |
 					   DDI_A_4_LANES);
drivers/gpu/drm/i915/intel_dp.c +0 -1
index 1bbd67b046da..acf918728492 100644
@@ -6035,7 +6035,6 @@ intel_dp_init(struct drm_device *dev,
 	}
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->dp.output_reg = output_reg;
 
 	intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
drivers/gpu/drm/i915/intel_hdmi.c +0 -2
index 4a77639a489d..23ee48dc765f 100644
@@ -2146,7 +2146,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 void intel_hdmi_init(struct drm_device *dev,
 		     i915_reg_t hdmi_reg, enum port port)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *intel_encoder;
 	struct intel_connector *intel_connector;
@@ -2215,7 +2214,6 @@ void intel_hdmi_init(struct drm_device *dev,
 		intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
 	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
 
Signature · 6 lines
2.7.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 13 lines · Jani Nikula
Quoted 11 lines · Martin Kepplinger

Am 2016-02-26 um 20:59 schrieb Takashi Iwai:

Quoted 9 lines

Sorry, Cc to Jani was missing mistakenly.

Please check this. It's a regression in 4.5-rc.

thanks,

Takashi

Quoted 6 lines
Quoted 3 lines

I can confirm that with -rc6 nothing changed and this fixes audio over HDMI for me. I added David Airlie and dri-devel to CC aswell and hope that this can go in for 4.5 in the last minute.

I'll pick this up when we get the CI results. (This had fallen between the cracks...)

As far as looking at linux-next, this one still seems remaining in the crevasse...

thanks,

Takashi

Quoted 107 lines

BR,
Jani.

Quoted 101 lines

thanks
martin

Quoted 96 lines
Quoted 94 lines · Takashi Iwai

The recent commit [0bdf5a05647a: drm/i915: Add reverse mapping between port and intel_encoder] introduced a reverse mapping to retrieve intel_dig_port object from the port number. The code assumed that the port vs intel_dig_port are 1:1 mapping. But in reality, this was a too naive assumption.

As Martin reported about the missing HDMI audio on his SNB machine, pre-HSW chips may have multiple intel_dig_port objects corresponding to the same port. Since we assign the mapping statically at the init time and the multiple objects override the map, it may not match with the actually enabled output.

This patch tries to address the regression above. The reverse mapping is provided basically only for the audio callbacks, so now we set / clear the mapping dynamically at enabling and disabling HDMI/DP audio, so that we can always track the latest and correct object corresponding to the given port.

Fixes 0bdf5a05647a ('drm/i915: Add reverse mapping between port and intel_encoder')
---
 drivers/gpu/drm/i915/intel_audio.c | 3 +++
 drivers/gpu/drm/i915/intel_ddi.c   | 1 -
 drivers/gpu/drm/i915/intel_dp.c    | 1 -
 drivers/gpu/drm/i915/intel_hdmi.c  | 2 --
 4 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_audio.c +3 -0
index 31f6d212fb1b..30f921421b0c 100644
@@ -527,6 +527,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = connector;
+	/* referred in audio callbacks */
+	dev_priv->dig_port_map[port] = intel_encoder;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
@@ -554,6 +556,7 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = NULL;
+	dev_priv->dig_port_map[port] = NULL;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
drivers/gpu/drm/i915/intel_ddi.c +0 -1
index 54a165b9c92d..a50fc452d5f1 100644
@@ -3312,7 +3312,6 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_encoder->get_config = intel_ddi_get_config;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
 					  (DDI_BUF_PORT_REVERSAL |
 					   DDI_A_4_LANES);
drivers/gpu/drm/i915/intel_dp.c +0 -1
index 1bbd67b046da..acf918728492 100644
@@ -6035,7 +6035,6 @@ intel_dp_init(struct drm_device *dev,
 	}
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->dp.output_reg = output_reg;
 
 	intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
drivers/gpu/drm/i915/intel_hdmi.c +0 -2
index 4a77639a489d..23ee48dc765f 100644
@@ -2146,7 +2146,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 void intel_hdmi_init(struct drm_device *dev,
 		     i915_reg_t hdmi_reg, enum port port)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *intel_encoder;
 	struct intel_connector *intel_connector;
@@ -2215,7 +2214,6 @@ void intel_hdmi_init(struct drm_device *dev,
 		intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
 	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
 
Quoted 12 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Signature · 6 lines
2.7.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center

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

#5 lore raw

Am 2016-03-03 um 16:05 schrieb Takashi Iwai:

Quoted 19 lines
Quoted 17 lines · Jani Nikula
Quoted 14 lines · Martin Kepplinger

Am 2016-02-26 um 20:59 schrieb Takashi Iwai:

Quoted 9 lines

Sorry, Cc to Jani was missing mistakenly.

Please check this. It's a regression in 4.5-rc.

thanks,

Takashi

I can confirm that with -rc6 nothing changed and this fixes audio over HDMI for me. I added David Airlie and dri-devel to CC aswell and hope that this can go in for 4.5 in the last minute.

Quoted 6 lines
Quoted 2 lines

I'll pick this up when we get the CI results. (This had fallen between the cracks...)

As far as looking at linux-next, this one still seems remaining in the crevasse...

This still isn't merged but still fixes a serious regression in v4.5. What's going on?

thanks
martin

Quoted 124 lines

thanks,

Takashi

Quoted 119 lines

BR,
Jani.

Quoted 109 lines

thanks
martin

Quoted 103 lines
Quoted 101 lines · Takashi Iwai

The recent commit [0bdf5a05647a: drm/i915: Add reverse mapping between port and intel_encoder] introduced a reverse mapping to retrieve intel_dig_port object from the port number. The code assumed that the port vs intel_dig_port are 1:1 mapping. But in reality, this was a too naive assumption.

As Martin reported about the missing HDMI audio on his SNB machine, pre-HSW chips may have multiple intel_dig_port objects corresponding to the same port. Since we assign the mapping statically at the init time and the multiple objects override the map, it may not match with the actually enabled output.

This patch tries to address the regression above. The reverse mapping is provided basically only for the audio callbacks, so now we set / clear the mapping dynamically at enabling and disabling HDMI/DP audio, so that we can always track the latest and correct object corresponding to the given port.

Fixes 0bdf5a05647a ('drm/i915: Add reverse mapping between port and intel_encoder')
---
 drivers/gpu/drm/i915/intel_audio.c | 3 +++
 drivers/gpu/drm/i915/intel_ddi.c   | 1 -
 drivers/gpu/drm/i915/intel_dp.c    | 1 -
 drivers/gpu/drm/i915/intel_hdmi.c  | 2 --
 4 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_audio.c +3 -0
index 31f6d212fb1b..30f921421b0c 100644
@@ -527,6 +527,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = connector;
+	/* referred in audio callbacks */
+	dev_priv->dig_port_map[port] = intel_encoder;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
@@ -554,6 +556,7 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = NULL;
+	dev_priv->dig_port_map[port] = NULL;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
drivers/gpu/drm/i915/intel_ddi.c +0 -1
index 54a165b9c92d..a50fc452d5f1 100644
@@ -3312,7 +3312,6 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_encoder->get_config = intel_ddi_get_config;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
 					  (DDI_BUF_PORT_REVERSAL |
 					   DDI_A_4_LANES);
drivers/gpu/drm/i915/intel_dp.c +0 -1
index 1bbd67b046da..acf918728492 100644
@@ -6035,7 +6035,6 @@ intel_dp_init(struct drm_device *dev,
 	}
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->dp.output_reg = output_reg;
 
 	intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
drivers/gpu/drm/i915/intel_hdmi.c +0 -2
index 4a77639a489d..23ee48dc765f 100644
@@ -2146,7 +2146,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 void intel_hdmi_init(struct drm_device *dev,
 		     i915_reg_t hdmi_reg, enum port port)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *intel_encoder;
 	struct intel_connector *intel_connector;
@@ -2215,7 +2214,6 @@ void intel_hdmi_init(struct drm_device *dev,
 		intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
 	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
 
Signature · 6 lines
2.7.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center

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

maintainer
#6 lore raw
Quoted 2 lines · Martin Kepplinger

This still isn't merged but still fixes a serious regression in v4.5. What's going on?

Bumps in the CI road. Now pushed to drm-intel-next-queued and cherry-picked to drm-intel-fixes, en route to v4.5. Thanks for the patch, review, and testing.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#7 lore raw
In reply to Takashi Iwai
Quoted 18 lines · Takashi Iwai

The recent commit [0bdf5a05647a: drm/i915: Add reverse mapping between port and intel_encoder] introduced a reverse mapping to retrieve intel_dig_port object from the port number. The code assumed that the port vs intel_dig_port are 1:1 mapping. But in reality, this was a too naive assumption.

As Martin reported about the missing HDMI audio on his SNB machine, pre-HSW chips may have multiple intel_dig_port objects corresponding to the same port. Since we assign the mapping statically at the init time and the multiple objects override the map, it may not match with the actually enabled output.

This patch tries to address the regression above. The reverse mapping is provided basically only for the audio callbacks, so now we set / clear the mapping dynamically at enabling and disabling HDMI/DP audio, so that we can always track the latest and correct object corresponding to the given port.

Quoted 3 lines
Fixes 0bdf5a05647a ('drm/i915: Add reverse mapping between port and intel_encoder')

lgtm

Quoted 74 lines
---
 drivers/gpu/drm/i915/intel_audio.c | 3 +++
 drivers/gpu/drm/i915/intel_ddi.c   | 1 -
 drivers/gpu/drm/i915/intel_dp.c    | 1 -
 drivers/gpu/drm/i915/intel_hdmi.c  | 2 --
 4 files changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_audio.c +3 -0
index 31f6d212fb1b..30f921421b0c 100644
@@ -527,6 +527,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = connector;
+	/* referred in audio callbacks */
+	dev_priv->dig_port_map[port] = intel_encoder;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
@@ -554,6 +556,7 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 
 	mutex_lock(&dev_priv->av_mutex);
 	intel_dig_port->audio_connector = NULL;
+	dev_priv->dig_port_map[port] = NULL;
 	mutex_unlock(&dev_priv->av_mutex);
 
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
drivers/gpu/drm/i915/intel_ddi.c +0 -1
index 54a165b9c92d..a50fc452d5f1 100644
@@ -3312,7 +3312,6 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
 	intel_encoder->get_config = intel_ddi_get_config;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->saved_port_bits = I915_READ(DDI_BUF_CTL(port)) &
 					  (DDI_BUF_PORT_REVERSAL |
 					   DDI_A_4_LANES);
drivers/gpu/drm/i915/intel_dp.c +0 -1
index 1bbd67b046da..acf918728492 100644
@@ -6035,7 +6035,6 @@ intel_dp_init(struct drm_device *dev,
 	}
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->dp.output_reg = output_reg;
 
 	intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
drivers/gpu/drm/i915/intel_hdmi.c +0 -2
index 4a77639a489d..23ee48dc765f 100644
@@ -2146,7 +2146,6 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
 void intel_hdmi_init(struct drm_device *dev,
 		     i915_reg_t hdmi_reg, enum port port)
 {
-	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_digital_port *intel_dig_port;
 	struct intel_encoder *intel_encoder;
 	struct intel_connector *intel_connector;
@@ -2215,7 +2214,6 @@ void intel_hdmi_init(struct drm_device *dev,
 		intel_encoder->cloneable |= 1 << INTEL_OUTPUT_HDMI;
 
 	intel_dig_port->port = port;
-	dev_priv->dig_port_map[port] = intel_encoder;
 	intel_dig_port->hdmi.hdmi_reg = hdmi_reg;
 	intel_dig_port->dp.output_reg = INVALID_MMIO_REG;
 
Signature · 1 line
2.7.2
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#8 lore raw

✗ Fi.CI.BAT: failure for drm/i915: Fix bogus dig_port_map[] assignment for pre-HSW

In reply to Takashi Iwai
== Series Details ==

== Series Details ==

Series: drm/i915: Fix bogus dig_port_map[] assignment for pre-HSW
URL : https://patchwork.freedesktop.org/series/3916/
State : failure

== Summary ==

Series 3916v1 drm/i915: Fix bogus dig_port_map[] assignment for pre-HSW
http://patchwork.freedesktop.org/api/1.0/series/3916/revisions/1/mbox/

Test drv_hangman:

        Subgroup error-state-basic:
                pass       -> INCOMPLETE (snb-x220t)
Test drv_module_reload_basic:
                pass       -> INCOMPLETE (snb-x220t)
Test gem_ctx_param_basic:
        Subgroup invalid-ctx-get:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup invalid-ctx-set:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup invalid-param-set:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup invalid-size-set:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup non-root-set:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup root-set:
                pass       -> INCOMPLETE (snb-x220t)
Test gem_exec_basic:
        Subgroup basic-default:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup basic-render:
                pass       -> INCOMPLETE (snb-x220t)
Test gem_flink_basic:
        Subgroup bad-open:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup basic:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup flink-lifetime:
                pass       -> INCOMPLETE (snb-x220t)
Test gem_mmap_gtt:
        Subgroup basic-copy:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup basic-read-write:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup basic-small-bo-tiledx:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup basic-small-copy-xy:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup basic-write-cpu-read-gtt:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup basic-write-read-distinct:
                pass       -> INCOMPLETE (snb-x220t)
Test gem_ringfill:
        Subgroup basic-default-hang:
                pass       -> INCOMPLETE (snb-x220t)
Test gem_sync:
        Subgroup basic-blt:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup basic-bsd2:
                skip       -> INCOMPLETE (snb-x220t)
Test kms_addfb_basic:
        Subgroup addfb25-y-tiled-small:
                skip       -> INCOMPLETE (snb-x220t)
        Subgroup bad-pitch-1024:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup bad-pitch-32:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup bo-too-small-due-to-tiling:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup size-max:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup too-high:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup unused-pitches:
                pass       -> INCOMPLETE (snb-x220t)
Test kms_flip:
        Subgroup basic-flip-vs-dpms:
                pass       -> INCOMPLETE (skl-i5k-2)
                pass       -> INCOMPLETE (snb-x220t)
Test kms_force_connector_basic:
        Subgroup force-connector-state:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup force-edid:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup force-load-detect:
                fail       -> INCOMPLETE (snb-x220t)
                fail       -> DMESG-FAIL (snb-dellxps)
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-a:
                skip       -> PASS       (hsw-brixbox)
        Subgroup hang-read-crc-pipe-b:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup nonblocking-crc-pipe-a-frame-sequence:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup read-crc-pipe-a-frame-sequence:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup read-crc-pipe-c-frame-sequence:
                skip       -> INCOMPLETE (snb-x220t)
        Subgroup suspend-read-crc-pipe-a:
                pass       -> INCOMPLETE (snb-x220t)
        Subgroup suspend-read-crc-pipe-c:
                pass       -> DMESG-WARN (bsw-nuc-2)
Test pm_backlight:
        Subgroup basic-brightness:
                pass       -> INCOMPLETE (snb-x220t)
Test pm_rpm:
        Subgroup basic-pci-d3-state:
                pass       -> DMESG-WARN (bsw-nuc-2)
Test prime_self_import:
        Subgroup basic-with_one_bo_two_files:
                pass       -> INCOMPLETE (snb-x220t)
bdw-nuci7        total:166  pass:155  dwarn:0   dfail:0   fail:0   skip:11 
bsw-nuc-2        total:169  pass:136  dwarn:2   dfail:0   fail:1   skip:30 
byt-nuc          total:47   pass:40   dwarn:0   dfail:0   fail:0   skip:7  
hsw-brixbox      total:169  pass:155  dwarn:0   dfail:0   fail:0   skip:14 
hsw-gt2          total:169  pass:158  dwarn:0   dfail:0   fail:1   skip:10 
ivb-t430s        total:169  pass:154  dwarn:0   dfail:0   fail:1   skip:14 
skl-i5k-2        total:87   pass:78   dwarn:0   dfail:0   fail:0   skip:8  
skl-i7k-2        total:169  pass:153  dwarn:0   dfail:0   fail:0   skip:16 
snb-dellxps      total:169  pass:146  dwarn:0   dfail:1   fail:0   skip:22 
snb-x220t        total:169  pass:110  dwarn:0   dfail:0   fail:1   skip:18 

Results at /archive/results/CI_IGT_test/Patchwork_1494/

f01317755b647955ef0da34b349eafdabd6e4d26 drm-intel-nightly: 2016y-02m-29d-13h-34m-56s UTC integration manifest c103e8bc5c9dd3280247b72794eb1c293e015511 drm/i915: Fix bogus dig_port_map[] assignment for pre-HSW

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

#9 lore raw

Re: ✗ Fi.CI.BAT: failure for drm/i915: Fix bogus dig_port_map[] assignment for pre-HSW

Quoted 16 lines · Patchwork

== Series Details ==

Series: drm/i915: Fix bogus dig_port_map[] assignment for pre-HSW
URL : https://patchwork.freedesktop.org/series/3916/
State : failure

== Summary ==

Series 3916v1 drm/i915: Fix bogus dig_port_map[] assignment for pre-HSW
http://patchwork.freedesktop.org/api/1.0/series/3916/revisions/1/mbox/

Test drv_hangman:

        Subgroup error-state-basic:
                pass       -> INCOMPLETE (snb-x220t)
Test drv_module_reload_basic:
                pass       -> INCOMPLETE (snb-x220t)

...

Quoted 4 lines

Test kms_flip:

        Subgroup basic-flip-vs-dpms:
                pass       -> INCOMPLETE (skl-i5k-2)
                pass       -> INCOMPLETE (snb-x220t)

...

One snb and skl seem to have dropped out in the middle of the run for whatever reason.

Quoted 3 lines

Test kms_force_connector_basic:

        Subgroup force-load-detect:
                fail       -> DMESG-FAIL (snb-dellxps)

Known and should have fixed since by:
https://lists.freedesktop.org/archives/intel-gfx/2016-March/088743.html

Quoted 3 lines

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-c:
                pass       -> DMESG-WARN (bsw-nuc-2)
[  231.962372] [drm:intel_runtime_suspend [i915]] *ERROR* Unclaimed access detected prior to suspending

https://bugs.freedesktop.org/show_bug.cgi?id=94349

Quoted 3 lines

Test pm_rpm:

        Subgroup basic-pci-d3-state:
                pass       -> DMESG-WARN (bsw-nuc-2)

lockdep splat
https://bugs.freedesktop.org/show_bug.cgi?id=94350

Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx