Skip to contentSkip to conversation

drm/i915: Simplify the pfit check in the fastboot hack

PATCH In review Daniel Vetter 4 participants 6 messages Nov 3, 2014 – Nov 4, 2014

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

PATCH 1/2 drm/i915: Simplify the pfit check in the fastboot hack

Checking for lvds/edp is wrong (since we also support dsi panels now) and not terribly useless. If we want to be more intelligent about all this then we need to look at the old state to figure out whether the pfit adjustment is needed. This goes all the way back to the original fastboot pfit patch:

commit 4d6a3e63bce0cb604864e36585ca8983160a421a

Author: Jesse Barnes <[email protected]>
Date:   Wed Jun 26 01:38:18 2013 +0300

drm/i915: turn off panel fitting at flip time if needed v2

Spotted while reviewing Ander's patch which changed a lot of the pipe_has_type checks.

---
 drivers/gpu/drm/i915/intel_ddi.c     | 5 ++---
 drivers/gpu/drm/i915/intel_display.c | 4 +---
 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -3
index e620a63a1dfe..d41768846f18 100644
@@ -473,9 +473,8 @@ intel_ddi_get_crtc_new_encoder(struct intel_crtc *crtc)
 		}
 	}
 
-	if (num_encoders != 1)
-		WARN(1, "%d encoders on crtc for pipe %c\n", num_encoders,
-		     pipe_name(crtc->pipe));
+	WARN(num_encoders != 1, "%d encoders on crtc for pipe %c\n", num_encoders,
+	     pipe_name(crtc->pipe));
 
 	BUG_ON(ret == NULL);
 	return ret;
drivers/gpu/drm/i915/intel_display.c +1 -3
index 6bd290d902df..5eb12ed11df5 100644
@@ -2877,9 +2877,7 @@ static void intel_update_pipe_size(struct intel_crtc *crtc)
 	I915_WRITE(PIPESRC(crtc->pipe),
 		   ((adjusted_mode->crtc_hdisplay - 1) << 16) |
 		   (adjusted_mode->crtc_vdisplay - 1));
-	if (!crtc->config.pch_pfit.enabled &&
-	    (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) ||
-	     intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) {
+	if (!crtc->config.pch_pfit.enabled) {
 		I915_WRITE(PF_CTL(crtc->pipe), 0);
 		I915_WRITE(PF_WIN_POS(crtc->pipe), 0);
 		I915_WRITE(PF_WIN_SZ(crtc->pipe), 0);
Signature · 6 lines
2.1.1

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

PATCH 2/2 drm/i915: Check pipe_config.has_dp_encoder instead of encoder types

More concise. Noticed while reviewing Ander's patch which touched a lot of the pipe_has_type checks.

---
 drivers/gpu/drm/i915/intel_display.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -6
index 5eb12ed11df5..f7e751bcccb1 100644
@@ -3784,9 +3784,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 	intel_fdi_normal_train(crtc);
 
 	/* For PCH DP, enable TRANS_DP_CTL */
-	if (HAS_PCH_CPT(dev) &&
-	    (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) ||
-	     intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_EDP))) {
+	if (HAS_PCH_CPT(dev) && intel_crtc->config.has_dp_encoder) {
 		u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5;
 		reg = TRANS_DP_CTL(pipe);
 		temp = I915_READ(reg);
@@ -5865,8 +5863,7 @@ static void vlv_prepare_pll(struct intel_crtc *crtc,
 		vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe),
 				 0x00d0000f);
 
-	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP) ||
-	    intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
+	if (crtc->config.has_dp_encoder) {
 		/* Use SSC source */
 		if (pipe == PIPE_A)
 			vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW5(pipe),
@@ -6056,7 +6053,7 @@ static void i9xx_update_pll(struct intel_crtc *crtc,
 	if (is_sdvo)
 		dpll |= DPLL_SDVO_HIGH_SPEED;
 
-	if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_DISPLAYPORT))
+	if (crtc->config.has_dp_encoder)
 		dpll |= DPLL_SDVO_HIGH_SPEED;
 
 	/* compute bitmask from p1 value */
Signature · 6 lines
2.1.1

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

Re: [PATCH 2/2] drm/i915: Check pipe_config.has_dp_encoder instead of encoder types

Quoted 34 lines · Daniel Vetter

More concise. Noticed while reviewing Ander's patch which touched a lot of the pipe_has_type checks.

---
  drivers/gpu/drm/i915/intel_display.c | 9 +++------
  1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -5
index 5eb12ed11df5..f7e751bcccb1 100644
@@ -3784,9 +3784,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
  	intel_fdi_normal_train(crtc);
 
  	/* For PCH DP, enable TRANS_DP_CTL */
-	if (HAS_PCH_CPT(dev) &&
-	    (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) ||
-	     intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_EDP))) {
+	if (HAS_PCH_CPT(dev) && intel_crtc->config.has_dp_encoder) {
  		u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5;
  		reg = TRANS_DP_CTL(pipe);
  		temp = I915_READ(reg);
@@ -5865,8 +5863,7 @@ static void vlv_prepare_pll(struct intel_crtc *crtc,
  		vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe),
  				 0x00d0000f);
 
-	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP) ||
-	    intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
+	if (crtc->config.has_dp_encoder) {
  		/* Use SSC source */
  		if (pipe == PIPE_A)
  			vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW5(pipe),

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

Quoted 5 lines
drivers/gpu/drm/i915/intel_display.c +1 -1
@@ -6056,7 +6053,7 @@ static void i9xx_update_pll(struct intel_crtc *crtc,
  	if (is_sdvo)
  		dpll |= DPLL_SDVO_HIGH_SPEED;
 
-	if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_DISPLAYPORT))
+	if (crtc->config.has_dp_encoder)

