Skip to contentSkip to conversation

drm/i915/BXT: Fixed COS blanking issue

PATCH Superseded Ramalingam C 7 participants 33 messages Feb 2, 2016 – Feb 23, 2016

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

PATCH 1/2 drm/i915/BXT: Fixed COS blanking issue

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

---
 drivers/gpu/drm/i915/intel_display.c |  107 ++++++++++++++++++++++++++++++++--
 1 file changed, 101 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +101 -6
index a66220a..f8685f5 100644
@@ -7814,6 +7814,69 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
 		   (intel_crtc->config->pipe_src_h - 1));
 }
 
+static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+				   struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
+	struct intel_encoder *encoder;
+	uint32_t tmp;
+
+	tmp = I915_READ(HTOTAL(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hdisplay = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_htotal =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	tmp = I915_READ(VBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(VSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	if (I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_INTERLACE_MASK) {
+		pipe_config->base.adjusted_mode.flags |=
+						DRM_MODE_FLAG_INTERLACE;
+		pipe_config->base.adjusted_mode.crtc_vtotal += 1;
+		pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
+	}
+
+
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		struct intel_dsi *intel_dsi =
+			enc_to_intel_dsi(&encoder->base);
+		enum port port;
+
+		pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
+		for_each_dsi_port(port, intel_dsi->ports) {
+			pipe_config->base.adjusted_mode.crtc_hdisplay =
+				I915_READ(BXT_MIPI_TRANS_HACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vdisplay =
+				I915_READ(BXT_MIPI_TRANS_VACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vtotal =
+				I915_READ(BXT_MIPI_TRANS_VTOTAL(port));
+		}
+	}
+
+	tmp = I915_READ(PIPESRC(crtc->pipe));
+	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+	pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+	pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}
+
 static void intel_get_pipe_timings(struct intel_crtc *crtc,
 				   struct intel_crtc_state *pipe_config)
 {
@@ -9969,6 +10032,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum intel_display_power_domain pfit_domain;
 	uint32_t tmp;
+	bool is_dsi = false;
 
 	if (!intel_display_power_is_enabled(dev_priv,
 					 POWER_DOMAIN_PIPE(crtc->pipe)))
@@ -9999,17 +10063,48 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 			pipe_config->cpu_transcoder = TRANSCODER_EDP;
 	}
 
+	if (dev_priv->vbt.has_mipi) {
+		enum port port_num = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+					? PORT_A : PORT_C;
+		uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port_num));
+
+		tmp = I915_READ(BXT_MIPI_PORT_CTRL(port_num));
+		if (tmp & DPI_ENABLE) {
+			enum pipe trans_dsi_pipe;
+
+			switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+			default:
+				WARN(1, "unknown pipe linked to dsi transcoder\n");
+				return false;
+			case BXT_PIPE_SELECT_A:
+				trans_dsi_pipe = PIPE_A;
+				break;
+			case BXT_PIPE_SELECT_B:
+				trans_dsi_pipe = PIPE_B;
+				break;
+			case BXT_PIPE_SELECT_C:
+				trans_dsi_pipe = PIPE_C;
+				break;
+			}
+
+			if (trans_dsi_pipe == crtc->pipe)
+				is_dsi = true;
+		}
+	}
+
 	if (!intel_display_power_is_enabled(dev_priv,
 			POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
 		return false;
 
-	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
-	if (!(tmp & PIPECONF_ENABLE))
-		return false;
-
-	haswell_get_ddi_port_state(crtc, pipe_config);
+	if (!is_dsi) {
+		tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
+		if (!(tmp & PIPECONF_ENABLE))
+			return false;
 
-	intel_get_pipe_timings(crtc, pipe_config);
+		haswell_get_ddi_port_state(crtc, pipe_config);
+		intel_get_pipe_timings(crtc, pipe_config);
+	} else
+		intel_get_dsi_pipe_timings(crtc, pipe_config);
 
 	if (INTEL_INFO(dev)->gen >= 9) {
 		skl_init_scalers(dev, crtc, pipe_config);
Signature · 6 lines
1.7.9.5

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

PATCH 2/2 drm/i915/dsi: Add audio reference in dsi encoder

From: "Kumar, Mahesh" <[email protected]>

We are re-using Mipi encoder enabled by GOP driver, but not incrementing reference count for Audio Power domain, so audio was not working. This patch increments the reference count during DSI init and Adds get/put in DSI enable/disable functions as well so audio power domain will be on when mipi is in use.

---
 drivers/gpu/drm/i915/intel_dsi.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +13 -0
index 91cef35..8b43ef6 100644
@@ -461,6 +461,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
 		intel_dsi_port_enable(encoder);
 	}
 
+	intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+	intel_audio_codec_enable(encoder);
+
 	intel_panel_enable_backlight(intel_dsi->attached_connector);
 }
 
@@ -531,11 +534,16 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
 
 static void intel_dsi_pre_disable(struct intel_encoder *encoder)
 {
+	struct drm_device *dev = encoder->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
 	enum port port;
 
 	DRM_DEBUG_KMS("\n");
 
+	intel_audio_codec_disable(encoder);
+	intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
+
 	intel_panel_disable_backlight(intel_dsi->attached_connector);
 
 	if (is_vid_mode(intel_dsi)) {
@@ -1236,6 +1244,11 @@ void intel_dsi_init(struct drm_device *dev)
 	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
 	intel_panel_setup_backlight(connector, INVALID_PIPE);
 
+	/* Enable Audio Power to fix use-count state machine */
+	port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) ? PORT_A : PORT_C;
+	if (I915_READ(BXT_MIPI_PORT_CTRL(port)) & DPI_ENABLE)
+		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+
 	return;
 
 err:
Signature · 6 lines
1.7.9.5

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

Re: [PATCH 2/2] drm/i915/dsi: Add audio reference in dsi encoder

Again like previous patch can you add checks for IS_BROXTON for all of these changes so it does not affect CHV/VLV ?

regards,
Sivakumar

Quoted 48 lines · Ramalingam C

From: "Kumar, Mahesh" <[email protected]>

We are re-using Mipi encoder enabled by GOP driver, but not incrementing reference count for Audio Power domain, so audio was not working. This patch increments the reference count during DSI init and Adds get/put in DSI enable/disable functions as well so audio power domain will be on when mipi is in use.

---
  drivers/gpu/drm/i915/intel_dsi.c |   13 +++++++++++++
  1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +8 -0
index 91cef35..8b43ef6 100644
@@ -461,6 +461,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
  		intel_dsi_port_enable(encoder);
  	}
 
+	intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+	intel_audio_codec_enable(encoder);
+
  	intel_panel_enable_backlight(intel_dsi->attached_connector);
  }
 
@@ -531,11 +534,16 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
 
  static void intel_dsi_pre_disable(struct intel_encoder *encoder)
  {
+	struct drm_device *dev = encoder->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
  	enum port port;
 
  	DRM_DEBUG_KMS("\n");
 
+	intel_audio_codec_disable(encoder);
+	intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
+
  	intel_panel_disable_backlight(intel_dsi->attached_connector);
 
  	if (is_vid_mode(intel_dsi)) {
@@ -1236,6 +1244,11 @@ void intel_dsi_init(struct drm_device *dev)
  	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);

drivers/gpu/drm/i915/intel_dsi.c void intel_dsi_init(struct drm_device *dev) · line 1254

Quoted 10 lines
drivers/gpu/drm/i915/intel_dsi.c +5 -0
  	intel_panel_setup_backlight(connector, INVALID_PIPE);
 
+	/* Enable Audio Power to fix use-count state machine */
+	port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) ? PORT_A : PORT_C;
+	if (I915_READ(BXT_MIPI_PORT_CTRL(port)) & DPI_ENABLE)
+		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+
  	return;
 
  err:

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

#3 lore raw

Re: [PATCH 2/2] drm/i915/dsi: Add audio reference in dsi encoder

In reply to Ramalingam C
Quoted 7 lines · Ramalingam C

From: "Kumar, Mahesh" <[email protected]>

We are re-using Mipi encoder enabled by GOP driver, but not incrementing reference count for Audio Power domain, so audio was not working. This patch increments the reference count during DSI init and Adds get/put in DSI enable/disable functions as well so audio power domain will be on when mipi is in use.

Confused. DSI does not have HD audio. The codec enable calls are no-ops because DSI does not have EDID and therefore no ELD either. Hopefully the codec disable calls don't mess up things by accident. We don't need or want those calls in DSI.

IMO the DSI encoder should not get/put the audio power domain either, because DSI simply does not use that.

The question remains, *what* audio was failing? DP/HDMI audio?

We may have problems in the power domain setup code, failing to take DSI into account or something. But I don't think this is the place to fix it.

Cc Imre and Patrik.

BR,
Jani.

Quoted 51 lines
---
 drivers/gpu/drm/i915/intel_dsi.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +13 -0
index 91cef35..8b43ef6 100644
@@ -461,6 +461,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
 		intel_dsi_port_enable(encoder);
 	}
 
+	intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+	intel_audio_codec_enable(encoder);
+
 	intel_panel_enable_backlight(intel_dsi->attached_connector);
 }
 
@@ -531,11 +534,16 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
 
 static void intel_dsi_pre_disable(struct intel_encoder *encoder)
 {
+	struct drm_device *dev = encoder->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
 	enum port port;
 
 	DRM_DEBUG_KMS("\n");
 
+	intel_audio_codec_disable(encoder);
+	intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
+
 	intel_panel_disable_backlight(intel_dsi->attached_connector);
 
 	if (is_vid_mode(intel_dsi)) {
@@ -1236,6 +1244,11 @@ void intel_dsi_init(struct drm_device *dev)
 	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
 	intel_panel_setup_backlight(connector, INVALID_PIPE);
 
+	/* Enable Audio Power to fix use-count state machine */
+	port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) ? PORT_A : PORT_C;
+	if (I915_READ(BXT_MIPI_PORT_CTRL(port)) & DPI_ENABLE)
+		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+
 	return;
 
 err:
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

Re: [PATCH 2/2] drm/i915/dsi: Add audio reference in dsi encoder

Quoted 13 lines · Jani Nikula
Quoted 7 lines · Ramalingam C

From: "Kumar, Mahesh" <[email protected]>

We are re-using Mipi encoder enabled by GOP driver, but not incrementing reference count for Audio Power domain, so audio was not working. This patch increments the reference count during DSI init and Adds get/put in DSI enable/disable functions as well so audio power domain will be on when mipi is in use.

Confused. DSI does not have HD audio. The codec enable calls are no-ops because DSI does not have EDID and therefore no ELD either. Hopefully the codec disable calls don't mess up things by accident. We don't need or want those calls in DSI.

Quoted 4 lines

IMO the DSI encoder should not get/put the audio power domain either, because DSI simply does not use that.

The question remains, *what* audio was failing? DP/HDMI audio?

Since HDMI and DP has the audio we are handling the audio power well. For MIPI since we dont have the audio with encoder, we need not get the power well on. In such scenario, power well use count is not incrementing (Means no one is enabling the powerwell for board audio) and hence Board audio is not working.

Quoted 4 lines

We may have problems in the power domain setup code, failing to take DSI into account or something. But I don't think this is the place to fix it.

Possibly this is not the place. But Either DSI code or audio code has to handle it, to make the board audio to work on BXT. Share your view on that.

Quoted 60 lines

Cc Imre and Patrik.

BR,
Jani.

Quoted 50 lines
---
  drivers/gpu/drm/i915/intel_dsi.c |   13 +++++++++++++
  1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +13 -0
index 91cef35..8b43ef6 100644
@@ -461,6 +461,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
  		intel_dsi_port_enable(encoder);
  	}
 
+	intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+	intel_audio_codec_enable(encoder);
+
  	intel_panel_enable_backlight(intel_dsi->attached_connector);
  }
 
@@ -531,11 +534,16 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
 
  static void intel_dsi_pre_disable(struct intel_encoder *encoder)
  {
+	struct drm_device *dev = encoder->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
  	enum port port;
 
  	DRM_DEBUG_KMS("\n");
 
+	intel_audio_codec_disable(encoder);
+	intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
+
  	intel_panel_disable_backlight(intel_dsi->attached_connector);
 
  	if (is_vid_mode(intel_dsi)) {
@@ -1236,6 +1244,11 @@ void intel_dsi_init(struct drm_device *dev)
  	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
  	intel_panel_setup_backlight(connector, INVALID_PIPE);
 
+	/* Enable Audio Power to fix use-count state machine */
+	port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) ? PORT_A : PORT_C;
+	if (I915_READ(BXT_MIPI_PORT_CTRL(port)) & DPI_ENABLE)
+		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+
  	return;
 
  err:
Signature · 7 lines
Thanks,
--Ram

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

Re: [PATCH 2/2] drm/i915/dsi: Add audio reference in dsi encoder

Quoted 25 lines · Ramalingam C
Quoted 13 lines · Jani Nikula
Quoted 7 lines · Ramalingam C

From: "Kumar, Mahesh" <[email protected]>

We are re-using Mipi encoder enabled by GOP driver, but not incrementing reference count for Audio Power domain, so audio was not working. This patch increments the reference count during DSI init and Adds get/put in DSI enable/disable functions as well so audio power domain will be on when mipi is in use.

Confused. DSI does not have HD audio. The codec enable calls are no-ops because DSI does not have EDID and therefore no ELD either. Hopefully the codec disable calls don't mess up things by accident. We don't need or want those calls in DSI.

Quoted 4 lines

IMO the DSI encoder should not get/put the audio power domain either, because DSI simply does not use that.

The question remains, *what* audio was failing? DP/HDMI audio?

Since HDMI and DP has the audio we are handling the audio power well. For MIPI since we dont have the audio with encoder, we need not get the power well on.
In such scenario, power well use count is not incrementing (Means no one is enabling
the powerwell for board audio) and hence Board audio is not working.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

We may have problems in the power domain setup code, failing to take DSI into account or something. But I don't think this is the place to fix it.

Possibly this is not the place. But Either DSI code or audio code has to handle it,
to make the board audio to work on BXT. Share your view on that.

I'm not aware of what board audio is, but based on your description I understand it has nothing to do with HDMI, DP, DSI - or our driver in general. Correct me if I'm wrong.

Which driver handles board audio?

Sounds like the right approach is to have that driver use the i915 component API to get/put the power well.

See sound/hda/hdac_i915.c for how HDA binds to the component API, and how it calls the ->get_power() and ->put_power() hooks as needed. Without that, HDA would lose all the registers in audio power well during mode set. I expect the same for board audio.

The modeset for HDMI/DP need to get/put the power wells just because those encoders do the codec enable/disable sequence, actually touching registers in the power well.

BR,
Jani.

Quoted 61 lines
Quoted 61 lines

Cc Imre and Patrik.

BR,
Jani.

Quoted 50 lines
---
  drivers/gpu/drm/i915/intel_dsi.c |   13 +++++++++++++
  1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +13 -0
index 91cef35..8b43ef6 100644
@@ -461,6 +461,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
  		intel_dsi_port_enable(encoder);
  	}
 
+	intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+	intel_audio_codec_enable(encoder);
+
  	intel_panel_enable_backlight(intel_dsi->attached_connector);
  }
 
@@ -531,11 +534,16 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
 
  static void intel_dsi_pre_disable(struct intel_encoder *encoder)
  {
+	struct drm_device *dev = encoder->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
  	enum port port;
 
  	DRM_DEBUG_KMS("\n");
 
+	intel_audio_codec_disable(encoder);
+	intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
+
  	intel_panel_disable_backlight(intel_dsi->attached_connector);
 
  	if (is_vid_mode(intel_dsi)) {
@@ -1236,6 +1244,11 @@ void intel_dsi_init(struct drm_device *dev)
  	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
  	intel_panel_setup_backlight(connector, INVALID_PIPE);
 
+	/* Enable Audio Power to fix use-count state machine */
+	port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) ? PORT_A : PORT_C;
+	if (I915_READ(BXT_MIPI_PORT_CTRL(port)) & DPI_ENABLE)
+		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+
  	return;
 
  err:
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw

Re: [PATCH 2/2] drm/i915/dsi: Add audio reference in dsi encoder

Quoted 33 lines · Jani Nikula
Quoted 25 lines · Ramalingam C
Quoted 13 lines · Jani Nikula
Quoted 7 lines · Ramalingam C

From: "Kumar, Mahesh" <[email protected]>

We are re-using Mipi encoder enabled by GOP driver, but not incrementing reference count for Audio Power domain, so audio was not working. This patch increments the reference count during DSI init and Adds get/put in DSI enable/disable functions as well so audio power domain will be on when mipi is in use.

Confused. DSI does not have HD audio. The codec enable calls are no-ops because DSI does not have EDID and therefore no ELD either. Hopefully the codec disable calls don't mess up things by accident. We don't need or want those calls in DSI.

Quoted 4 lines

IMO the DSI encoder should not get/put the audio power domain either, because DSI simply does not use that.

The question remains, *what* audio was failing? DP/HDMI audio?

Since HDMI and DP has the audio we are handling the audio power well. For MIPI since we dont have the audio with encoder, we need not get the power well on.
In such scenario, power well use count is not incrementing (Means no one is enabling
the powerwell for board audio) and hence Board audio is not working.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

We may have problems in the power domain setup code, failing to take DSI into account or something. But I don't think this is the place to fix it.

Possibly this is not the place. But Either DSI code or audio code has to handle it,
to make the board audio to work on BXT. Share your view on that.

Quoted 8 lines

I'm not aware of what board audio is, but based on your description I understand it has nothing to do with HDMI, DP, DSI - or our driver in general. Correct me if I'm wrong.

Which driver handles board audio?

Sounds like the right approach is to have that driver use the i915 component API to get/put the power well.

I did not get a reply to my question here. Is there an upstream driver for the audio? Does using the component API sound like the right thing to do?

If it isn't clear, this patch is not acceptable.

BR,
Jani.

Quoted 76 lines

See sound/hda/hdac_i915.c for how HDA binds to the component API, and how it calls the ->get_power() and ->put_power() hooks as needed. Without that, HDA would lose all the registers in audio power well during mode set. I expect the same for board audio.

The modeset for HDMI/DP need to get/put the power wells just because those encoders do the codec enable/disable sequence, actually touching registers in the power well.

BR,
Jani.

Quoted 61 lines
Quoted 61 lines

Cc Imre and Patrik.

BR,
Jani.

Quoted 50 lines
---
  drivers/gpu/drm/i915/intel_dsi.c |   13 +++++++++++++
  1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +13 -0
index 91cef35..8b43ef6 100644
@@ -461,6 +461,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
  		intel_dsi_port_enable(encoder);
  	}
 
+	intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+	intel_audio_codec_enable(encoder);
+
  	intel_panel_enable_backlight(intel_dsi->attached_connector);
  }
 
@@ -531,11 +534,16 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
 
  static void intel_dsi_pre_disable(struct intel_encoder *encoder)
  {
+	struct drm_device *dev = encoder->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
  	enum port port;
 
  	DRM_DEBUG_KMS("\n");
 
+	intel_audio_codec_disable(encoder);
+	intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
+
  	intel_panel_disable_backlight(intel_dsi->attached_connector);
 
  	if (is_vid_mode(intel_dsi)) {
@@ -1236,6 +1244,11 @@ void intel_dsi_init(struct drm_device *dev)
  	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
  	intel_panel_setup_backlight(connector, INVALID_PIPE);
 
+	/* Enable Audio Power to fix use-count state machine */
+	port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) ? PORT_A : PORT_C;
+	if (I915_READ(BXT_MIPI_PORT_CTRL(port)) & DPI_ENABLE)
+		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+
  	return;
 
  err:
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH 2/2] drm/i915/dsi: Add audio reference in dsi encoder

Quoted 38 lines · Jani Nikula
Quoted 37 lines · Jani Nikula
Quoted 24 lines · Ramalingam C
Quoted 13 lines · Jani Nikula
Quoted 7 lines · Ramalingam C

From: "Kumar, Mahesh" <[email protected]>

We are re-using Mipi encoder enabled by GOP driver, but not incrementing reference count for Audio Power domain, so audio was not working. This patch increments the reference count during DSI init and Adds get/put in DSI enable/disable functions as well so audio power domain will be on when mipi is in use.

Confused. DSI does not have HD audio. The codec enable calls are no-ops because DSI does not have EDID and therefore no ELD either. Hopefully the codec disable calls don't mess up things by accident. We don't need or want those calls in DSI.

Quoted 4 lines

IMO the DSI encoder should not get/put the audio power domain either, because DSI simply does not use that.

The question remains, *what* audio was failing? DP/HDMI audio?

Since HDMI and DP has the audio we are handling the audio power well. For MIPI since we dont have the audio with encoder, we need not get the power well on.
In such scenario, power well use count is not incrementing (Means no one is enabling
the powerwell for board audio) and hence Board audio is not working.

Quoted 6 lines
Quoted 3 lines

We may have problems in the power domain setup code, failing to take DSI into account or something. But I don't think this is the place to fix it.

Possibly this is not the place. But Either DSI code or audio code has to handle it,
to make the board audio to work on BXT. Share your view on that.

I'm not aware of what board audio is, but based on your description I understand it has nothing to do with HDMI, DP, DSI - or our driver in general. Correct me if I'm wrong.

Which driver handles board audio?

Quoted 7 lines
Quoted 2 lines

Sounds like the right approach is to have that driver use the i915 component API to get/put the power well.

I did not get a reply to my question here. Is there an upstream driver for the audio? Does using the component API sound like the right thing to do?

If it isn't clear, this patch is not acceptable.

Jani,

sorry somehow missed this thread.
I was referring to on board audio which is not attached to any display encoder. This patch is trying to fix a audio bug, which is disclosed when COS related bug was fixed.

This has to be debugged from the audio perspective why the power well is not requested for at this modified code sequence.

We can drop this patch as this wont be the correct way and place to fix.

Signature · 2 lines
Thanks,
--Ram
Quoted 69 lines

BR,
Jani.

Quoted 65 lines

See sound/hda/hdac_i915.c for how HDA binds to the component API, and how it calls the ->get_power() and ->put_power() hooks as needed. Without that, HDA would lose all the registers in audio power well during mode set. I expect the same for board audio.

The modeset for HDMI/DP need to get/put the power wells just because those encoders do the codec enable/disable sequence, actually touching registers in the power well.

BR,
Jani.

Quoted 51 lines
Quoted 51 lines

Cc Imre and Patrik.

BR,
Jani.

Quoted 42 lines
---
   drivers/gpu/drm/i915/intel_dsi.c |   13 +++++++++++++
   1 file changed, 13 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +8 -0
index 91cef35..8b43ef6 100644
@@ -461,6 +461,9 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
   		intel_dsi_port_enable(encoder);
   	}
 
+	intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+	intel_audio_codec_enable(encoder);
+
   	intel_panel_enable_backlight(intel_dsi->attached_connector);
   }
 
@@ -531,11 +534,16 @@ static void intel_dsi_enable_nop(struct intel_encoder *encoder)
 
   static void intel_dsi_pre_disable(struct intel_encoder *encoder)
   {
+	struct drm_device *dev = encoder->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
   	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
   	enum port port;
 
   	DRM_DEBUG_KMS("\n");
 
+	intel_audio_codec_disable(encoder);
+	intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
+
   	intel_panel_disable_backlight(intel_dsi->attached_connector);
 
   	if (is_vid_mode(intel_dsi)) {
@@ -1236,6 +1244,11 @@ void intel_dsi_init(struct drm_device *dev)
   	intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
   	intel_panel_setup_backlight(connector, INVALID_PIPE);
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/intel_dsi.c void intel_dsi_init(struct drm_device *dev) · line 1254

Quoted 8 lines
drivers/gpu/drm/i915/intel_dsi.c +5 -0
+	/* Enable Audio Power to fix use-count state machine */
+	port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA) ? PORT_A : PORT_C;
+	if (I915_READ(BXT_MIPI_PORT_CTRL(port)) & DPI_ENABLE)
+		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
+
   	return;
 
   err:

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

#8 lore raw
In reply to Ramalingam C
reproduce:

Hi Uma,

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.5-rc2 next-20160201]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Ramalingam-C/drm-i915-BXT-Fixed-COS-blanking-issue/20160203-020606
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x019-201605 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

drivers/gpu/drm/i915/intel_display.c: In function 'intel_get_dsi_pipe_timings':

>> drivers/gpu/drm/i915/intel_display.c:7858:4: error: implicit declaration of function 'enc_to_intel_dsi' [-Werror=implicit-function-declaration]
       enc_to_intel_dsi(&encoder->base);
       ^
>> drivers/gpu/drm/i915/intel_display.c:7858:4: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
>> drivers/gpu/drm/i915/intel_display.c:7861:36: error: dereferencing pointer to incomplete type 'struct intel_dsi'
      pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
                                       ^
>> drivers/gpu/drm/i915/intel_display.c:7862:3: error: implicit declaration of function 'for_each_dsi_port' [-Werror=implicit-function-declaration]
      for_each_dsi_port(port, intel_dsi->ports) {
      ^
>> drivers/gpu/drm/i915/intel_display.c:7862:45: error: expected ';' before '{' token
      for_each_dsi_port(port, intel_dsi->ports) {
                                                ^
   drivers/gpu/drm/i915/intel_display.c: In function 'haswell_get_pipe_config':
>> drivers/gpu/drm/i915/intel_display.c:10079:9: error: 'BXT_PIPE_SELECT_A' undeclared (first use in this function)
       case BXT_PIPE_SELECT_A:
            ^
   drivers/gpu/drm/i915/intel_display.c:10079:9: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/i915/intel_display.c:10082:9: error: 'BXT_PIPE_SELECT_B' undeclared (first use in this function)
       case BXT_PIPE_SELECT_B:
            ^
>> drivers/gpu/drm/i915/intel_display.c:10085:9: error: 'BXT_PIPE_SELECT_C' undeclared (first use in this function)
       case BXT_PIPE_SELECT_C:
            ^

cc1: some warnings being treated as errors

vim +/enc_to_intel_dsi +7858 drivers/gpu/drm/i915/intel_display.c

7852 pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
7853 }
7854
7855
7856 for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
7857 struct intel_dsi *intel_dsi =

> 7858				enc_to_intel_dsi(&encoder->base);
  7859			enum port port;
  7860	
> 7861			pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
> 7862			for_each_dsi_port(port, intel_dsi->ports) {

7863 pipe_config->base.adjusted_mode.crtc_hdisplay =
7864 I915_READ(BXT_MIPI_TRANS_HACTIVE(port));
7865 pipe_config->base.adjusted_mode.crtc_vdisplay =

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

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

#9 lore raw
In reply to Ramalingam C
reproduce:

Hi Uma,

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v4.5-rc2 next-20160201]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Ramalingam-C/drm-i915-BXT-Fixed-COS-blanking-issue/20160203-020606
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-rhel (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

drivers/gpu/drm/i915/intel_display.c: In function 'intel_get_dsi_pipe_timings':
drivers/gpu/drm/i915/intel_display.c:7858:4: error: implicit declaration of function 'enc_to_intel_dsi' [-Werror=implicit-function-declaration]

       enc_to_intel_dsi(&encoder->base);
       ^
   drivers/gpu/drm/i915/intel_display.c:7858:4: warning: initialization makes pointer from integer without a cast
>> drivers/gpu/drm/i915/intel_display.c:7861:36: error: dereferencing pointer to incomplete type
      pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
                                       ^
   drivers/gpu/drm/i915/intel_display.c:7862:3: error: implicit declaration of function 'for_each_dsi_port' [-Werror=implicit-function-declaration]
      for_each_dsi_port(port, intel_dsi->ports) {
      ^
   drivers/gpu/drm/i915/intel_display.c:7862:36: error: dereferencing pointer to incomplete type
      for_each_dsi_port(port, intel_dsi->ports) {
                                       ^
   drivers/gpu/drm/i915/intel_display.c:7862:45: error: expected ';' before '{' token
      for_each_dsi_port(port, intel_dsi->ports) {
                                                ^
   drivers/gpu/drm/i915/intel_display.c: In function 'haswell_get_pipe_config':
   drivers/gpu/drm/i915/intel_display.c:10079:9: error: 'BXT_PIPE_SELECT_A' undeclared (first use in this function)
       case BXT_PIPE_SELECT_A:
            ^
   drivers/gpu/drm/i915/intel_display.c:10079:9: note: each undeclared identifier is reported only once for each function it appears in
   drivers/gpu/drm/i915/intel_display.c:10082:9: error: 'BXT_PIPE_SELECT_B' undeclared (first use in this function)
       case BXT_PIPE_SELECT_B:
            ^
   drivers/gpu/drm/i915/intel_display.c:10085:9: error: 'BXT_PIPE_SELECT_C' undeclared (first use in this function)
       case BXT_PIPE_SELECT_C:
            ^

cc1: some warnings being treated as errors

vim +7861 drivers/gpu/drm/i915/intel_display.c

7852 pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
7853 }
7854
7855
7856 for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
7857 struct intel_dsi *intel_dsi =

> 7858				enc_to_intel_dsi(&encoder->base);
  7859			enum port port;
  7860	
> 7861			pipe_config->pipe_bpp = intel_dsi->dsi_bpp;

7862 for_each_dsi_port(port, intel_dsi->ports) {
7863 pipe_config->base.adjusted_mode.crtc_hdisplay =
7864 I915_READ(BXT_MIPI_TRANS_HACTIVE(port));

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

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

#10 lore raw
In reply to Ramalingam C
Quoted 103 lines · Ramalingam C

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

---
  drivers/gpu/drm/i915/intel_display.c |  107 ++++++++++++++++++++++++++++++++--
  1 file changed, 101 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +64 -0
index a66220a..f8685f5 100644
@@ -7814,6 +7814,69 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
  		   (intel_crtc->config->pipe_src_h - 1));
  }
 
+static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+				   struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
+	struct intel_encoder *encoder;
+	uint32_t tmp;
+
+	tmp = I915_READ(HTOTAL(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hdisplay = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_htotal =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	tmp = I915_READ(VBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(VSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	if (I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_INTERLACE_MASK) {
+		pipe_config->base.adjusted_mode.flags |=
+						DRM_MODE_FLAG_INTERLACE;
+		pipe_config->base.adjusted_mode.crtc_vtotal += 1;
+		pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
+	}
+
+
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		struct intel_dsi *intel_dsi =
+			enc_to_intel_dsi(&encoder->base);
+		enum port port;
+
+		pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
+		for_each_dsi_port(port, intel_dsi->ports) {
+			pipe_config->base.adjusted_mode.crtc_hdisplay =
+				I915_READ(BXT_MIPI_TRANS_HACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vdisplay =
+				I915_READ(BXT_MIPI_TRANS_VACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vtotal =
+				I915_READ(BXT_MIPI_TRANS_VTOTAL(port));
+		}
+	}
+
+	tmp = I915_READ(PIPESRC(crtc->pipe));
+	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+	pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+	pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}
+
  static void intel_get_pipe_timings(struct intel_crtc *crtc,
  				   struct intel_crtc_state *pipe_config)
  {
@@ -9969,6 +10032,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	enum intel_display_power_domain pfit_domain;
  	uint32_t tmp;
+	bool is_dsi = false;
 
  	if (!intel_display_power_is_enabled(dev_priv,
  					 POWER_DOMAIN_PIPE(crtc->pipe)))

drivers/gpu/drm/i915/intel_display.c static bool haswell_get_pipe_config(struct intel_crtc *crtc, · line 10066

Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +1 -0
@@ -9999,17 +10063,48 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
  			pipe_config->cpu_transcoder = TRANSCODER_EDP;
  	}
 
+	if (dev_priv->vbt.has_mipi) {

shouldn't the above check for bxt too ? since the section inside is only for bxt ? regards,
Sivakumar

Quoted 40 lines
drivers/gpu/drm/i915/intel_display.c +31 -5
+		enum port port_num = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+					? PORT_A : PORT_C;
+		uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port_num));
+
+		tmp = I915_READ(BXT_MIPI_PORT_CTRL(port_num));
+		if (tmp & DPI_ENABLE) {
+			enum pipe trans_dsi_pipe;
+
+			switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+			default:
+				WARN(1, "unknown pipe linked to dsi transcoder\n");
+				return false;
+			case BXT_PIPE_SELECT_A:
+				trans_dsi_pipe = PIPE_A;
+				break;
+			case BXT_PIPE_SELECT_B:
+				trans_dsi_pipe = PIPE_B;
+				break;
+			case BXT_PIPE_SELECT_C:
+				trans_dsi_pipe = PIPE_C;
+				break;
+			}
+
+			if (trans_dsi_pipe == crtc->pipe)
+				is_dsi = true;
+		}
+	}
+
  	if (!intel_display_power_is_enabled(dev_priv,
  			POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
  		return false;
 
-	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
-	if (!(tmp & PIPECONF_ENABLE))
-		return false;
-
-	haswell_get_ddi_port_state(crtc, pipe_config);
+	if (!is_dsi) {
+		tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
+		if (!(tmp & PIPECONF_ENABLE))

drivers/gpu/drm/i915/intel_display.c static bool haswell_get_pipe_config(struct intel_crtc *crtc, · line 10110

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +5 -1
+			return false;
 
-	intel_get_pipe_timings(crtc, pipe_config);
+		haswell_get_ddi_port_state(crtc, pipe_config);
+		intel_get_pipe_timings(crtc, pipe_config);
+	} else
+		intel_get_dsi_pipe_timings(crtc, pipe_config);
 
  	if (INTEL_INFO(dev)->gen >= 9) {
  		skl_init_scalers(dev, crtc, pipe_config);

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

#11 lore raw
Quoted 109 lines · Sivakumar
Quoted 106 lines · Ramalingam C

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

---
  drivers/gpu/drm/i915/intel_display.c |  107 
++++++++++++++++++++++++++++++++--
  1 file changed, 101 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +23 -0
index a66220a..f8685f5 100644
@@ -7814,6 +7814,69 @@ static void intel_set_pipe_timings(struct 
 intel_crtc *intel_crtc)
             (intel_crtc->config->pipe_src_h - 1));
  }
  +static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+                   struct intel_crtc_state *pipe_config)
+{
+    struct drm_device *dev = crtc->base.dev;
+    struct drm_i915_private *dev_priv = dev->dev_private;
+    enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
+    struct intel_encoder *encoder;
+    uint32_t tmp;
+
+    tmp = I915_READ(HTOTAL(cpu_transcoder));
+    pipe_config->base.adjusted_mode.crtc_hdisplay = (tmp & 0xffff) + 1;
+    pipe_config->base.adjusted_mode.crtc_htotal =
+                        ((tmp >> 16) & 0xffff) + 1;
+    tmp = I915_READ(HBLANK(cpu_transcoder));
+    pipe_config->base.adjusted_mode.crtc_hblank_start = (tmp & 
 0xffff) + 1;
+    pipe_config->base.adjusted_mode.crtc_hblank_end =
+                        ((tmp >> 16) & 0xffff) + 1;
+    tmp = I915_READ(HSYNC(cpu_transcoder));
+    pipe_config->base.adjusted_mode.crtc_hsync_start = (tmp & 
 0xffff) + 1;
+    pipe_config->base.adjusted_mode.crtc_hsync_end =
+                        ((tmp >> 16) & 0xffff) + 1;
+
+    tmp = I915_READ(VBLANK(cpu_transcoder));
+    pipe_config->base.adjusted_mode.crtc_vblank_start = (tmp & 

0xffff) + 1;

drivers/gpu/drm/i915/intel_display.c +4 -0
+    pipe_config->base.adjusted_mode.crtc_vblank_end =
+                        ((tmp >> 16) & 0xffff) + 1;
+    tmp = I915_READ(VSYNC(cpu_transcoder));
+    pipe_config->base.adjusted_mode.crtc_vsync_start = (tmp & 

0xffff) + 1;

drivers/gpu/drm/i915/intel_display.c +4 -0
+    pipe_config->base.adjusted_mode.crtc_vsync_end =
+                        ((tmp >> 16) & 0xffff) + 1;
+
+    if (I915_READ(PIPECONF(cpu_transcoder)) & 

PIPECONF_INTERLACE_MASK) {

drivers/gpu/drm/i915/intel_display.c +32 -0
+        pipe_config->base.adjusted_mode.flags |=
+                        DRM_MODE_FLAG_INTERLACE;
+        pipe_config->base.adjusted_mode.crtc_vtotal += 1;
+        pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
+    }
+
+
+    for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+        struct intel_dsi *intel_dsi =
+            enc_to_intel_dsi(&encoder->base);
+        enum port port;
+
+        pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
+        for_each_dsi_port(port, intel_dsi->ports) {
+            pipe_config->base.adjusted_mode.crtc_hdisplay =
+                I915_READ(BXT_MIPI_TRANS_HACTIVE(port));
+            pipe_config->base.adjusted_mode.crtc_vdisplay =
+                I915_READ(BXT_MIPI_TRANS_VACTIVE(port));
+            pipe_config->base.adjusted_mode.crtc_vtotal =
+                I915_READ(BXT_MIPI_TRANS_VTOTAL(port));
+        }
+    }
+
+    tmp = I915_READ(PIPESRC(crtc->pipe));
+    pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+    pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+    pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+    pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}
+
  static void intel_get_pipe_timings(struct intel_crtc *crtc,
                     struct intel_crtc_state *pipe_config)
  {
@@ -9969,6 +10032,7 @@ static bool haswell_get_pipe_config(struct 
 intel_crtc *crtc,
      struct drm_i915_private *dev_priv = dev->dev_private;
      enum intel_display_power_domain pfit_domain;
      uint32_t tmp;
+    bool is_dsi = false;
Quoted 8 lines

drivers/gpu/drm/i915/intel_display.c static bool haswell_get_pipe_config(struct · line 10066

Quoted 7 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
        if (!intel_display_power_is_enabled(dev_priv,
                       POWER_DOMAIN_PIPE(crtc->pipe)))
@@ -9999,17 +10063,48 @@ static bool haswell_get_pipe_config(struct 
 intel_crtc *crtc,
              pipe_config->cpu_transcoder = TRANSCODER_EDP;
      }
  +    if (dev_priv->vbt.has_mipi) {

shouldn't the above check for bxt too ? since the section inside is only for bxt ?

Thanks siva. Will take care of this in the next version of the patch.

Quoted 50 lines

regards,
Sivakumar

Quoted 47 lines
drivers/gpu/drm/i915/intel_display.c +36 -4
+        enum port port_num = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+                    ? PORT_A : PORT_C;
+        uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port_num));
+
+        tmp = I915_READ(BXT_MIPI_PORT_CTRL(port_num));
+        if (tmp & DPI_ENABLE) {
+            enum pipe trans_dsi_pipe;
+
+            switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+            default:
+                WARN(1, "unknown pipe linked to dsi transcoder\n");
+                return false;
+            case BXT_PIPE_SELECT_A:
+                trans_dsi_pipe = PIPE_A;
+                break;
+            case BXT_PIPE_SELECT_B:
+                trans_dsi_pipe = PIPE_B;
+                break;
+            case BXT_PIPE_SELECT_C:
+                trans_dsi_pipe = PIPE_C;
+                break;
+            }
+
+            if (trans_dsi_pipe == crtc->pipe)
+                is_dsi = true;
+        }
+    }
+
      if (!intel_display_power_is_enabled(dev_priv,
 POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
          return false;
  -    tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
-    if (!(tmp & PIPECONF_ENABLE))
-        return false;
-
-    haswell_get_ddi_port_state(crtc, pipe_config);
+    if (!is_dsi) {
+        tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
+        if (!(tmp & PIPECONF_ENABLE))
+            return false;
  -    intel_get_pipe_timings(crtc, pipe_config);
+        haswell_get_ddi_port_state(crtc, pipe_config);
+        intel_get_pipe_timings(crtc, pipe_config);
+    } else
+        intel_get_dsi_pipe_timings(crtc, pipe_config);
        if (INTEL_INFO(dev)->gen >= 9) {
          skl_init_scalers(dev, crtc, pipe_config);
Signature · 7 lines
Thanks,
--Ram

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

✗ Fi.CI.BAT: failure for series starting with [1/2] drm/i915/BXT: Fixed COS blanking issue

In reply to Ramalingam C
== Summary ==

== Summary ==

^
drivers/gpu/drm/i915/intel_display.c:7862:36: error: dereferencing pointer to incomplete type

   for_each_dsi_port(port, intel_dsi->ports) {
                                    ^
drivers/gpu/drm/i915/intel_display.c:7862:45: error: expected ';' before '{' token
   for_each_dsi_port(port, intel_dsi->ports) {
                                             ^
drivers/gpu/drm/i915/intel_display.c: In function 'haswell_get_pipe_config':
drivers/gpu/drm/i915/intel_display.c:10079:9: error: 'BXT_PIPE_SELECT_A' undeclared (first use in this function)
    case BXT_PIPE_SELECT_A:
         ^
drivers/gpu/drm/i915/intel_display.c:10079:9: note: each undeclared identifier is reported only once for each function it appears in
drivers/gpu/drm/i915/intel_display.c:10082:9: error: 'BXT_PIPE_SELECT_B' undeclared (first use in this function)
    case BXT_PIPE_SELECT_B:
         ^
drivers/gpu/drm/i915/intel_display.c:10085:9: error: 'BXT_PIPE_SELECT_C' undeclared (first use in this function)
    case BXT_PIPE_SELECT_C:
         ^

cc1: some warnings being treated as errors
scripts/Makefile.build:258: recipe for target 'drivers/gpu/drm/i915/intel_display.o' failed make[4]: *** [drivers/gpu/drm/i915/intel_display.o] Error 1
make[4]: *** Waiting for unfinished jobs....
scripts/Makefile.build:407: recipe for target 'drivers/gpu/drm/i915' failed make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:407: recipe for target 'drivers/gpu/drm' failed make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:407: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:950: recipe for target 'drivers' failed
make: *** [drivers] Error 2

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

#13 lore raw
In reply to Ramalingam C
Quoted 103 lines · Ramalingam C

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

---
 drivers/gpu/drm/i915/intel_display.c |  107 ++++++++++++++++++++++++++++++++--
 1 file changed, 101 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +64 -0
index a66220a..f8685f5 100644
@@ -7814,6 +7814,69 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
 		   (intel_crtc->config->pipe_src_h - 1));
 }
 
+static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+				   struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
+	struct intel_encoder *encoder;
+	uint32_t tmp;
+
+	tmp = I915_READ(HTOTAL(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hdisplay = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_htotal =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	tmp = I915_READ(VBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(VSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	if (I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_INTERLACE_MASK) {
+		pipe_config->base.adjusted_mode.flags |=
+						DRM_MODE_FLAG_INTERLACE;
+		pipe_config->base.adjusted_mode.crtc_vtotal += 1;
+		pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
+	}
+
+
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		struct intel_dsi *intel_dsi =
+			enc_to_intel_dsi(&encoder->base);
+		enum port port;
+
+		pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
+		for_each_dsi_port(port, intel_dsi->ports) {
+			pipe_config->base.adjusted_mode.crtc_hdisplay =
+				I915_READ(BXT_MIPI_TRANS_HACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vdisplay =
+				I915_READ(BXT_MIPI_TRANS_VACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vtotal =
+				I915_READ(BXT_MIPI_TRANS_VTOTAL(port));
+		}
+	}
+
+	tmp = I915_READ(PIPESRC(crtc->pipe));
+	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+	pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+	pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}
+
 static void intel_get_pipe_timings(struct intel_crtc *crtc,
 				   struct intel_crtc_state *pipe_config)
 {
@@ -9969,6 +10032,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum intel_display_power_domain pfit_domain;
 	uint32_t tmp;
+	bool is_dsi = false;
 
 	if (!intel_display_power_is_enabled(dev_priv,
 					 POWER_DOMAIN_PIPE(crtc->pipe)))

drivers/gpu/drm/i915/intel_display.c static bool haswell_get_pipe_config(struct intel_crtc *crtc, · line 10068

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -9999,17 +10063,48 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 			pipe_config->cpu_transcoder = TRANSCODER_EDP;
 	}
 
+	if (dev_priv->vbt.has_mipi) {
+		enum port port_num = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+					? PORT_A : PORT_C;

Just "enum port port" please.

Quoted 16 lines
drivers/gpu/drm/i915/intel_display.c +16 -0
+		uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port_num));
+
+		tmp = I915_READ(BXT_MIPI_PORT_CTRL(port_num));
+		if (tmp & DPI_ENABLE) {
+			enum pipe trans_dsi_pipe;
+
+			switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+			default:
+				WARN(1, "unknown pipe linked to dsi transcoder\n");
+				return false;
+			case BXT_PIPE_SELECT_A:
+				trans_dsi_pipe = PIPE_A;
+				break;
+			case BXT_PIPE_SELECT_B:
+				trans_dsi_pipe = PIPE_B;
+				break;

drivers/gpu/drm/i915/intel_display.c static bool haswell_get_pipe_config(struct intel_crtc *crtc, · line 10094

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+			case BXT_PIPE_SELECT_C:
+				trans_dsi_pipe = PIPE_C;
+				break;
+			}
+
+			if (trans_dsi_pipe == crtc->pipe)
+				is_dsi = true;
+		}
+	}
+

You need to set pipe_config->has_dsi_encoder.

This is possibly cleanest, if you abstract the above into a separate function, say

bxt_get_pipe_config_dsi(struct intel_crtc *crtc, struct intel_crtc_state *pipe_config)

and set pipe_config->has_dsi_encoder if trans_dsi_pipe == crtc->pipe.

This probably needs to take into account the different power domains as well?

BR,
Jani.

PS. I guess we're missing the has_dsi_encoder readout for BYT/CHV as well. :(

Quoted 22 lines
drivers/gpu/drm/i915/intel_display.c +8 -6
 	if (!intel_display_power_is_enabled(dev_priv,
 			POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
 		return false;
 
-	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
-	if (!(tmp & PIPECONF_ENABLE))
-		return false;
-
-	haswell_get_ddi_port_state(crtc, pipe_config);
+	if (!is_dsi) {
+		tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
+		if (!(tmp & PIPECONF_ENABLE))
+			return false;
 
-	intel_get_pipe_timings(crtc, pipe_config);
+		haswell_get_ddi_port_state(crtc, pipe_config);
+		intel_get_pipe_timings(crtc, pipe_config);
+	} else
+		intel_get_dsi_pipe_timings(crtc, pipe_config);
 
 	if (INTEL_INFO(dev)->gen >= 9) {
 		skl_init_scalers(dev, crtc, pipe_config);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

Hi,

Quoted 107 lines · Jani Nikula
Quoted 106 lines · Ramalingam C

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

---
  drivers/gpu/drm/i915/intel_display.c |  107 ++++++++++++++++++++++++++++++++--
  1 file changed, 101 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +64 -0
index a66220a..f8685f5 100644
@@ -7814,6 +7814,69 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
  		   (intel_crtc->config->pipe_src_h - 1));
  }
 
+static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+				   struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
+	struct intel_encoder *encoder;
+	uint32_t tmp;
+
+	tmp = I915_READ(HTOTAL(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hdisplay = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_htotal =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	tmp = I915_READ(VBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(VSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	if (I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_INTERLACE_MASK) {
+		pipe_config->base.adjusted_mode.flags |=
+						DRM_MODE_FLAG_INTERLACE;
+		pipe_config->base.adjusted_mode.crtc_vtotal += 1;
+		pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
+	}
+
+
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		struct intel_dsi *intel_dsi =
+			enc_to_intel_dsi(&encoder->base);
+		enum port port;
+
+		pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
+		for_each_dsi_port(port, intel_dsi->ports) {
+			pipe_config->base.adjusted_mode.crtc_hdisplay =
+				I915_READ(BXT_MIPI_TRANS_HACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vdisplay =
+				I915_READ(BXT_MIPI_TRANS_VACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vtotal =
+				I915_READ(BXT_MIPI_TRANS_VTOTAL(port));
+		}
+	}
+
+	tmp = I915_READ(PIPESRC(crtc->pipe));
+	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+	pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+	pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}
+
  static void intel_get_pipe_timings(struct intel_crtc *crtc,
  				   struct intel_crtc_state *pipe_config)
  {
@@ -9969,6 +10032,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
  	struct drm_i915_private *dev_priv = dev->dev_private;
  	enum intel_display_power_domain pfit_domain;
  	uint32_t tmp;
+	bool is_dsi = false;
 
  	if (!intel_display_power_is_enabled(dev_priv,
  					 POWER_DOMAIN_PIPE(crtc->pipe)))
@@ -9999,17 +10063,48 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
  			pipe_config->cpu_transcoder = TRANSCODER_EDP;
  	}
 
Quoted 4 lines

drivers/gpu/drm/i915/intel_display.c static bool haswell_get_pipe_config(struct intel_crtc *crtc, · line 10068

Quoted 3 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
+	if (dev_priv->vbt.has_mipi) {
+		enum port port_num = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+					? PORT_A : PORT_C;

Just "enum port port" please.

I will take care of this suggestion in the next patch ver.

Quoted 29 lines
Quoted 17 lines
drivers/gpu/drm/i915/intel_display.c +16 -0
+		uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port_num));
+
+		tmp = I915_READ(BXT_MIPI_PORT_CTRL(port_num));
+		if (tmp & DPI_ENABLE) {
+			enum pipe trans_dsi_pipe;
+
+			switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+			default:
+				WARN(1, "unknown pipe linked to dsi transcoder\n");
+				return false;
+			case BXT_PIPE_SELECT_A:
+				trans_dsi_pipe = PIPE_A;
+				break;
+			case BXT_PIPE_SELECT_B:
+				trans_dsi_pipe = PIPE_B;
+				break;

drivers/gpu/drm/i915/intel_display.c static bool haswell_get_pipe_config(struct intel_crtc *crtc, · line 10094

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+			case BXT_PIPE_SELECT_C:
+				trans_dsi_pipe = PIPE_C;
+				break;
+			}
+
+			if (trans_dsi_pipe == crtc->pipe)
+				is_dsi = true;
+		}
+	}
+

You need to set pipe_config->has_dsi_encoder.

Quoted 7 lines

This is possibly cleanest, if you abstract the above into a separate function, say

bxt_get_pipe_config_dsi(struct intel_crtc *crtc, struct intel_crtc_state *pipe_config)

and set pipe_config->has_dsi_encoder if trans_dsi_pipe == crtc->pipe.

Ok. I am resubmitting with these changes.

Quoted 35 lines

This probably needs to take into account the different power domains as well?

BR,
Jani.

PS. I guess we're missing the has_dsi_encoder readout for BYT/CHV as well. :(

Quoted 22 lines
drivers/gpu/drm/i915/intel_display.c +8 -6
  	if (!intel_display_power_is_enabled(dev_priv,
  			POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
  		return false;
 
-	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
-	if (!(tmp & PIPECONF_ENABLE))
-		return false;
-
-	haswell_get_ddi_port_state(crtc, pipe_config);
+	if (!is_dsi) {
+		tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
+		if (!(tmp & PIPECONF_ENABLE))
+			return false;
 
-	intel_get_pipe_timings(crtc, pipe_config);
+		haswell_get_ddi_port_state(crtc, pipe_config);
+		intel_get_pipe_timings(crtc, pipe_config);
+	} else
+		intel_get_dsi_pipe_timings(crtc, pipe_config);
 
  	if (INTEL_INFO(dev)->gen >= 9) {
  		skl_init_scalers(dev, crtc, pipe_config);
Signature · 7 lines
Thanks,
--Ram

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

PATCH 1/2 drm/i915: Using the bpp value wrt the pixel format

In reply to Jani Nikula

From: Deepak M <[email protected]>

The bpp value which is used while calulating the txbyteclkhs values should be wrt the pixel format value. Currently bpp is coming from pipe config to calculate txbyteclkhs. Fix it in this patch.

---
 drivers/gpu/drm/i915/intel_dsi.c           |    5 ++---
 drivers/gpu/drm/i915/intel_dsi.h           |    1 +
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |    1 +
 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +2 -3
index 91cef35..aa11293 100644
@@ -775,10 +775,9 @@ static void set_dsi_timings(struct drm_encoder *encoder,
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = intel_dsi->dsi_bpp;
 	unsigned int lane_count = intel_dsi->lane_count;
 
 	u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
@@ -849,7 +848,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = intel_dsi->dsi_bpp;
 	u32 val, tmp;
 	u16 mode_hdisplay;
 
drivers/gpu/drm/i915/intel_dsi.h +1 -0
index de7be7f..9bf6fa1d 100644
@@ -64,6 +64,7 @@ struct intel_dsi {
 
 	/* video mode pixel format for MIPI_DSI_FUNC_PRG register */
 	u32 pixel_format;
+	u32 dsi_bpp;
 
 	/* video mode format for MIPI_VIDEO_MODE_FORMAT register */
 	u32 video_mode_format;
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
index 1d43e6f..bf266cb 100644
@@ -435,6 +435,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	intel_dsi->bw_timer = mipi_config->dbi_bw_timer;
 	intel_dsi->video_frmt_cfg_bits =
 		mipi_config->bta_enabled ? DISABLE_VIDEO_BTA : 0;
+	intel_dsi->dsi_bpp = bits_per_pixel;
 
 	pclk = mode->clock;
 
Signature · 6 lines
1.7.9.5

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

PATCH 2/2 drm/i915/BXT: Fixed COS blanking issue

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

---
 drivers/gpu/drm/i915/intel_display.c |  115 ++++++++++++++++++++++++++++++++--
 1 file changed, 109 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +109 -6
index a66220a..58d2cd9 100644
@@ -34,6 +34,7 @@
 #include <drm/drm_edid.h>
 #include <drm/drmP.h>
 #include "intel_drv.h"
+#include "intel_dsi.h"
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 #include "i915_trace.h"
@@ -7814,6 +7815,69 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
 		   (intel_crtc->config->pipe_src_h - 1));
 }
 
+static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+				   struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
+	struct intel_encoder *encoder;
+	uint32_t tmp;
+
+	tmp = I915_READ(HTOTAL(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hdisplay = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_htotal =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	tmp = I915_READ(VBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(VSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	if (I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_INTERLACE_MASK) {
+		pipe_config->base.adjusted_mode.flags |=
+						DRM_MODE_FLAG_INTERLACE;
+		pipe_config->base.adjusted_mode.crtc_vtotal += 1;
+		pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
+	}
+
+
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		struct intel_dsi *intel_dsi =
+			enc_to_intel_dsi(&encoder->base);
+		enum port port;
+
+		pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
+		for_each_dsi_port(port, intel_dsi->ports) {
+			pipe_config->base.adjusted_mode.crtc_hdisplay =
+				I915_READ(BXT_MIPI_TRANS_HACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vdisplay =
+				I915_READ(BXT_MIPI_TRANS_VACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vtotal =
+				I915_READ(BXT_MIPI_TRANS_VTOTAL(port));
+		}
+	}
+
+	tmp = I915_READ(PIPESRC(crtc->pipe));
+	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+	pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+	pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}
+
 static void intel_get_pipe_timings(struct intel_crtc *crtc,
 				   struct intel_crtc_state *pipe_config)
 {
@@ -9962,6 +10026,40 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
 	}
 }
 
+static void bxt_get_pipe_config_dsi(struct intel_crtc *crtc,
+					struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum port port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+				? PORT_A : PORT_C;
+	uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port));
+	uint32_t tmp;
+
+	tmp = I915_READ(BXT_MIPI_PORT_CTRL(port));
+	if (tmp & DPI_ENABLE) {
+		enum pipe trans_dsi_pipe;
+
+		switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+		default:
+			WARN(1, "unknown pipe linked to dsi transcoder\n");
+			return;
+		case BXT_PIPE_SELECT(PIPE_A):
+			trans_dsi_pipe = PIPE_A;
+			break;
+		case BXT_PIPE_SELECT(PIPE_B):
+			trans_dsi_pipe = PIPE_B;
+			break;
+		case BXT_PIPE_SELECT(PIPE_C):
+			trans_dsi_pipe = PIPE_C;
+			break;
+		}
+
+		if (trans_dsi_pipe == crtc->pipe)
+			pipe_config->has_dsi_encoder = true;
+	}
+}
+
 static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 				    struct intel_crtc_state *pipe_config)
 {
@@ -9999,17 +10097,22 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 			pipe_config->cpu_transcoder = TRANSCODER_EDP;
 	}
 
+	if (dev_priv->vbt.has_mipi && IS_BROXTON(dev))
+		bxt_get_pipe_config_dsi(crtc, pipe_config);
+
 	if (!intel_display_power_is_enabled(dev_priv,
 			POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
 		return false;
 
-	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
-	if (!(tmp & PIPECONF_ENABLE))
-		return false;
-
-	haswell_get_ddi_port_state(crtc, pipe_config);
+	if (!pipe_config->has_dsi_encoder) {
+		tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
+		if (!(tmp & PIPECONF_ENABLE))
+			return false;
 
-	intel_get_pipe_timings(crtc, pipe_config);
+		haswell_get_ddi_port_state(crtc, pipe_config);
+		intel_get_pipe_timings(crtc, pipe_config);
+	} else
+		intel_get_dsi_pipe_timings(crtc, pipe_config);
 
 	if (INTEL_INFO(dev)->gen >= 9) {
 		skl_init_scalers(dev, crtc, pipe_config);
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw
Quoted 33 lines · Ramalingam C

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

---
 drivers/gpu/drm/i915/intel_display.c |  115 ++++++++++++++++++++++++++++++++--
 1 file changed, 109 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -0
index a66220a..58d2cd9 100644
@@ -34,6 +34,7 @@
 #include <drm/drm_edid.h>
 #include <drm/drmP.h>
 #include "intel_drv.h"
+#include "intel_dsi.h"
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 #include "i915_trace.h"

drivers/gpu/drm/i915/intel_display.c static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) · line 7823

Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +6 -0
@@ -7814,6 +7815,69 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
 		   (intel_crtc->config->pipe_src_h - 1));
 }
 
+static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+				   struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;

Hum, how does this work for DSI transcoders.

Quoted 38 lines
drivers/gpu/drm/i915/intel_display.c +38 -0
+	struct intel_encoder *encoder;
+	uint32_t tmp;
+
+	tmp = I915_READ(HTOTAL(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hdisplay = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_htotal =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	tmp = I915_READ(VBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(VSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	if (I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_INTERLACE_MASK) {
+		pipe_config->base.adjusted_mode.flags |=
+						DRM_MODE_FLAG_INTERLACE;
+		pipe_config->base.adjusted_mode.crtc_vtotal += 1;
+		pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
+	}
+
+
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		struct intel_dsi *intel_dsi =
+			enc_to_intel_dsi(&encoder->base);
+		enum port port;
+

drivers/gpu/drm/i915/intel_display.c static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) · line 7871

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+		pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
+		for_each_dsi_port(port, intel_dsi->ports) {
+			pipe_config->base.adjusted_mode.crtc_hdisplay =
+				I915_READ(BXT_MIPI_TRANS_HACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vdisplay =
+				I915_READ(BXT_MIPI_TRANS_VACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vtotal =
+				I915_READ(BXT_MIPI_TRANS_VTOTAL(port));
+		}
+	}

Since you already figure out the port/pipe in bxt_get_pipe_config_dsi, I feel it would be better to use that instead of doing the for loops here and semi-blindly casting the encoder to intel_dsi.

drivers/gpu/drm/i915/intel_display.c static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) · line 7879

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +8 -0
+
+	tmp = I915_READ(PIPESRC(crtc->pipe));
+	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+	pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+	pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}

What's the point of duplicating most of intel_get_pipe_timings() when you could just call that first, and then do your bxt dsi specific stuff? I can't spot any differences.

Do we even need to read the generic HTOTAL etc. registers for DSI? Do they even make sense?

BR,
Jani.

Quoted 74 lines
drivers/gpu/drm/i915/intel_display.c +46 -6
+
 static void intel_get_pipe_timings(struct intel_crtc *crtc,
 				   struct intel_crtc_state *pipe_config)
 {
@@ -9962,6 +10026,40 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
 	}
 }
 
+static void bxt_get_pipe_config_dsi(struct intel_crtc *crtc,
+					struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum port port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+				? PORT_A : PORT_C;
+	uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port));
+	uint32_t tmp;
+
+	tmp = I915_READ(BXT_MIPI_PORT_CTRL(port));
+	if (tmp & DPI_ENABLE) {
+		enum pipe trans_dsi_pipe;
+
+		switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+		default:
+			WARN(1, "unknown pipe linked to dsi transcoder\n");
+			return;
+		case BXT_PIPE_SELECT(PIPE_A):
+			trans_dsi_pipe = PIPE_A;
+			break;
+		case BXT_PIPE_SELECT(PIPE_B):
+			trans_dsi_pipe = PIPE_B;
+			break;
+		case BXT_PIPE_SELECT(PIPE_C):
+			trans_dsi_pipe = PIPE_C;
+			break;
+		}
+
+		if (trans_dsi_pipe == crtc->pipe)
+			pipe_config->has_dsi_encoder = true;
+	}
+}
+
 static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 				    struct intel_crtc_state *pipe_config)
 {
@@ -9999,17 +10097,22 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 			pipe_config->cpu_transcoder = TRANSCODER_EDP;
 	}
 
+	if (dev_priv->vbt.has_mipi && IS_BROXTON(dev))
+		bxt_get_pipe_config_dsi(crtc, pipe_config);
+
 	if (!intel_display_power_is_enabled(dev_priv,
 			POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
 		return false;
 
-	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
-	if (!(tmp & PIPECONF_ENABLE))
-		return false;
-
-	haswell_get_ddi_port_state(crtc, pipe_config);
+	if (!pipe_config->has_dsi_encoder) {
+		tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
+		if (!(tmp & PIPECONF_ENABLE))
+			return false;
 
-	intel_get_pipe_timings(crtc, pipe_config);
+		haswell_get_ddi_port_state(crtc, pipe_config);
+		intel_get_pipe_timings(crtc, pipe_config);
+	} else
+		intel_get_dsi_pipe_timings(crtc, pipe_config);
 
 	if (INTEL_INFO(dev)->gen >= 9) {
 		skl_init_scalers(dev, crtc, pipe_config);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

Hi,

Thanks for the review comments. Addressing them in next version.

Quoted 189 lines · Jani Nikula
Quoted 33 lines · Ramalingam C

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

---
  drivers/gpu/drm/i915/intel_display.c |  115 ++++++++++++++++++++++++++++++++--
  1 file changed, 109 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -0
index a66220a..58d2cd9 100644
@@ -34,6 +34,7 @@
  #include <drm/drm_edid.h>
  #include <drm/drmP.h>
  #include "intel_drv.h"
+#include "intel_dsi.h"
  #include <drm/i915_drm.h>
  #include "i915_drv.h"
  #include "i915_trace.h"

drivers/gpu/drm/i915/intel_display.c static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) · line 7823

Quoted 9 lines
drivers/gpu/drm/i915/intel_display.c +6 -0
@@ -7814,6 +7815,69 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
  		   (intel_crtc->config->pipe_src_h - 1));
  }
 
+static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+				   struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;

Hum, how does this work for DSI transcoders.

Quoted 38 lines
drivers/gpu/drm/i915/intel_display.c +38 -0
+	struct intel_encoder *encoder;
+	uint32_t tmp;
+
+	tmp = I915_READ(HTOTAL(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hdisplay = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_htotal =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	tmp = I915_READ(VBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(VSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	if (I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_INTERLACE_MASK) {
+		pipe_config->base.adjusted_mode.flags |=
+						DRM_MODE_FLAG_INTERLACE;
+		pipe_config->base.adjusted_mode.crtc_vtotal += 1;
+		pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
+	}
+
+
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		struct intel_dsi *intel_dsi =
+			enc_to_intel_dsi(&encoder->base);
+		enum port port;
+

drivers/gpu/drm/i915/intel_display.c static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) · line 7871

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+		pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
+		for_each_dsi_port(port, intel_dsi->ports) {
+			pipe_config->base.adjusted_mode.crtc_hdisplay =
+				I915_READ(BXT_MIPI_TRANS_HACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vdisplay =
+				I915_READ(BXT_MIPI_TRANS_VACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vtotal =
+				I915_READ(BXT_MIPI_TRANS_VTOTAL(port));
+		}
+	}

Since you already figure out the port/pipe in bxt_get_pipe_config_dsi, I feel it would be better to use that instead of doing the for loops here and semi-blindly casting the encoder to intel_dsi.

drivers/gpu/drm/i915/intel_display.c static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) · line 7879

Quoted 8 lines
drivers/gpu/drm/i915/intel_display.c +8 -0
+
+	tmp = I915_READ(PIPESRC(crtc->pipe));
+	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+	pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+	pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}

What's the point of duplicating most of intel_get_pipe_timings() when you could just call that first, and then do your bxt dsi specific stuff? I can't spot any differences.

Do we even need to read the generic HTOTAL etc. registers for DSI? Do they even make sense?

BR,
Jani.

Quoted 74 lines
drivers/gpu/drm/i915/intel_display.c +46 -6
+
  static void intel_get_pipe_timings(struct intel_crtc *crtc,
  				   struct intel_crtc_state *pipe_config)
  {
@@ -9962,6 +10026,40 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
  	}
  }
 
+static void bxt_get_pipe_config_dsi(struct intel_crtc *crtc,
+					struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum port port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+				? PORT_A : PORT_C;
+	uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port));
+	uint32_t tmp;
+
+	tmp = I915_READ(BXT_MIPI_PORT_CTRL(port));
+	if (tmp & DPI_ENABLE) {
+		enum pipe trans_dsi_pipe;
+
+		switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+		default:
+			WARN(1, "unknown pipe linked to dsi transcoder\n");
+			return;
+		case BXT_PIPE_SELECT(PIPE_A):
+			trans_dsi_pipe = PIPE_A;
+			break;
+		case BXT_PIPE_SELECT(PIPE_B):
+			trans_dsi_pipe = PIPE_B;
+			break;
+		case BXT_PIPE_SELECT(PIPE_C):
+			trans_dsi_pipe = PIPE_C;
+			break;
+		}
+
+		if (trans_dsi_pipe == crtc->pipe)
+			pipe_config->has_dsi_encoder = true;
+	}
+}
+
  static bool haswell_get_pipe_config(struct intel_crtc *crtc,
  				    struct intel_crtc_state *pipe_config)
  {
@@ -9999,17 +10097,22 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
  			pipe_config->cpu_transcoder = TRANSCODER_EDP;
  	}
 
+	if (dev_priv->vbt.has_mipi && IS_BROXTON(dev))
+		bxt_get_pipe_config_dsi(crtc, pipe_config);
+
  	if (!intel_display_power_is_enabled(dev_priv,
  			POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
  		return false;
 
-	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
-	if (!(tmp & PIPECONF_ENABLE))
-		return false;
-
-	haswell_get_ddi_port_state(crtc, pipe_config);
+	if (!pipe_config->has_dsi_encoder) {
+		tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
+		if (!(tmp & PIPECONF_ENABLE))
+			return false;
 
-	intel_get_pipe_timings(crtc, pipe_config);
+		haswell_get_ddi_port_state(crtc, pipe_config);
+		intel_get_pipe_timings(crtc, pipe_config);
+	} else
+		intel_get_dsi_pipe_timings(crtc, pipe_config);
 
  	if (INTEL_INFO(dev)->gen >= 9) {
  		skl_init_scalers(dev, crtc, pipe_config);
Signature · 7 lines
Thanks,
--Ram

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

PATCH v3 2/3 drm/i915/BXT: Fixed COS blanking issue

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

V2: pipe_config->has_dsi_encoder is set for BXT [By Jani]

V3: Timing parameters are retrieved from VBT. [By Jani]

---
 drivers/gpu/drm/i915/intel_display.c |  106 ++++++++++++++++++++++++++++++++--
 1 file changed, 100 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +100 -6
index a66220a..e47a75c 100644
@@ -34,6 +34,7 @@
 #include <drm/drm_edid.h>
 #include <drm/drmP.h>
 #include "intel_drv.h"
+#include "intel_dsi.h"
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 #include "i915_trace.h"
@@ -7814,6 +7815,53 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
 		   (intel_crtc->config->pipe_src_h - 1));
 }
 
+static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+				   struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_display_mode *vbt_dsi_mode =
+						dev_priv->vbt.lfp_lvds_vbt_mode;
+	struct intel_encoder *encoder;
+	uint32_t tmp;
+
+	pipe_config->base.adjusted_mode.crtc_hdisplay = vbt_dsi_mode->hdisplay;
+	pipe_config->base.adjusted_mode.crtc_htotal = vbt_dsi_mode->htotal;
+	pipe_config->base.adjusted_mode.crtc_hblank_start =
+						vbt_dsi_mode->hdisplay;
+	pipe_config->base.adjusted_mode.crtc_hblank_end = vbt_dsi_mode->htotal;
+	pipe_config->base.adjusted_mode.crtc_hsync_start =
+						vbt_dsi_mode->hsync_start;
+	pipe_config->base.adjusted_mode.crtc_hsync_end =
+						vbt_dsi_mode->hsync_end;
+
+	pipe_config->base.adjusted_mode.crtc_vdisplay = vbt_dsi_mode->vdisplay;
+	pipe_config->base.adjusted_mode.crtc_vtotal = vbt_dsi_mode->vtotal;
+	pipe_config->base.adjusted_mode.crtc_vblank_start =
+							vbt_dsi_mode->vdisplay;
+	pipe_config->base.adjusted_mode.crtc_vblank_end = vbt_dsi_mode->vtotal;
+	pipe_config->base.adjusted_mode.crtc_vsync_start =
+						vbt_dsi_mode->vsync_start;
+	pipe_config->base.adjusted_mode.crtc_vsync_end =
+						vbt_dsi_mode->vsync_end;
+
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		if (encoder->type == INTEL_OUTPUT_DSI) {
+			struct intel_dsi *intel_dsi =
+				enc_to_intel_dsi(&encoder->base);
+			pipe_config->pipe_bpp =
+				dsi_pixel_format_bpp(intel_dsi->pixel_format);
+		}
+	}
+
+	tmp = I915_READ(PIPESRC(crtc->pipe));
+	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+	pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+	pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}
+
 static void intel_get_pipe_timings(struct intel_crtc *crtc,
 				   struct intel_crtc_state *pipe_config)
 {
@@ -9962,6 +10010,40 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
 	}
 }
 
+static void bxt_get_pipe_config_dsi(struct intel_crtc *crtc,
+					struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum port port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+				? PORT_A : PORT_C;
+	uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port));
+	uint32_t tmp;
+
+	tmp = I915_READ(BXT_MIPI_PORT_CTRL(port));
+	if (tmp & DPI_ENABLE) {
+		enum pipe trans_dsi_pipe;
+
+		switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+		default:
+			WARN(1, "unknown pipe linked to dsi transcoder\n");
+			return;
+		case BXT_PIPE_SELECT(PIPE_A):
+			trans_dsi_pipe = PIPE_A;
+			break;
+		case BXT_PIPE_SELECT(PIPE_B):
+			trans_dsi_pipe = PIPE_B;
+			break;
+		case BXT_PIPE_SELECT(PIPE_C):
+			trans_dsi_pipe = PIPE_C;
+			break;
+		}
+
+		if (trans_dsi_pipe == crtc->pipe)
+			pipe_config->has_dsi_encoder = true;
+	}
+}
+
 static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 				    struct intel_crtc_state *pipe_config)
 {
@@ -9999,17 +10081,29 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 			pipe_config->cpu_transcoder = TRANSCODER_EDP;
 	}
 
+	if (dev_priv->vbt.has_mipi && IS_BROXTON(dev))
+		bxt_get_pipe_config_dsi(crtc, pipe_config);
+
 	if (!intel_display_power_is_enabled(dev_priv,
 			POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
 		return false;
 
-	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
-	if (!(tmp & PIPECONF_ENABLE))
-		return false;
-
-	haswell_get_ddi_port_state(crtc, pipe_config);
+	if (pipe_config->has_dsi_encoder && IS_BROXTON(dev))
+		/*
+		 * BXT doesn't have the PIPE timing registers.
+		 * Hence retrieved the pipe detail from PORT register.
+		 * And timing parameters are obtained from VBT
+		 */
+		intel_get_dsi_pipe_timings(crtc, pipe_config);
+	else {
+		tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
+		if (!(tmp & PIPECONF_ENABLE))
+			return false;
+		if (!IS_VALLEYVIEW(dev))
+			haswell_get_ddi_port_state(crtc, pipe_config);
 
-	intel_get_pipe_timings(crtc, pipe_config);
+		intel_get_pipe_timings(crtc, pipe_config);
+	}
 
 	if (INTEL_INFO(dev)->gen >= 9) {
 		skl_init_scalers(dev, crtc, pipe_config);
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw
Quoted 37 lines · Ramalingam C

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

V2: pipe_config->has_dsi_encoder is set for BXT [By Jani]

V3: Timing parameters are retrieved from VBT. [By Jani]

---
 drivers/gpu/drm/i915/intel_display.c |  106 ++++++++++++++++++++++++++++++++--
 1 file changed, 100 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -0
index a66220a..e47a75c 100644
@@ -34,6 +34,7 @@
 #include <drm/drm_edid.h>
 #include <drm/drmP.h>
 #include "intel_drv.h"
+#include "intel_dsi.h"
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 #include "i915_trace.h"

drivers/gpu/drm/i915/intel_display.c static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) · line 7824

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7 -0
@@ -7814,6 +7815,53 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
 		   (intel_crtc->config->pipe_src_h - 1));
 }
 
+static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+				   struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_display_mode *vbt_dsi_mode =
+						dev_priv->vbt.lfp_lvds_vbt_mode;

The whole point of the function (and the call chain here) is to get the information from the hardware, so that we can a) set up the internal software state according to the hardware state at driver load, and b) later cross check the hardware state against the software state. Reading the information from the VBT provides no value.

Quoted 21 lines
drivers/gpu/drm/i915/intel_display.c +21 -0
+	struct intel_encoder *encoder;
+	uint32_t tmp;
+
+	pipe_config->base.adjusted_mode.crtc_hdisplay = vbt_dsi_mode->hdisplay;
+	pipe_config->base.adjusted_mode.crtc_htotal = vbt_dsi_mode->htotal;
+	pipe_config->base.adjusted_mode.crtc_hblank_start =
+						vbt_dsi_mode->hdisplay;
+	pipe_config->base.adjusted_mode.crtc_hblank_end = vbt_dsi_mode->htotal;
+	pipe_config->base.adjusted_mode.crtc_hsync_start =
+						vbt_dsi_mode->hsync_start;
+	pipe_config->base.adjusted_mode.crtc_hsync_end =
+						vbt_dsi_mode->hsync_end;
+
+	pipe_config->base.adjusted_mode.crtc_vdisplay = vbt_dsi_mode->vdisplay;
+	pipe_config->base.adjusted_mode.crtc_vtotal = vbt_dsi_mode->vtotal;
+	pipe_config->base.adjusted_mode.crtc_vblank_start =
+							vbt_dsi_mode->vdisplay;
+	pipe_config->base.adjusted_mode.crtc_vblank_end = vbt_dsi_mode->vtotal;
+	pipe_config->base.adjusted_mode.crtc_vsync_start =
+						vbt_dsi_mode->vsync_start;
+	pipe_config->base.adjusted_mode.crtc_vsync_end =

drivers/gpu/drm/i915/intel_display.c static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) · line 7855

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+						vbt_dsi_mode->vsync_end;
+
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		if (encoder->type == INTEL_OUTPUT_DSI) {
+			struct intel_dsi *intel_dsi =
+				enc_to_intel_dsi(&encoder->base);
+			pipe_config->pipe_bpp =
+				dsi_pixel_format_bpp(intel_dsi->pixel_format);
+		}
+	}

Things like this should be done in the encoder->get_config hook. Maybe *all* of this DSI timing business should be done there.

Maybe there needs to be a bxt specific get_config hook for DSI.

Quoted 13 lines
drivers/gpu/drm/i915/intel_display.c +9 -0
+
+	tmp = I915_READ(PIPESRC(crtc->pipe));
+	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+	pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+	pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}
+
 static void intel_get_pipe_timings(struct intel_crtc *crtc,
 				   struct intel_crtc_state *pipe_config)
 {

drivers/gpu/drm/i915/intel_display.c static void haswell_get_ddi_port_state(struct intel_crtc *crtc, · line 10019

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +7 -0
@@ -9962,6 +10010,40 @@ static void haswell_get_ddi_port_state(struct intel_crtc *crtc,
 	}
 }
 
+static void bxt_get_pipe_config_dsi(struct intel_crtc *crtc,
+					struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum port port = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+				? PORT_A : PORT_C;

Again, should read the hardware, not VBT.

Quoted 31 lines
drivers/gpu/drm/i915/intel_display.c +27 -0
+	uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port));
+	uint32_t tmp;
+
+	tmp = I915_READ(BXT_MIPI_PORT_CTRL(port));
+	if (tmp & DPI_ENABLE) {
+		enum pipe trans_dsi_pipe;
+
+		switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+		default:
+			WARN(1, "unknown pipe linked to dsi transcoder\n");
+			return;
+		case BXT_PIPE_SELECT(PIPE_A):
+			trans_dsi_pipe = PIPE_A;
+			break;
+		case BXT_PIPE_SELECT(PIPE_B):
+			trans_dsi_pipe = PIPE_B;
+			break;
+		case BXT_PIPE_SELECT(PIPE_C):
+			trans_dsi_pipe = PIPE_C;
+			break;
+		}
+
+		if (trans_dsi_pipe == crtc->pipe)
+			pipe_config->has_dsi_encoder = true;
+	}
+}
+
 static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 				    struct intel_crtc_state *pipe_config)
 {

drivers/gpu/drm/i915/intel_display.c static bool haswell_get_pipe_config(struct intel_crtc *crtc, · line 10085

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +2 -0
@@ -9999,17 +10081,29 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 			pipe_config->cpu_transcoder = TRANSCODER_EDP;
 	}
 
+	if (dev_priv->vbt.has_mipi && IS_BROXTON(dev))
+		bxt_get_pipe_config_dsi(crtc, pipe_config);

We should read the hardware, not VBT. The point is, what if we have DSI enabled even though VBT says no? Then we have a problem somewhere, and this code is used for cross checking such problems.

But maybe this should be moved into the encoder hook no matter what.

drivers/gpu/drm/i915/intel_display.c static bool haswell_get_pipe_config(struct intel_crtc *crtc, · line 10091

Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c +2 -5
+
 	if (!intel_display_power_is_enabled(dev_priv,
 			POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
 		return false;
 
-	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
-	if (!(tmp & PIPECONF_ENABLE))
-		return false;
-
-	haswell_get_ddi_port_state(crtc, pipe_config);
+	if (pipe_config->has_dsi_encoder && IS_BROXTON(dev))

No need to check for IS_BROXTON.

Quoted 19 lines
drivers/gpu/drm/i915/intel_display.c +14 -1
+		/*
+		 * BXT doesn't have the PIPE timing registers.
+		 * Hence retrieved the pipe detail from PORT register.
+		 * And timing parameters are obtained from VBT
+		 */
+		intel_get_dsi_pipe_timings(crtc, pipe_config);
+	else {
+		tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
+		if (!(tmp & PIPECONF_ENABLE))
+			return false;
+		if (!IS_VALLEYVIEW(dev))
+			haswell_get_ddi_port_state(crtc, pipe_config);
 
-	intel_get_pipe_timings(crtc, pipe_config);
+		intel_get_pipe_timings(crtc, pipe_config);
+	}
 
 	if (INTEL_INFO(dev)->gen >= 9) {
 		skl_init_scalers(dev, crtc, pipe_config);
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

Re: [PATCH 1/2] drm/i915: Using the bpp value wrt the pixel format

In reply to Ramalingam C
Quoted 45 lines · Ramalingam C

From: Deepak M <[email protected]>

The bpp value which is used while calulating the txbyteclkhs values should be wrt the pixel format value. Currently bpp is coming from pipe config to calculate txbyteclkhs. Fix it in this patch.

---
 drivers/gpu/drm/i915/intel_dsi.c           |    5 ++---
 drivers/gpu/drm/i915/intel_dsi.h           |    1 +
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |    1 +
 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +2 -3
index 91cef35..aa11293 100644
@@ -775,10 +775,9 @@ static void set_dsi_timings(struct drm_encoder *encoder,
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = intel_dsi->dsi_bpp;
 	unsigned int lane_count = intel_dsi->lane_count;
 
 	u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
@@ -849,7 +848,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = intel_dsi->dsi_bpp;
 	u32 val, tmp;
 	u16 mode_hdisplay;
 
drivers/gpu/drm/i915/intel_dsi.h +0 -0
index de7be7f..9bf6fa1d 100644

drivers/gpu/drm/i915/intel_dsi.h struct intel_dsi { · line 67

Quoted 4 lines
drivers/gpu/drm/i915/intel_dsi.h +1 -0
@@ -64,6 +64,7 @@ struct intel_dsi {
 
 	/* video mode pixel format for MIPI_DSI_FUNC_PRG register */
 	u32 pixel_format;
+	u32 dsi_bpp;

Please never add extra state for things that can trivially be derived from existing information.

Given the dsi_pixel_format_bpp() in intel_dsi_pll.c, this should always hold, right:

	intel_dsi->dsi_bpp == dsi_pixel_format_bpp(intel_dsi->pixel_format)

Please just make dsi_pixel_format_bpp() available and use it. As a nice bonus, this becomes self-documenting code on why pipe config is not used where the bpp based on pixel format is used.

BR,
Jani.

Quoted 14 lines
drivers/gpu/drm/i915/intel_dsi.h +0 -0
 	/* video mode format for MIPI_VIDEO_MODE_FORMAT register */
 	u32 video_mode_format;
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
index 1d43e6f..bf266cb 100644
@@ -435,6 +435,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	intel_dsi->bw_timer = mipi_config->dbi_bw_timer;
 	intel_dsi->video_frmt_cfg_bits =
 		mipi_config->bta_enabled ? DISABLE_VIDEO_BTA : 0;
+	intel_dsi->dsi_bpp = bits_per_pixel;
 
 	pclk = mode->clock;
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#22 lore raw

Re: [PATCH 1/2] drm/i915: Using the bpp value wrt the pixel format

Quoted 53 lines · Jani Nikula
Quoted 45 lines · Ramalingam C

From: Deepak M <[email protected]>

The bpp value which is used while calulating the txbyteclkhs values should be wrt the pixel format value. Currently bpp is coming from pipe config to calculate txbyteclkhs. Fix it in this patch.

---
  drivers/gpu/drm/i915/intel_dsi.c           |    5 ++---
  drivers/gpu/drm/i915/intel_dsi.h           |    1 +
  drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |    1 +
  3 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +2 -3
index 91cef35..aa11293 100644
@@ -775,10 +775,9 @@ static void set_dsi_timings(struct drm_encoder *encoder,
  {
  	struct drm_device *dev = encoder->dev;
  	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
  	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = intel_dsi->dsi_bpp;
  	unsigned int lane_count = intel_dsi->lane_count;
 
  	u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
@@ -849,7 +848,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
  	const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
  	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = intel_dsi->dsi_bpp;
  	u32 val, tmp;
  	u16 mode_hdisplay;
 
drivers/gpu/drm/i915/intel_dsi.h +0 -0
index de7be7f..9bf6fa1d 100644

drivers/gpu/drm/i915/intel_dsi.h struct intel_dsi { · line 67

Quoted 4 lines
drivers/gpu/drm/i915/intel_dsi.h +1 -0
@@ -64,6 +64,7 @@ struct intel_dsi {
 
  	/* video mode pixel format for MIPI_DSI_FUNC_PRG register */
  	u32 pixel_format;
+	u32 dsi_bpp;

Please never add extra state for things that can trivially be derived from existing information.

Quoted 8 lines

Given the dsi_pixel_format_bpp() in intel_dsi_pll.c, this should always hold, right:

	intel_dsi->dsi_bpp == dsi_pixel_format_bpp(intel_dsi->pixel_format)

Please just make dsi_pixel_format_bpp() available and use it. As a nice bonus, this becomes self-documenting code on why pipe config is not used where the bpp based on pixel format is used.

Agreed. Implemented in the next version. Thanks

Quoted 19 lines

BR,
Jani.

Quoted 14 lines
drivers/gpu/drm/i915/intel_dsi.h +0 -0
  	/* video mode format for MIPI_VIDEO_MODE_FORMAT register */
  	u32 video_mode_format;
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -0
index 1d43e6f..bf266cb 100644
@@ -435,6 +435,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
  	intel_dsi->bw_timer = mipi_config->dbi_bw_timer;
  	intel_dsi->video_frmt_cfg_bits =
  		mipi_config->bta_enabled ? DISABLE_VIDEO_BTA : 0;
+	intel_dsi->dsi_bpp = bits_per_pixel;
 
  	pclk = mode->clock;
Signature · 7 lines
Thanks,
--Ram

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

PATCH v2 1/3 drm/i915: Using the bpp value wrt the pixel format

From: Deepak M <[email protected]>

The bpp value which is used while calulating the txbyteclkhs values should be wrt the pixel format value. Currently bpp is coming from pipe config to calculate txbyteclkhs. Fix it in this patch.

V2: dsi_pixel_format_bpp is used to retrieve the bpp from pixel_format
[Review: Jani]

---
 drivers/gpu/drm/i915/intel_dsi.c           |    5 ++---
 drivers/gpu/drm/i915/intel_dsi.h           |    2 ++
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |    5 +----
 drivers/gpu/drm/i915/intel_dsi_pll.c       |    2 +-
 4 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +2 -3
index 91cef35..ce94342 100644
@@ -775,10 +775,9 @@ static void set_dsi_timings(struct drm_encoder *encoder,
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 	unsigned int lane_count = intel_dsi->lane_count;
 
 	u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
@@ -849,7 +848,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 	u32 val, tmp;
 	u16 mode_hdisplay;
 
drivers/gpu/drm/i915/intel_dsi.h +2 -0
index de7be7f..92f3922 100644
@@ -34,6 +34,8 @@
 #define DSI_DUAL_LINK_FRONT_BACK	1
 #define DSI_DUAL_LINK_PIXEL_ALT		2
 
+int dsi_pixel_format_bpp(int pixel_format);
+
 struct intel_dsi_host;
 
 struct intel_dsi {
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -4
index 1d43e6f..23c0f67 100644
@@ -420,10 +420,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	intel_dsi->dual_link = mipi_config->dual_link;
 	intel_dsi->pixel_overlap = mipi_config->pixel_overlap;
 
-	if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB666)
-		bits_per_pixel = 18;
-	else if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB565)
-		bits_per_pixel = 16;
+	bits_per_pixel = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 
 	intel_dsi->operation_mode = mipi_config->is_cmd_mode;
 	intel_dsi->video_mode_format = mipi_config->video_transfer_mode;
drivers/gpu/drm/i915/intel_dsi_pll.c +1 -1
index bb5e95a..70883c5 100644
@@ -30,7 +30,7 @@
 #include "i915_drv.h"
 #include "intel_dsi.h"
 
-static int dsi_pixel_format_bpp(int pixel_format)
+int dsi_pixel_format_bpp(int pixel_format)
 {
 	int bpp;
 
Signature · 6 lines
1.7.9.5

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

PATCH 3/3 drm/i915: Updating the CPU_TRANSCODER for BXT DSI

In case of BXT DSI we are updating the CPU_TRANSCODER with appropriate value.

---
 drivers/gpu/drm/i915/i915_drv.h      |    2 ++
 drivers/gpu/drm/i915/intel_display.c |    5 +++++
 2 files changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 65a2cd0..ef4b376 100644
@@ -122,6 +122,8 @@ enum transcoder {
 	TRANSCODER_B,
 	TRANSCODER_C,
 	TRANSCODER_EDP,
+	TRANSCODER_MIPI_A,
+	TRANSCODER_MIPI_C,
 	I915_MAX_TRANSCODERS
 };
 #define transcoder_name(t) ((t) + 'A')
drivers/gpu/drm/i915/intel_display.c +5 -0
index e47a75c..9715056 100644
@@ -7851,6 +7851,11 @@ static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
 				enc_to_intel_dsi(&encoder->base);
 			pipe_config->pipe_bpp =
 				dsi_pixel_format_bpp(intel_dsi->pixel_format);
+
+			if (intel_dsi->ports & (1 << PORT_A))
+				pipe_config->cpu_transcoder = TRANSCODER_MIPI_A;
+			else
+				pipe_config->cpu_transcoder = TRANSCODER_MIPI_C;
 		}
 	}
 
Signature · 6 lines
1.7.9.5

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

Re: [PATCH 3/3] drm/i915: Updating the CPU_TRANSCODER for BXT DSI

Quoted 28 lines · Ramalingam C

In case of BXT DSI we are updating the CPU_TRANSCODER with appropriate value.

---
 drivers/gpu/drm/i915/i915_drv.h      |    2 ++
 drivers/gpu/drm/i915/intel_display.c |    5 +++++
 2 files changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 65a2cd0..ef4b376 100644
@@ -122,6 +122,8 @@ enum transcoder {
 	TRANSCODER_B,
 	TRANSCODER_C,
 	TRANSCODER_EDP,
+	TRANSCODER_MIPI_A,
+	TRANSCODER_MIPI_C,
 	I915_MAX_TRANSCODERS
 };
 #define transcoder_name(t) ((t) + 'A')
drivers/gpu/drm/i915/intel_display.c +0 -0
index e47a75c..9715056 100644

drivers/gpu/drm/i915/intel_display.c static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc, · line 7860

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +5 -0
@@ -7851,6 +7851,11 @@ static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
 				enc_to_intel_dsi(&encoder->base);
 			pipe_config->pipe_bpp =
 				dsi_pixel_format_bpp(intel_dsi->pixel_format);
+
+			if (intel_dsi->ports & (1 << PORT_A))
+				pipe_config->cpu_transcoder = TRANSCODER_MIPI_A;
+			else
+				pipe_config->cpu_transcoder = TRANSCODER_MIPI_C;
 		}
 	}

As I've said in my review of the previous version of the patch [1], you can't just add transcoder identifiers and expect everything to magically work.

The current assumption is there are at most transcoders A, B, C, and eDP. We use them to index registers. Not all registers have a corresponding DSI transcoder variant, and if they do, they are not uniformly spread in the register offset space. See haswell_crtc_disable for an example where things go wrong. There are others.

I do not know what the best approach here would be; it is obvious to me this can't work.

BR,
Jani.

[1] http://mid.gmane.org/[email protected]

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

Re: [PATCH 3/3] drm/i915: Updating the CPU_TRANSCODER for BXT DSI

Quoted 43 lines · Jani Nikula
Quoted 28 lines · Ramalingam C

In case of BXT DSI we are updating the CPU_TRANSCODER with appropriate value.

---
  drivers/gpu/drm/i915/i915_drv.h      |    2 ++
  drivers/gpu/drm/i915/intel_display.c |    5 +++++
  2 files changed, 7 insertions(+)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 65a2cd0..ef4b376 100644
@@ -122,6 +122,8 @@ enum transcoder {
  	TRANSCODER_B,
  	TRANSCODER_C,
  	TRANSCODER_EDP,
+	TRANSCODER_MIPI_A,
+	TRANSCODER_MIPI_C,
  	I915_MAX_TRANSCODERS
  };
  #define transcoder_name(t) ((t) + 'A')
drivers/gpu/drm/i915/intel_display.c +0 -0
index e47a75c..9715056 100644

drivers/gpu/drm/i915/intel_display.c static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc, · line 7860

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +5 -0
@@ -7851,6 +7851,11 @@ static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
  				enc_to_intel_dsi(&encoder->base);
  			pipe_config->pipe_bpp =
  				dsi_pixel_format_bpp(intel_dsi->pixel_format);
+
+			if (intel_dsi->ports & (1 << PORT_A))
+				pipe_config->cpu_transcoder = TRANSCODER_MIPI_A;
+			else
+				pipe_config->cpu_transcoder = TRANSCODER_MIPI_C;
  		}
  	}

As I've said in my review of the previous version of the patch [1], you can't just add transcoder identifiers and expect everything to magically work.

Quoted 8 lines

The current assumption is there are at most transcoders A, B, C, and eDP. We use them to index registers. Not all registers have a corresponding DSI transcoder variant, and if they do, they are not uniformly spread in the register offset space. See haswell_crtc_disable for an example where things go wrong. There are others.

I do not know what the best approach here would be; it is obvious to me this can't work.

As correcting the CPU transcoder value alone wont solve our problem.
In the next patch set I am adding corresponding POWER_DOMAIN bits
and adding them to the respective POWER wells. This will enable generic power well management calls to map the cpu transcoders to the corresponding powerwell
and help them to maintain them as per the need. Hope that will address the concern raised here.

Quoted 9 lines

BR,
Jani.

[1] http://mid.gmane.org/[email protected]

Signature · 7 lines
Thanks,
--Ram

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

Re: [PATCH 1/3 V2] drm/i915: Using the bpp value wrt the pixel format

In reply to Ramalingam C
Quoted 6 lines · Ramalingam C

From: Deepak M <[email protected]>

The bpp value which is used while calulating the txbyteclkhs values should be wrt the pixel format value. Currently bpp is coming from pipe config to calculate txbyteclkhs. Fix it in this patch.

Quoted 6 lines

V2: dsi_pixel_format_bpp is used to retrieve the bpp from pixel_format
[Review: Jani]

This needs a Tested-by on at least BYT to ensure everything still works.

Quoted 73 lines
---
 drivers/gpu/drm/i915/intel_dsi.c           |    5 ++---
 drivers/gpu/drm/i915/intel_dsi.h           |    2 ++
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |    5 +----
 drivers/gpu/drm/i915/intel_dsi_pll.c       |    2 +-
 4 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +2 -3
index 91cef35..ce94342 100644
@@ -775,10 +775,9 @@ static void set_dsi_timings(struct drm_encoder *encoder,
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 	unsigned int lane_count = intel_dsi->lane_count;
 
 	u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
@@ -849,7 +848,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 	u32 val, tmp;
 	u16 mode_hdisplay;
 
drivers/gpu/drm/i915/intel_dsi.h +2 -0
index de7be7f..92f3922 100644
@@ -34,6 +34,8 @@
 #define DSI_DUAL_LINK_FRONT_BACK	1
 #define DSI_DUAL_LINK_PIXEL_ALT		2
 
+int dsi_pixel_format_bpp(int pixel_format);
+
 struct intel_dsi_host;
 
 struct intel_dsi {
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -4
index 1d43e6f..23c0f67 100644
@@ -420,10 +420,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	intel_dsi->dual_link = mipi_config->dual_link;
 	intel_dsi->pixel_overlap = mipi_config->pixel_overlap;
 
-	if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB666)
-		bits_per_pixel = 18;
-	else if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB565)
-		bits_per_pixel = 16;
+	bits_per_pixel = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 
 	intel_dsi->operation_mode = mipi_config->is_cmd_mode;
 	intel_dsi->video_mode_format = mipi_config->video_transfer_mode;
drivers/gpu/drm/i915/intel_dsi_pll.c +1 -1
index bb5e95a..70883c5 100644
@@ -30,7 +30,7 @@
 #include "i915_drv.h"
 #include "intel_dsi.h"
 
-static int dsi_pixel_format_bpp(int pixel_format)
+int dsi_pixel_format_bpp(int pixel_format)
 {
 	int bpp;
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by
#28 lore raw

Re: [PATCH 1/3 V2] drm/i915: Using the bpp value wrt the pixel format

Quoted 7 lines · Jani Nikula
Quoted 6 lines · Ramalingam C

From: Deepak M <[email protected]>

The bpp value which is used while calulating the txbyteclkhs values should be wrt the pixel format value. Currently bpp is coming from pipe config to calculate txbyteclkhs. Fix it in this patch.

Quoted 6 lines
Quoted 6 lines

V2: dsi_pixel_format_bpp is used to retrieve the bpp from pixel_format
[Review: Jani]

Tested on BYT, Asus T100

Quoted 73 lines

This needs a Tested-by on at least BYT to ensure everything still works.

Quoted 69 lines
---
 drivers/gpu/drm/i915/intel_dsi.c           |    5 ++---
 drivers/gpu/drm/i915/intel_dsi.h           |    2 ++
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |    5 +----
 drivers/gpu/drm/i915/intel_dsi_pll.c       |    2 +-
 4 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +2 -3
index 91cef35..ce94342 100644
@@ -775,10 +775,9 @@ static void set_dsi_timings(struct drm_encoder *encoder,
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 	unsigned int lane_count = intel_dsi->lane_count;
 
 	u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
@@ -849,7 +848,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 	u32 val, tmp;
 	u16 mode_hdisplay;
 
drivers/gpu/drm/i915/intel_dsi.h +2 -0
index de7be7f..92f3922 100644
@@ -34,6 +34,8 @@
 #define DSI_DUAL_LINK_FRONT_BACK	1
 #define DSI_DUAL_LINK_PIXEL_ALT		2
 
+int dsi_pixel_format_bpp(int pixel_format);
+
 struct intel_dsi_host;
 
 struct intel_dsi {
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -4
index 1d43e6f..23c0f67 100644
@@ -420,10 +420,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	intel_dsi->dual_link = mipi_config->dual_link;
 	intel_dsi->pixel_overlap = mipi_config->pixel_overlap;
 
-	if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB666)
-		bits_per_pixel = 18;
-	else if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB565)
-		bits_per_pixel = 16;
+	bits_per_pixel = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 
 	intel_dsi->operation_mode = mipi_config->is_cmd_mode;
 	intel_dsi->video_mode_format = mipi_config->video_transfer_mode;
drivers/gpu/drm/i915/intel_dsi_pll.c +0 -0
index bb5e95a..70883c5 100644
@@ -30,7 +30,7 @@
 #include "i915_drv.h"
 #include "intel_dsi.h"
 
Quoted 5 lines

drivers/gpu/drm/i915/intel_dsi_pll.c line 35

Quoted 4 lines
drivers/gpu/drm/i915/intel_dsi_pll.c +1 -1
-static int dsi_pixel_format_bpp(int pixel_format)
+int dsi_pixel_format_bpp(int pixel_format)
 {
 	int bpp;

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

#29 lore raw

Re: [PATCH 1/3 V2] drm/i915: Using the bpp value wrt the pixel format

Quoted 11 lines · Mika Kahola
Quoted 10 lines · Jani Nikula
Quoted 9 lines · Ramalingam C

From: Deepak M <[email protected]>

The bpp value which is used while calulating the txbyteclkhs values should be wrt the pixel format value. Currently bpp is coming from pipe config to calculate txbyteclkhs. Fix it in this patch.

V2: dsi_pixel_format_bpp is used to retrieve the bpp from pixel_format
[Review: Jani]

Quoted 6 lines
Quoted 3 lines
Quoted 3 lines

Tested on BYT, Asus T100

Thanks, pushed to drm-intel-next-queued.

BR,
Jani.

Quoted 81 lines
Quoted 79 lines

This needs a Tested-by on at least BYT to ensure everything still works.

Quoted 73 lines
---
 drivers/gpu/drm/i915/intel_dsi.c           |    5 ++---
 drivers/gpu/drm/i915/intel_dsi.h           |    2 ++
 drivers/gpu/drm/i915/intel_dsi_panel_vbt.c |    5 +----
 drivers/gpu/drm/i915/intel_dsi_pll.c       |    2 +-
 4 files changed, 6 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +2 -3
index 91cef35..ce94342 100644
@@ -775,10 +775,9 @@ static void set_dsi_timings(struct drm_encoder *encoder,
 {
 	struct drm_device *dev = encoder->dev;
 	struct drm_i915_private *dev_priv = dev->dev_private;
-	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 	unsigned int lane_count = intel_dsi->lane_count;
 
 	u16 hactive, hfp, hsync, hbp, vfp, vsync, vbp;
@@ -849,7 +848,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 	const struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
 	enum port port;
-	unsigned int bpp = intel_crtc->config->pipe_bpp;
+	unsigned int bpp = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 	u32 val, tmp;
 	u16 mode_hdisplay;
 
drivers/gpu/drm/i915/intel_dsi.h +2 -0
index de7be7f..92f3922 100644
@@ -34,6 +34,8 @@
 #define DSI_DUAL_LINK_FRONT_BACK	1
 #define DSI_DUAL_LINK_PIXEL_ALT		2
 
+int dsi_pixel_format_bpp(int pixel_format);
+
 struct intel_dsi_host;
 
 struct intel_dsi {
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +1 -4
index 1d43e6f..23c0f67 100644
@@ -420,10 +420,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	intel_dsi->dual_link = mipi_config->dual_link;
 	intel_dsi->pixel_overlap = mipi_config->pixel_overlap;
 
-	if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB666)
-		bits_per_pixel = 18;
-	else if (intel_dsi->pixel_format == VID_MODE_FORMAT_RGB565)
-		bits_per_pixel = 16;
+	bits_per_pixel = dsi_pixel_format_bpp(intel_dsi->pixel_format);
 
 	intel_dsi->operation_mode = mipi_config->is_cmd_mode;
 	intel_dsi->video_mode_format = mipi_config->video_transfer_mode;
drivers/gpu/drm/i915/intel_dsi_pll.c +1 -1
index bb5e95a..70883c5 100644
@@ -30,7 +30,7 @@
 #include "i915_drv.h"
 #include "intel_dsi.h"
 
-static int dsi_pixel_format_bpp(int pixel_format)
+int dsi_pixel_format_bpp(int pixel_format)
 {
 	int bpp;
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#30 lore raw
In reply to Jani Nikula
Quoted 153 lines · Jani Nikula
Quoted 103 lines · Ramalingam C

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

---
 drivers/gpu/drm/i915/intel_display.c |  107 ++++++++++++++++++++++++++++++++--
 1 file changed, 101 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +64 -0
index a66220a..f8685f5 100644
@@ -7814,6 +7814,69 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
 		   (intel_crtc->config->pipe_src_h - 1));
 }
 
+static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+				   struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
+	struct intel_encoder *encoder;
+	uint32_t tmp;
+
+	tmp = I915_READ(HTOTAL(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hdisplay = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_htotal =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	tmp = I915_READ(VBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(VSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	if (I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_INTERLACE_MASK) {
+		pipe_config->base.adjusted_mode.flags |=
+						DRM_MODE_FLAG_INTERLACE;
+		pipe_config->base.adjusted_mode.crtc_vtotal += 1;
+		pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
+	}
+
+
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		struct intel_dsi *intel_dsi =
+			enc_to_intel_dsi(&encoder->base);
+		enum port port;
+
+		pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
+		for_each_dsi_port(port, intel_dsi->ports) {
+			pipe_config->base.adjusted_mode.crtc_hdisplay =
+				I915_READ(BXT_MIPI_TRANS_HACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vdisplay =
+				I915_READ(BXT_MIPI_TRANS_VACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vtotal =
+				I915_READ(BXT_MIPI_TRANS_VTOTAL(port));
+		}
+	}
+
+	tmp = I915_READ(PIPESRC(crtc->pipe));
+	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+	pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+	pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}
+
 static void intel_get_pipe_timings(struct intel_crtc *crtc,
 				   struct intel_crtc_state *pipe_config)
 {
@@ -9969,6 +10032,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum intel_display_power_domain pfit_domain;
 	uint32_t tmp;
+	bool is_dsi = false;
 
 	if (!intel_display_power_is_enabled(dev_priv,
 					 POWER_DOMAIN_PIPE(crtc->pipe)))

drivers/gpu/drm/i915/intel_display.c static bool haswell_get_pipe_config(struct intel_crtc *crtc, · line 10068

Quoted 6 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
@@ -9999,17 +10063,48 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 			pipe_config->cpu_transcoder = TRANSCODER_EDP;
 	}
 
+	if (dev_priv->vbt.has_mipi) {
+		enum port port_num = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+					? PORT_A : PORT_C;

Just "enum port port" please.

Quoted 16 lines
drivers/gpu/drm/i915/intel_display.c +16 -0
+		uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port_num));
+
+		tmp = I915_READ(BXT_MIPI_PORT_CTRL(port_num));
+		if (tmp & DPI_ENABLE) {
+			enum pipe trans_dsi_pipe;
+
+			switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+			default:
+				WARN(1, "unknown pipe linked to dsi transcoder\n");
+				return false;
+			case BXT_PIPE_SELECT_A:
+				trans_dsi_pipe = PIPE_A;
+				break;
+			case BXT_PIPE_SELECT_B:
+				trans_dsi_pipe = PIPE_B;
+				break;

drivers/gpu/drm/i915/intel_display.c static bool haswell_get_pipe_config(struct intel_crtc *crtc, · line 10094

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+			case BXT_PIPE_SELECT_C:
+				trans_dsi_pipe = PIPE_C;
+				break;
+			}
+
+			if (trans_dsi_pipe == crtc->pipe)
+				is_dsi = true;
+		}
+	}
+

You need to set pipe_config->has_dsi_encoder.

This is possibly cleanest, if you abstract the above into a separate function, say

bxt_get_pipe_config_dsi(struct intel_crtc *crtc, struct intel_crtc_state *pipe_config)

and set pipe_config->has_dsi_encoder if trans_dsi_pipe == crtc->pipe.

This probably needs to take into account the different power domains as well?

Quoted 6 lines

BR,
Jani.

PS. I guess we're missing the has_dsi_encoder readout for BYT/CHV as well. :(

That means we really, really should have a pipe config check for has_dsi_encoder, which we're lacking too. Plus we don't even have a machine with DSI in CI, which is why no one noticed that either.

Please add all the missing bits here. Iron rule is that if you read out some hw state, then you _must_ add corresponding state checks ot intel_pipe_config_compare.
-Daniel

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

✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Using the bpp value wrt the pixel format (rev2)

In reply to Ramalingam C
== Summary ==

== Summary ==

Series 3017v2 Series without cover letter
http://patchwork.freedesktop.org/api/1.0/series/3017/revisions/2/mbox/

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-c:
                incomplete -> PASS       (hsw-gt2)
bdw-nuci7        total:156  pass:147  dwarn:0   dfail:0   fail:0   skip:9  
bdw-ultra        total:159  pass:147  dwarn:0   dfail:0   fail:0   skip:12 
bsw-nuc-2        total:159  pass:131  dwarn:0   dfail:0   fail:0   skip:28 
byt-nuc          total:159  pass:136  dwarn:0   dfail:0   fail:0   skip:23 
hsw-brixbox      total:159  pass:146  dwarn:0   dfail:0   fail:0   skip:13 
hsw-gt2          total:159  pass:149  dwarn:0   dfail:0   fail:0   skip:10 
ilk-hp8440p      total:159  pass:111  dwarn:0   dfail:0   fail:0   skip:48 
ivb-t430s        total:159  pass:145  dwarn:0   dfail:0   fail:0   skip:14 
snb-dellxps      total:159  pass:137  dwarn:0   dfail:0   fail:0   skip:22 
snb-x220t        total:159  pass:137  dwarn:0   dfail:0   fail:1   skip:21 

Results at /archive/results/CI_IGT_test/Patchwork_1352/

02932377a975a59ccd83095816d5b23183107d79 drm-intel-nightly: 2016y-02m-03d-01h-54m-27s UTC integration manifest 5aa340e83bfa4a73b3b40ec49bf972a4324b3c62 drm/i915/dsi: Add audio reference in dsi encoder c11b5a301945a99ac2376fae823d1e3aa30effdf drm/i915: Using the bpp value wrt the pixel format

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

#32 lore raw
In reply to Ramalingam C
Quoted 72 lines · Ramalingam C

From: Uma Shankar <[email protected]>

During Charging OS mode, mipi display was blanking.This is because during driver load, though encoder, connector were active but crtc returned inactive. This caused sanitize function to disable the DSI panel. In AOS, this is fine since HWC will do a modeset and crtc, connector, encoder mapping will be restored. But in COS, no modeset is called, it just calls DPMS ON/OFF.

This is fine on BYT/CHT since transcoder is common b/w all encoders. But for BXT, there is a separate mipi transcoder. Hence this needs special handling for BXT.

---
 drivers/gpu/drm/i915/intel_display.c |  107 ++++++++++++++++++++++++++++++++--
 1 file changed, 101 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +44 -0
index a66220a..f8685f5 100644
@@ -7814,6 +7814,69 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
 		   (intel_crtc->config->pipe_src_h - 1));
 }
 
+static void intel_get_dsi_pipe_timings(struct intel_crtc *crtc,
+				   struct intel_crtc_state *pipe_config)
+{
+	struct drm_device *dev = crtc->base.dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
+	struct intel_encoder *encoder;
+	uint32_t tmp;
+
+	tmp = I915_READ(HTOTAL(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hdisplay = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_htotal =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(HSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_hsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_hsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	tmp = I915_READ(VBLANK(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vblank_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vblank_end =
+						((tmp >> 16) & 0xffff) + 1;
+	tmp = I915_READ(VSYNC(cpu_transcoder));
+	pipe_config->base.adjusted_mode.crtc_vsync_start = (tmp & 0xffff) + 1;
+	pipe_config->base.adjusted_mode.crtc_vsync_end =
+						((tmp >> 16) & 0xffff) + 1;
+
+	if (I915_READ(PIPECONF(cpu_transcoder)) & PIPECONF_INTERLACE_MASK) {
+		pipe_config->base.adjusted_mode.flags |=
+						DRM_MODE_FLAG_INTERLACE;
+		pipe_config->base.adjusted_mode.crtc_vtotal += 1;
+		pipe_config->base.adjusted_mode.crtc_vblank_end += 1;
+	}
+
+
+	for_each_encoder_on_crtc(dev, &crtc->base, encoder) {
+		struct intel_dsi *intel_dsi =
+			enc_to_intel_dsi(&encoder->base);
+		enum port port;
+

drivers/gpu/drm/i915/intel_display.c static void intel_set_pipe_timings(struct intel_crtc *intel_crtc) · line 7870

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+		pipe_config->pipe_bpp = intel_dsi->dsi_bpp;
+		for_each_dsi_port(port, intel_dsi->ports) {
+			pipe_config->base.adjusted_mode.crtc_hdisplay =
+				I915_READ(BXT_MIPI_TRANS_HACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vdisplay =
+				I915_READ(BXT_MIPI_TRANS_VACTIVE(port));
+			pipe_config->base.adjusted_mode.crtc_vtotal =
+				I915_READ(BXT_MIPI_TRANS_VTOTAL(port));
+		}
+	}

If some state is encoder specific (and a for_each_encoder_on_crtc highly suggests that), then please read out such state from the encoder->get_config hook.
-Daniel

Quoted 82 lines
drivers/gpu/drm/i915/intel_display.c +47 -6
+
+	tmp = I915_READ(PIPESRC(crtc->pipe));
+	pipe_config->pipe_src_h = (tmp & 0xffff) + 1;
+	pipe_config->pipe_src_w = ((tmp >> 16) & 0xffff) + 1;
+
+	pipe_config->base.mode.vdisplay = pipe_config->pipe_src_h;
+	pipe_config->base.mode.hdisplay = pipe_config->pipe_src_w;
+}
+
 static void intel_get_pipe_timings(struct intel_crtc *crtc,
 				   struct intel_crtc_state *pipe_config)
 {
@@ -9969,6 +10032,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	enum intel_display_power_domain pfit_domain;
 	uint32_t tmp;
+	bool is_dsi = false;
 
 	if (!intel_display_power_is_enabled(dev_priv,
 					 POWER_DOMAIN_PIPE(crtc->pipe)))
@@ -9999,17 +10063,48 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
 			pipe_config->cpu_transcoder = TRANSCODER_EDP;
 	}
 
+	if (dev_priv->vbt.has_mipi) {
+		enum port port_num = (dev_priv->vbt.dsi.port == DVO_PORT_MIPIA)
+					? PORT_A : PORT_C;
+		uint32_t dsi_ctrl = I915_READ(MIPI_CTRL(port_num));
+
+		tmp = I915_READ(BXT_MIPI_PORT_CTRL(port_num));
+		if (tmp & DPI_ENABLE) {
+			enum pipe trans_dsi_pipe;
+
+			switch (dsi_ctrl & BXT_PIPE_SELECT_MASK) {
+			default:
+				WARN(1, "unknown pipe linked to dsi transcoder\n");
+				return false;
+			case BXT_PIPE_SELECT_A:
+				trans_dsi_pipe = PIPE_A;
+				break;
+			case BXT_PIPE_SELECT_B:
+				trans_dsi_pipe = PIPE_B;
+				break;
+			case BXT_PIPE_SELECT_C:
+				trans_dsi_pipe = PIPE_C;
+				break;
+			}
+
+			if (trans_dsi_pipe == crtc->pipe)
+				is_dsi = true;
+		}
+	}
+
 	if (!intel_display_power_is_enabled(dev_priv,
 			POWER_DOMAIN_TRANSCODER(pipe_config->cpu_transcoder)))
 		return false;
 
-	tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
-	if (!(tmp & PIPECONF_ENABLE))
-		return false;
-
-	haswell_get_ddi_port_state(crtc, pipe_config);
+	if (!is_dsi) {
+		tmp = I915_READ(PIPECONF(pipe_config->cpu_transcoder));
+		if (!(tmp & PIPECONF_ENABLE))
+			return false;
 
-	intel_get_pipe_timings(crtc, pipe_config);
+		haswell_get_ddi_port_state(crtc, pipe_config);
+		intel_get_pipe_timings(crtc, pipe_config);
+	} else
+		intel_get_dsi_pipe_timings(crtc, pipe_config);
 
 	if (INTEL_INFO(dev)->gen >= 9) {
 		skl_init_scalers(dev, crtc, pipe_config);
Signature · 6 lines
1.7.9.5

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