crtc->new_config ?

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

Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +0 -0
  		dpll |= DPLL_SDVO_HIGH_SPEED;
 
  	/* compute bitmask from p1 value */

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

#3 lore raw

PATCH 1/1 drm/i915: Check pipe_config.has_dp_encoder instead of encoder types

More concise. Noticed while reviewing Ander's patch which touched a lot of the pipe_has_type checks.

v2: Use new_config in one place Ander spotted.

Cc Ander Conselvan de Oliveira <[email protected]>
---
 drivers/gpu/drm/i915/intel_display.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -6
index 5eb12ed11df5..d631df1f98d2 100644
@@ -3784,9 +3784,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 	intel_fdi_normal_train(crtc);
 
 	/* For PCH DP, enable TRANS_DP_CTL */
-	if (HAS_PCH_CPT(dev) &&
-	    (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) ||
-	     intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_EDP))) {
+	if (HAS_PCH_CPT(dev) && intel_crtc->config.has_dp_encoder) {
 		u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPECONF_BPC_MASK) >> 5;
 		reg = TRANS_DP_CTL(pipe);
 		temp = I915_READ(reg);
@@ -5865,8 +5863,7 @@ static void vlv_prepare_pll(struct intel_crtc *crtc,
 		vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW10(pipe),
 				 0x00d0000f);
 
-	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP) ||
-	    intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
+	if (crtc->config.has_dp_encoder) {
 		/* Use SSC source */
 		if (pipe == PIPE_A)
 			vlv_dpio_write(dev_priv, pipe, VLV_PLL_DW5(pipe),
@@ -6056,7 +6053,7 @@ static void i9xx_update_pll(struct intel_crtc *crtc,
 	if (is_sdvo)
 		dpll |= DPLL_SDVO_HIGH_SPEED;
 
-	if (intel_pipe_will_have_type(crtc, INTEL_OUTPUT_DISPLAYPORT))
+	if (crtc->new_config.has_dp_encoder)
 		dpll |= DPLL_SDVO_HIGH_SPEED;
 
 	/* compute bitmask from p1 value */
Signature · 6 lines
2.1.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#4 lore raw
In reply to Daniel Vetter
Quoted 2 lines · Daniel Vetter

Checking for lvds/edp is wrong (since we also support dsi panels now) and not terribly useless. If we want to be more intelligent about all

"wrong ... and not terribly useless"? useful?

BR,
Jani.

Quoted 58 lines

this then we need to look at the old state to figure out whether the pfit adjustment is needed. This goes all the way back to the original fastboot pfit patch:

commit 4d6a3e63bce0cb604864e36585ca8983160a421a

Author: Jesse Barnes <[email protected]>
Date:   Wed Jun 26 01:38:18 2013 +0300

drm/i915: turn off panel fitting at flip time if needed v2

Spotted while reviewing Ander's patch which changed a lot of the pipe_has_type checks.

---
 drivers/gpu/drm/i915/intel_ddi.c     | 5 ++---
 drivers/gpu/drm/i915/intel_display.c | 4 +---
 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -3
index e620a63a1dfe..d41768846f18 100644
@@ -473,9 +473,8 @@ intel_ddi_get_crtc_new_encoder(struct intel_crtc *crtc)
 		}
 	}
 
-	if (num_encoders != 1)
-		WARN(1, "%d encoders on crtc for pipe %c\n", num_encoders,
-		     pipe_name(crtc->pipe));
+	WARN(num_encoders != 1, "%d encoders on crtc for pipe %c\n", num_encoders,
+	     pipe_name(crtc->pipe));
 
 	BUG_ON(ret == NULL);
 	return ret;
drivers/gpu/drm/i915/intel_display.c +1 -3
index 6bd290d902df..5eb12ed11df5 100644
@@ -2877,9 +2877,7 @@ static void intel_update_pipe_size(struct intel_crtc *crtc)
 	I915_WRITE(PIPESRC(crtc->pipe),
 		   ((adjusted_mode->crtc_hdisplay - 1) << 16) |
 		   (adjusted_mode->crtc_vdisplay - 1));
-	if (!crtc->config.pch_pfit.enabled &&
-	    (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) ||
-	     intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP))) {
+	if (!crtc->config.pch_pfit.enabled) {
 		I915_WRITE(PF_CTL(crtc->pipe), 0);
 		I915_WRITE(PF_WIN_POS(crtc->pipe), 0);
 		I915_WRITE(PF_WIN_SZ(crtc->pipe), 0);
Signature · 6 lines
2.1.1

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

Checking for lvds/edp is wrong (since we also support dsi panels now) and not terribly useless. If we want to be more intelligent about all

"wrong ... and not terribly useless"? useful?

Yes. Argh!
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx