All of lore.kernel.org
 help / color / mirror / Atom feed
* IVB fixes and 3 pipe support
@ 2011-10-19 15:12 Jesse Barnes
  2011-10-19 15:12 ` [PATCH 01/14] drm/i915: PLL macro cleanup and pipe assertion check Jesse Barnes
                   ` (14 more replies)
  0 siblings, 15 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

Latest patches; Eugeni can you reply with your tested-by?  I think
they're all ready for upstream.

Thanks,
Jesse

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

* [PATCH 01/14] drm/i915: PLL macro cleanup and pipe assertion check
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 02/14] drm/i915: support 3 pipes on IVB+ Jesse Barnes
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

Add a macro for accessing the two pipe PLLs and add a check to make sure
we don't access a non-existent one in the enable/disable functions.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_reg.h      |    6 +++---
 drivers/gpu/drm/i915/intel_display.c |    6 ++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 138eae1..9ec935d 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2958,15 +2958,15 @@
 
 #define _PCH_DPLL_A              0xc6014
 #define _PCH_DPLL_B              0xc6018
-#define PCH_DPLL(pipe) _PIPE(pipe, _PCH_DPLL_A, _PCH_DPLL_B)
+#define PCH_DPLL(pipe) (pipe == 0 ?  _PCH_DPLL_A : _PCH_DPLL_B)
 
 #define _PCH_FPA0                0xc6040
 #define  FP_CB_TUNE		(0x3<<22)
 #define _PCH_FPA1                0xc6044
 #define _PCH_FPB0                0xc6048
 #define _PCH_FPB1                0xc604c
-#define PCH_FP0(pipe) _PIPE(pipe, _PCH_FPA0, _PCH_FPB0)
-#define PCH_FP1(pipe) _PIPE(pipe, _PCH_FPA1, _PCH_FPB1)
+#define PCH_FP0(pipe) (pipe == 0 ? _PCH_FPA0 : _PCH_FPB0)
+#define PCH_FP1(pipe) (pipe == 0 ? _PCH_FPA1 : _PCH_FPB1)
 
 #define PCH_DPLL_TEST           0xc606c
 
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f0e5f9f..0fe347f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1172,6 +1172,9 @@ static void intel_enable_pch_pll(struct drm_i915_private *dev_priv,
 	int reg;
 	u32 val;
 
+	if (pipe > 1)
+		return;
+
 	/* PCH only available on ILK+ */
 	BUG_ON(dev_priv->info->gen < 5);
 
@@ -1192,6 +1195,9 @@ static void intel_disable_pch_pll(struct drm_i915_private *dev_priv,
 	int reg;
 	u32 val;
 
+	if (pipe > 1)
+		return;
+
 	/* PCH only available on ILK+ */
 	BUG_ON(dev_priv->info->gen < 5);
 
-- 
1.7.4.1

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

* [PATCH 02/14] drm/i915: support 3 pipes on IVB+
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
  2011-10-19 15:12 ` [PATCH 01/14] drm/i915: PLL macro cleanup and pipe assertion check Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 03/14] drm/i915: split refclk code out of ironlake_crtc_mode_set Jesse Barnes
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

Well almost anyway.  IVB has 3 planes, pipes, transcoders, and FDI
interfaces, but only 2 pipe PLLs.  So two of the pipes must use the same
pipe timings (e.g. 2 DP plus one other, or two HDMI with the same mode
and one other, etc.).

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_dma.c      |    4 +++-
 drivers/gpu/drm/i915/i915_drv.h      |    4 ++--
 drivers/gpu/drm/i915/intel_display.c |    7 +++++++
 drivers/gpu/drm/i915/intel_dp.c      |    2 +-
 drivers/gpu/drm/i915/intel_hdmi.c    |    2 +-
 drivers/gpu/drm/i915/intel_lvds.c    |    8 +++++---
 drivers/gpu/drm/i915/intel_sdvo.c    |    2 +-
 7 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index d76da38..2eac955 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -2035,7 +2035,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 	spin_lock_init(&dev_priv->error_lock);
 	spin_lock_init(&dev_priv->rps_lock);
 
-	if (IS_MOBILE(dev) || !IS_GEN2(dev))
+	if (IS_IVYBRIDGE(dev))
+		dev_priv->num_pipe = 3;
+	else if (IS_MOBILE(dev) || !IS_GEN2(dev))
 		dev_priv->num_pipe = 2;
 	else
 		dev_priv->num_pipe = 1;
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 15c0ca5..1ad6be1 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -676,8 +676,8 @@ typedef struct drm_i915_private {
 	u32 pch_pf_pos, pch_pf_size;
 	int panel_t3, panel_t12;
 
-	struct drm_crtc *plane_to_crtc_mapping[2];
-	struct drm_crtc *pipe_to_crtc_mapping[2];
+	struct drm_crtc *plane_to_crtc_mapping[3];
+	struct drm_crtc *pipe_to_crtc_mapping[3];
 	wait_queue_head_t pending_flip_queue;
 	bool flip_pending_is_done;
 
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0fe347f..4004f33 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2084,6 +2084,7 @@ static int ironlake_update_plane(struct drm_crtc *crtc,
 	switch (plane) {
 	case 0:
 	case 1:
+	case 2:
 		break;
 	default:
 		DRM_ERROR("Can't update plane %d in SAREA\n", plane);
@@ -2183,6 +2184,10 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
 	case 0:
 	case 1:
 		break;
+	case 2:
+		if (IS_IVYBRIDGE(dev))
+			break;
+		/* fall through otherwise */
 	default:
 		DRM_ERROR("no plane for crtc\n");
 		return -EINVAL;
@@ -2879,6 +2884,8 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 			temp |= (TRANSA_DPLL_ENABLE | TRANSA_DPLLA_SEL);
 		else if (pipe == 1 && (temp & TRANSB_DPLL_ENABLE) == 0)
 			temp |= (TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL);
+		else if (pipe == 2 && (temp & TRANSC_DPLL_ENABLE) == 0)
+			temp |= (TRANSC_DPLL_ENABLE | TRANSC_DPLLB_SEL);
 		I915_WRITE(PCH_DPLL_SEL, temp);
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 6cbde9f..f4b873b 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2000,7 +2000,7 @@ intel_dp_init(struct drm_device *dev, int output_reg)
 	if (is_edp(intel_dp))
 		intel_encoder->clone_mask = (1 << INTEL_EDP_CLONE_BIT);
 
-	intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
+	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
 	connector->interlace_allowed = true;
 	connector->doublescan_allowed = 0;
 
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 75026ba..185c5aa 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -514,7 +514,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
 	connector->polled = DRM_CONNECTOR_POLL_HPD;
 	connector->interlace_allowed = 0;
 	connector->doublescan_allowed = 0;
-	intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
+	intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
 
 	/* Set up the DDC bus. */
 	if (sdvox_reg == SDVOB) {
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 31da77f..42f165a 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -888,9 +888,11 @@ bool intel_lvds_init(struct drm_device *dev)
 	intel_encoder->type = INTEL_OUTPUT_LVDS;
 
 	intel_encoder->clone_mask = (1 << INTEL_LVDS_CLONE_BIT);
-	intel_encoder->crtc_mask = (1 << 1);
-	if (INTEL_INFO(dev)->gen >= 5)
-		intel_encoder->crtc_mask |= (1 << 0);
+	if (HAS_PCH_SPLIT(dev))
+		intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
+	else
+		intel_encoder->crtc_mask = (1 << 1);
+
 	drm_encoder_helper_add(encoder, &intel_lvds_helper_funcs);
 	drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs);
 	connector->display_info.subpixel_order = SubPixelHorizontalRGB;
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index aa94110..389d34e 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2244,7 +2244,7 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, uint16_t flags)
 			      bytes[0], bytes[1]);
 		return false;
 	}
-	intel_sdvo->base.crtc_mask = (1 << 0) | (1 << 1);
+	intel_sdvo->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
 
 	return true;
 }
-- 
1.7.4.1

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

* [PATCH 03/14] drm/i915: split refclk code out of ironlake_crtc_mode_set
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
  2011-10-19 15:12 ` [PATCH 01/14] drm/i915: PLL macro cleanup and pipe assertion check Jesse Barnes
  2011-10-19 15:12 ` [PATCH 02/14] drm/i915: support 3 pipes on IVB+ Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 04/14] drm/i915: use transcoder select bits on VGA and HDMI on CPT Jesse Barnes
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

Just a cleanup to make the mode_set function more manageable.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c |   45 ++++++++++++++++++++++++++-------
 1 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 4004f33..45b24eb 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5188,6 +5188,40 @@ static void ironlake_update_pch_refclk(struct drm_device *dev)
 	}
 }
 
+static int ironlake_get_refclk(struct drm_crtc *crtc)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_encoder *encoder;
+	struct drm_mode_config *mode_config = &dev->mode_config;
+	struct intel_encoder *edp_encoder = NULL;
+	int num_connectors = 0;
+	bool is_lvds = false;
+
+	list_for_each_entry(encoder, &mode_config->encoder_list, base.head) {
+		if (encoder->base.crtc != crtc)
+			continue;
+
+		switch (encoder->type) {
+		case INTEL_OUTPUT_LVDS:
+			is_lvds = true;
+			break;
+		case INTEL_OUTPUT_EDP:
+			edp_encoder = encoder;
+			break;
+		}
+		num_connectors++;
+	}
+
+	if (is_lvds && intel_panel_use_ssc(dev_priv) && num_connectors < 2) {
+		DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n",
+			      dev_priv->lvds_ssc_freq);
+		return dev_priv->lvds_ssc_freq * 1000;
+	}
+
+	return 120000;
+}
+
 static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 				  struct drm_display_mode *mode,
 				  struct drm_display_mode *adjusted_mode,
@@ -5247,16 +5281,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 		num_connectors++;
 	}
 
-	if (is_lvds && intel_panel_use_ssc(dev_priv) && num_connectors < 2) {
-		refclk = dev_priv->lvds_ssc_freq * 1000;
-		DRM_DEBUG_KMS("using SSC reference clock of %d MHz\n",
-			      refclk / 1000);
-	} else {
-		refclk = 96000;
-		if (!has_edp_encoder ||
-		    intel_encoder_is_pch_edp(&has_edp_encoder->base))
-			refclk = 120000; /* 120Mhz refclk */
-	}
+	refclk = ironlake_get_refclk(crtc);
 
 	/*
 	 * Returns a set of divisors for the desired target clock with the given
-- 
1.7.4.1

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

* [PATCH 04/14] drm/i915: use transcoder select bits on VGA and HDMI on CPT
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (2 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 03/14] drm/i915: split refclk code out of ironlake_crtc_mode_set Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 05/14] drm/i915: fix PCH PLL assertion check for 3 pipes Jesse Barnes
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

Required for 3 pipe functionality.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_crt.c  |   18 +++++++-----------
 drivers/gpu/drm/i915/intel_hdmi.c |   10 ++++------
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 451534c..fee0ad0 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -152,17 +152,13 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
 		adpa |= ADPA_VSYNC_ACTIVE_HIGH;
 
-	if (intel_crtc->pipe == 0) {
-		if (HAS_PCH_CPT(dev))
-			adpa |= PORT_TRANS_A_SEL_CPT;
-		else
-			adpa |= ADPA_PIPE_A_SELECT;
-	} else {
-		if (HAS_PCH_CPT(dev))
-			adpa |= PORT_TRANS_B_SEL_CPT;
-		else
-			adpa |= ADPA_PIPE_B_SELECT;
-	}
+	/* For CPT allow 3 pipe config, for others just use A or B */
+	if (HAS_PCH_CPT(dev))
+		adpa |= PORT_TRANS_SEL_CPT(intel_crtc->pipe);
+	else if (intel_crtc->pipe == 0)
+		adpa |= ADPA_PIPE_A_SELECT;
+	else
+		adpa |= ADPA_PIPE_B_SELECT;
 
 	if (!HAS_PCH_SPLIT(dev))
 		I915_WRITE(BCLRPAT(intel_crtc->pipe), 0);
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 185c5aa..e7e716c 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -252,12 +252,10 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
 		intel_write_eld(encoder, adjusted_mode);
 	}
 
-	if (intel_crtc->pipe == 1) {
-		if (HAS_PCH_CPT(dev))
-			sdvox |= PORT_TRANS_B_SEL_CPT;
-		else
-			sdvox |= SDVO_PIPE_B_SELECT;
-	}
+	if (HAS_PCH_CPT(dev))
+		sdvox |= PORT_TRANS_SEL_CPT(intel_crtc->pipe);
+	else if (intel_crtc->pipe == 1)
+		sdvox |= SDVO_PIPE_B_SELECT;
 
 	I915_WRITE(intel_hdmi->sdvox_reg, sdvox);
 	POSTING_READ(intel_hdmi->sdvox_reg);
-- 
1.7.4.1

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

* [PATCH 05/14] drm/i915: fix PCH PLL assertion check for 3 pipes
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (3 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 04/14] drm/i915: use transcoder select bits on VGA and HDMI on CPT Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 06/14] drm/i915: always set FDI composite sync bit Jesse Barnes
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

Add a couple of checks now that we're using the 3rd transcoder:
  1) make sure the transcoder PLL enable bit is set for the transcoder
     in question
  2) when checking actual PLL enable, use the selected PLL number rather
     than the transcoder number (they could be different now)

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 45b24eb..7e5f309 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -803,6 +803,19 @@ static void assert_pch_pll(struct drm_i915_private *dev_priv,
 	u32 val;
 	bool cur_state;
 
+	if (HAS_PCH_CPT(dev_priv->dev)) {
+		u32 pch_dpll;
+
+		pch_dpll = I915_READ(PCH_DPLL_SEL);
+
+		/* Make sure the selected PLL is enabled to the transcoder */
+		WARN(!((pch_dpll >> (4 * pipe)) & 8),
+		     "transcoder %d PLL not enabled\n", pipe);
+
+		/* Convert the transcoder pipe number to a pll pipe number */
+		pipe = (pch_dpll >> (4 * pipe)) & 1;
+	}
+
 	reg = PCH_DPLL(pipe);
 	val = I915_READ(reg);
 	cur_state = !!(val & DPLL_VCO_ENABLE);
-- 
1.7.4.1

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

* [PATCH 06/14] drm/i915: always set FDI composite sync bit
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (4 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 05/14] drm/i915: fix PCH PLL assertion check for 3 pipes Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 07/14] drm/i915: add PLL sharing support to handle 3 pipes Jesse Barnes
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

On IVB with CPT or PPT PCH chips, FDI sync can be done with one or two wires
depending on the board configuration.  For 3 pipe configurations, since
FDI B and C share lanes, composite sync must be used.  The board design
specs require that composite sync always work in general too, so just
use it by default, since we don't currently have a way of knowing if
frame/line sync are supported on a given board.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_reg.h      |    1 +
 drivers/gpu/drm/i915/intel_display.c |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 9ec935d..a79f435 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3180,6 +3180,7 @@
 #define  FDI_LINK_TRAIN_NONE_IVB            (3<<8)
 
 /* both Tx and Rx */
+#define  FDI_COMPOSITE_SYNC		(1<<11)
 #define  FDI_LINK_TRAIN_AUTO		(1<<10)
 #define  FDI_SCRAMBLING_ENABLE          (0<<7)
 #define  FDI_SCRAMBLING_DISABLE         (1<<7)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 7e5f309..7835245 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2617,6 +2617,7 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
 	temp |= FDI_LINK_TRAIN_PATTERN_1_IVB;
 	temp &= ~FDI_LINK_TRAIN_VOL_EMP_MASK;
 	temp |= FDI_LINK_TRAIN_400MV_0DB_SNB_B;
+	temp |= FDI_COMPOSITE_SYNC;
 	I915_WRITE(reg, temp | FDI_TX_ENABLE);
 
 	reg = FDI_RX_CTL(pipe);
@@ -2624,6 +2625,7 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc)
 	temp &= ~FDI_LINK_TRAIN_AUTO;
 	temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT;
 	temp |= FDI_LINK_TRAIN_PATTERN_1_CPT;
+	temp |= FDI_COMPOSITE_SYNC;
 	I915_WRITE(reg, temp | FDI_RX_ENABLE);
 
 	POSTING_READ(reg);
-- 
1.7.4.1

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

* [PATCH 07/14] drm/i915: add PLL sharing support to handle 3 pipes
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (5 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 06/14] drm/i915: always set FDI composite sync bit Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-21  6:18   ` Keith Packard
  2011-10-19 15:12 ` [PATCH 08/14] drm/i915: fix debug output for 3 pipe configs Jesse Barnes
                   ` (7 subsequent siblings)
  14 siblings, 1 reply; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

Add two new fields to the intel_crtc struct for 3 pipe support: no_pll
and use_pll_a.  The no_pll field is only set on the 3rd pipe to indicate
that it doesn't have a PLL of its own and so shouldn't try to write the
main PLL regs.  The use_pll_a field controls which PLL pipe 3 will
share, A or B.  The core code will try to share PLLs with whichever pipe
has the same timings, rejecting the mode set if none is found.  This
means that pipe 3 must always be set after one of the other pipes has
been configured with real PLL settings.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c |   87 +++++++++++++++++++++-------------
 drivers/gpu/drm/i915/intel_drv.h     |    3 +
 2 files changed, 57 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 7835245..347a949 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2885,7 +2885,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
 	int pipe = intel_crtc->pipe;
-	u32 reg, temp;
+	u32 reg, temp, transc_sel;
 
 	/* For PCH output, training FDI link */
 	dev_priv->display.fdi_link_train(crtc);
@@ -2893,6 +2893,9 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 	intel_enable_pch_pll(dev_priv, pipe);
 
 	if (HAS_PCH_CPT(dev)) {
+		transc_sel = intel_crtc->use_pll_a ? TRANSC_DPLLA_SEL :
+			TRANSC_DPLLB_SEL;
+
 		/* Be sure PCH DPLL SEL is set */
 		temp = I915_READ(PCH_DPLL_SEL);
 		if (pipe == 0 && (temp & TRANSA_DPLL_ENABLE) == 0)
@@ -2900,7 +2903,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 		else if (pipe == 1 && (temp & TRANSB_DPLL_ENABLE) == 0)
 			temp |= (TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL);
 		else if (pipe == 2 && (temp & TRANSC_DPLL_ENABLE) == 0)
-			temp |= (TRANSC_DPLL_ENABLE | TRANSC_DPLLB_SEL);
+			temp |= (TRANSC_DPLL_ENABLE | transc_sel);
 		I915_WRITE(PCH_DPLL_SEL, temp);
 	}
 
@@ -3072,8 +3075,8 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
 			temp &= ~(TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL);
 			break;
 		case 2:
-			/* FIXME: manage transcoder PLLs? */
-			temp &= ~(TRANSC_DPLL_ENABLE | TRANSC_DPLLB_SEL);
+			/* C shares PLL A or B */
+			temp &= ~(TRANSC_DPLL_ENABLE | TRANSB_DPLLB_SEL);
 			break;
 		default:
 			BUG(); /* wtf */
@@ -3082,7 +3085,8 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
 	}
 
 	/* disable PCH DPLL */
-	intel_disable_pch_pll(dev_priv, pipe);
+	if (!intel_crtc->no_pll)
+		intel_disable_pch_pll(dev_priv, pipe);
 
 	/* Switch from PCDclk to Rawclk */
 	reg = FDI_RX_CTL(pipe);
@@ -5500,16 +5504,33 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 	drm_mode_debug_printmodeline(mode);
 
 	/* PCH eDP needs FDI, but CPU eDP does not */
-	if (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
+	if (!intel_crtc->no_pll &&
+	    (!has_edp_encoder ||
+	     intel_encoder_is_pch_edp(&has_edp_encoder->base))) {
 		I915_WRITE(PCH_FP0(pipe), fp);
 		I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
 
 		POSTING_READ(PCH_DPLL(pipe));
 		udelay(150);
+	} else {
+		if (dpll == (I915_READ(PCH_DPLL(0)) & 0x7fffffff) &&
+		    fp == I915_READ(PCH_FP0(0))) {
+			intel_crtc->use_pll_a = true;
+			DRM_DEBUG_KMS("using pipe a dpll\n");
+		} else if (dpll == (I915_READ(PCH_DPLL(1)) & 0x7fffffff) &&
+			   fp == I915_READ(PCH_FP0(1))) {
+			intel_crtc->use_pll_a = false;
+			DRM_DEBUG_KMS("using pipe b dpll\n");
+		} else {
+			DRM_DEBUG_KMS("no matching PLL configuration for pipe 2\n");
+			return -EINVAL;
+		}
 	}
 
 	/* enable transcoder DPLL */
 	if (HAS_PCH_CPT(dev)) {
+		u32 transc_sel = intel_crtc->use_pll_a ? TRANSC_DPLLA_SEL :
+			TRANSC_DPLLB_SEL;
 		temp = I915_READ(PCH_DPLL_SEL);
 		switch (pipe) {
 		case 0:
@@ -5519,8 +5540,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 			temp |=	TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL;
 			break;
 		case 2:
-			/* FIXME: manage transcoder PLLs? */
-			temp |= TRANSC_DPLL_ENABLE | TRANSC_DPLLB_SEL;
+			temp |= TRANSC_DPLL_ENABLE | transc_sel;
 			break;
 		default:
 			BUG();
@@ -5538,17 +5558,13 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 	if (is_lvds) {
 		temp = I915_READ(PCH_LVDS);
 		temp |= LVDS_PORT_EN | LVDS_A0A2_CLKA_POWER_UP;
-		if (pipe == 1) {
-			if (HAS_PCH_CPT(dev))
-				temp |= PORT_TRANS_B_SEL_CPT;
-			else
-				temp |= LVDS_PIPEB_SELECT;
-		} else {
-			if (HAS_PCH_CPT(dev))
-				temp &= ~PORT_TRANS_SEL_MASK;
-			else
-				temp &= ~LVDS_PIPEB_SELECT;
-		}
+		if (HAS_PCH_CPT(dev))
+			temp |= PORT_TRANS_SEL_CPT(pipe);
+		else if (pipe == 1)
+			temp |= LVDS_PIPEB_SELECT;
+		else
+			temp &= ~LVDS_PIPEB_SELECT;
+
 		/* set the corresponsding LVDS_BORDER bit */
 		temp |= dev_priv->lvds_border_bits;
 		/* Set the B0-B3 data pairs corresponding to whether we're going to
@@ -5598,8 +5614,9 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 		I915_WRITE(TRANSDPLINK_N1(pipe), 0);
 	}
 
-	if (!has_edp_encoder ||
-	    intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
+	if (!intel_crtc->no_pll &&
+	    (!has_edp_encoder ||
+	     intel_encoder_is_pch_edp(&has_edp_encoder->base))) {
 		I915_WRITE(PCH_DPLL(pipe), dpll);
 
 		/* Wait for the clocks to stabilize. */
@@ -5615,18 +5632,20 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 	}
 
 	intel_crtc->lowfreq_avail = false;
-	if (is_lvds && has_reduced_clock && i915_powersave) {
-		I915_WRITE(PCH_FP1(pipe), fp2);
-		intel_crtc->lowfreq_avail = true;
-		if (HAS_PIPE_CXSR(dev)) {
-			DRM_DEBUG_KMS("enabling CxSR downclocking\n");
-			pipeconf |= PIPECONF_CXSR_DOWNCLOCK;
-		}
-	} else {
-		I915_WRITE(PCH_FP1(pipe), fp);
-		if (HAS_PIPE_CXSR(dev)) {
-			DRM_DEBUG_KMS("disabling CxSR downclocking\n");
-			pipeconf &= ~PIPECONF_CXSR_DOWNCLOCK;
+	if (!intel_crtc->no_pll) {
+		if (is_lvds && has_reduced_clock && i915_powersave) {
+			I915_WRITE(PCH_FP1(pipe), fp2);
+			intel_crtc->lowfreq_avail = true;
+			if (HAS_PIPE_CXSR(dev)) {
+				DRM_DEBUG_KMS("enabling CxSR downclocking\n");
+				pipeconf |= PIPECONF_CXSR_DOWNCLOCK;
+			}
+		} else {
+			I915_WRITE(PCH_FP1(pipe), fp);
+			if (HAS_PIPE_CXSR(dev)) {
+				DRM_DEBUG_KMS("disabling CxSR downclocking\n");
+				pipeconf &= ~PIPECONF_CXSR_DOWNCLOCK;
+			}
 		}
 	}
 
@@ -7242,6 +7261,8 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
 	intel_crtc->bpp = 24; /* default for pre-Ironlake */
 
 	if (HAS_PCH_SPLIT(dev)) {
+		if (pipe == 2 && IS_IVYBRIDGE(dev))
+			intel_crtc->no_pll = true;
 		intel_helper_funcs.prepare = ironlake_crtc_prepare;
 		intel_helper_funcs.commit = ironlake_crtc_commit;
 	} else {
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index b7e7186..8da74d2 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -171,6 +171,9 @@ struct intel_crtc {
 	int16_t cursor_width, cursor_height;
 	bool cursor_visible;
 	unsigned int bpp;
+
+	bool no_pll; /* tertiary pipe for IVB */
+	bool use_pll_a;
 };
 
 #define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
-- 
1.7.4.1

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

* [PATCH 08/14] drm/i915: fix debug output for 3 pipe configs
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (6 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 07/14] drm/i915: add PLL sharing support to handle 3 pipes Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 09/14] drm/i915: fix IVB cursor support Jesse Barnes
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

We can have more than just A and B these days.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 347a949..0e556e7 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5500,7 +5500,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 	/* Set up the display plane register */
 	dspcntr = DISPPLANE_GAMMA_ENABLE;
 
-	DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe == 0 ? 'A' : 'B');
+	DRM_DEBUG_KMS("Mode for pipe %d:\n", pipe);
 	drm_mode_debug_printmodeline(mode);
 
 	/* PCH eDP needs FDI, but CPU eDP does not */
-- 
1.7.4.1

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

* [PATCH 09/14] drm/i915: fix IVB cursor support
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (7 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 08/14] drm/i915: fix debug output for 3 pipe configs Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 10/14] drm/i915: fix transcoder PLL select masking Jesse Barnes
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

The cursor regs have moved around, add the offsets and new macros for
getting at them.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_reg.h      |    8 ++++++
 drivers/gpu/drm/i915/intel_display.c |   40 +++++++++++++++++++++++++++++----
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index a79f435..f3ba37d 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2567,10 +2567,18 @@
 #define _CURBBASE		0x700c4
 #define _CURBPOS			0x700c8
 
+#define _CURBCNTR_IVB		0x71080
+#define _CURBBASE_IVB		0x71084
+#define _CURBPOS_IVB		0x71088
+
 #define CURCNTR(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR)
 #define CURBASE(pipe) _PIPE(pipe, _CURABASE, _CURBBASE)
 #define CURPOS(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS)
 
+#define CURCNTR_IVB(pipe) _PIPE(pipe, _CURACNTR, _CURBCNTR_IVB)
+#define CURBASE_IVB(pipe) _PIPE(pipe, _CURABASE, _CURBBASE_IVB)
+#define CURPOS_IVB(pipe) _PIPE(pipe, _CURAPOS, _CURBPOS_IVB)
+
 /* Display A control */
 #define _DSPACNTR                0x70180
 #define   DISPLAY_PLANE_ENABLE			(1<<31)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 0e556e7..91f0855 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5948,6 +5948,31 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
 	I915_WRITE(CURBASE(pipe), base);
 }
 
+static void ivb_update_cursor(struct drm_crtc *crtc, u32 base)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+	int pipe = intel_crtc->pipe;
+	bool visible = base != 0;
+
+	if (intel_crtc->cursor_visible != visible) {
+		uint32_t cntl = I915_READ(CURCNTR_IVB(pipe));
+		if (base) {
+			cntl &= ~CURSOR_MODE;
+			cntl |= CURSOR_MODE_64_ARGB_AX | MCURSOR_GAMMA_ENABLE;
+		} else {
+			cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE);
+			cntl |= CURSOR_MODE_DISABLE;
+		}
+		I915_WRITE(CURCNTR_IVB(pipe), cntl);
+
+		intel_crtc->cursor_visible = visible;
+	}
+	/* and commit changes on next vblank */
+	I915_WRITE(CURBASE_IVB(pipe), base);
+}
+
 /* If no-part of the cursor is visible on the framebuffer, then the GPU may hang... */
 static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 				     bool on)
@@ -5995,11 +6020,16 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
 	if (!visible && !intel_crtc->cursor_visible)
 		return;
 
-	I915_WRITE(CURPOS(pipe), pos);
-	if (IS_845G(dev) || IS_I865G(dev))
-		i845_update_cursor(crtc, base);
-	else
-		i9xx_update_cursor(crtc, base);
+	if (IS_IVYBRIDGE(dev)) {
+		I915_WRITE(CURPOS_IVB(pipe), pos);
+		ivb_update_cursor(crtc, base);
+	} else {
+		I915_WRITE(CURPOS(pipe), pos);
+		if (IS_845G(dev) || IS_I865G(dev))
+			i845_update_cursor(crtc, base);
+		else
+			i9xx_update_cursor(crtc, base);
+	}
 
 	if (visible)
 		intel_mark_busy(dev, to_intel_framebuffer(crtc->fb)->obj);
-- 
1.7.4.1

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

* [PATCH 10/14] drm/i915: fix transcoder PLL select masking
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (8 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 09/14] drm/i915: fix IVB cursor support Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 11/14] drm/i915: export a CPT mode set verification function Jesse Barnes
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

Transcoder A will always use PLL A and transcoder B will use PLL B.  But
transcoder C could use either, so always mask the select bits off before
or'ing in a new value.

Reported-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 91f0855..7a4d51d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2898,12 +2898,16 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 
 		/* Be sure PCH DPLL SEL is set */
 		temp = I915_READ(PCH_DPLL_SEL);
-		if (pipe == 0 && (temp & TRANSA_DPLL_ENABLE) == 0)
+		if (pipe == 0) {
+			temp &= ~(TRANSA_DPLLB_SEL);
 			temp |= (TRANSA_DPLL_ENABLE | TRANSA_DPLLA_SEL);
-		else if (pipe == 1 && (temp & TRANSB_DPLL_ENABLE) == 0)
+		} else if (pipe == 1) {
+			temp &= ~(TRANSB_DPLLB_SEL);
 			temp |= (TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL);
-		else if (pipe == 2 && (temp & TRANSC_DPLL_ENABLE) == 0)
+		} else if (pipe == 2) {
+			temp &= ~(TRANSC_DPLLB_SEL);
 			temp |= (TRANSC_DPLL_ENABLE | transc_sel);
+		}
 		I915_WRITE(PCH_DPLL_SEL, temp);
 	}
 
@@ -3069,14 +3073,14 @@ static void ironlake_crtc_disable(struct drm_crtc *crtc)
 		temp = I915_READ(PCH_DPLL_SEL);
 		switch (pipe) {
 		case 0:
-			temp &= ~(TRANSA_DPLL_ENABLE | TRANSA_DPLLA_SEL);
+			temp &= ~(TRANSA_DPLL_ENABLE | TRANSA_DPLLB_SEL);
 			break;
 		case 1:
 			temp &= ~(TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL);
 			break;
 		case 2:
 			/* C shares PLL A or B */
-			temp &= ~(TRANSC_DPLL_ENABLE | TRANSB_DPLLB_SEL);
+			temp &= ~(TRANSC_DPLL_ENABLE | TRANSC_DPLLB_SEL);
 			break;
 		default:
 			BUG(); /* wtf */
@@ -5540,6 +5544,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 			temp |=	TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL;
 			break;
 		case 2:
+			temp &= ~(TRANSC_DPLLB_SEL);
 			temp |= TRANSC_DPLL_ENABLE | transc_sel;
 			break;
 		default:
-- 
1.7.4.1

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

* [PATCH 11/14] drm/i915: export a CPT mode set verification function
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (9 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 10/14] drm/i915: fix transcoder PLL select masking Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 12/14] drm/i915: set watermarks for third pipe on IVB Jesse Barnes
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

At the point where we check, we can't do much about the failure, but it
can aid debugging.  Note that the auto-train override bit will be reset
as part of normal mode setting with this patch if a pipe ever does get
stuck, but that's consistent with the workaround for CPT provided by the
hardware team.  This patch helped catch the fact that the pipe wasn't
running in the !composite sync FDI case on my IVB SDV, so has already
shown to be useful.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c |   25 +++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_dp.c      |    4 ++++
 drivers/gpu/drm/i915/intel_drv.h     |    2 ++
 3 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 7a4d51d..4e98de0 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2963,6 +2963,24 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 	intel_enable_transcoder(dev_priv, pipe);
 }
 
+void intel_cpt_verify_modeset(struct drm_device *dev, int pipe)
+{
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	int dslreg = PIPEDSL(pipe), tc2reg = TRANS_CHICKEN2(pipe);
+	u32 temp;
+
+	temp = I915_READ(dslreg);
+	udelay(500);
+	if (wait_for(I915_READ(dslreg) != temp, 5)) {
+		/* Without this, mode sets may fail silently on FDI */
+		I915_WRITE(tc2reg, TRANS_AUTOTRAIN_GEN_STALL_DIS);
+		udelay(250);
+		I915_WRITE(tc2reg, 0);
+		if (wait_for(I915_READ(dslreg) != temp, 5))
+			DRM_ERROR("mode set failed: pipe %d stuck\n", pipe);
+	}
+}
+
 static void ironlake_crtc_enable(struct drm_crtc *crtc)
 {
 	struct drm_device *dev = crtc->dev;
@@ -3332,8 +3350,15 @@ void intel_encoder_prepare(struct drm_encoder *encoder)
 void intel_encoder_commit(struct drm_encoder *encoder)
 {
 	struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
+	struct drm_device *dev = encoder->dev;
+	struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
+	struct intel_crtc *intel_crtc = to_intel_crtc(intel_encoder->base.crtc);
+
 	/* lvds has its own version of commit see intel_lvds_commit */
 	encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON);
+
+	if (HAS_PCH_CPT(dev))
+		intel_cpt_verify_modeset(dev, intel_crtc->pipe);
 }
 
 void intel_encoder_destroy(struct drm_encoder *encoder)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index f4b873b..4bb1c75 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1010,6 +1010,7 @@ static void intel_dp_commit(struct drm_encoder *encoder)
 {
 	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 	struct drm_device *dev = encoder->dev;
+	struct intel_crtc *intel_crtc = to_intel_crtc(intel_dp->base.base.crtc);
 
 	if (is_edp(intel_dp))
 		ironlake_edp_panel_vdd_on(intel_dp);
@@ -1027,6 +1028,9 @@ static void intel_dp_commit(struct drm_encoder *encoder)
 		ironlake_edp_backlight_on(dev);
 
 	intel_dp->dpms_mode = DRM_MODE_DPMS_ON;
+
+	if (HAS_PCH_CPT(dev))
+		intel_cpt_verify_modeset(dev, intel_crtc->pipe);
 }
 
 static void
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 8da74d2..7994409 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -385,4 +385,6 @@ extern void intel_fb_restore_mode(struct drm_device *dev);
 extern void intel_init_clock_gating(struct drm_device *dev);
 extern void intel_write_eld(struct drm_encoder *encoder,
 			    struct drm_display_mode *mode);
+extern void intel_cpt_verify_modeset(struct drm_device *dev, int pipe);
+
 #endif /* __INTEL_DRV_H__ */
-- 
1.7.4.1

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

* [PATCH 12/14] drm/i915: set watermarks for third pipe on IVB
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (10 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 11/14] drm/i915: export a CPT mode set verification function Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 13/14] drm/i915: if transcoder disable fails, say which Jesse Barnes
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

The watermark reg for the third pipe is in an unusual offset; add
support for it and set watermarks for 3 pipe configs.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/i915_reg.h      |    1 +
 drivers/gpu/drm/i915/intel_display.c |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index f3ba37d..f086bdf 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2429,6 +2429,7 @@
 #define  WM0_PIPE_CURSOR_MASK	(0x1f)
 
 #define WM0_PIPEB_ILK		0x45104
+#define WM0_PIPEC_IVB		0x45200
 #define WM1_LP_ILK		0x45108
 #define  WM1_LP_SR_EN		(1<<31)
 #define  WM1_LP_LATENCY_SHIFT	24
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 4e98de0..2c30e36 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4532,6 +4532,20 @@ static void sandybridge_update_wm(struct drm_device *dev)
 		enabled |= 2;
 	}
 
+	/* IVB has 3 pipes */
+	if (IS_IVYBRIDGE(dev) &&
+	    g4x_compute_wm0(dev, 2,
+			    &sandybridge_display_wm_info, latency,
+			    &sandybridge_cursor_wm_info, latency,
+			    &plane_wm, &cursor_wm)) {
+		I915_WRITE(WM0_PIPEC_IVB,
+			   (plane_wm << WM0_PIPE_PLANE_SHIFT) | cursor_wm);
+		DRM_DEBUG_KMS("FIFO watermarks For pipe C -"
+			      " plane %d, cursor: %d\n",
+			      plane_wm, cursor_wm);
+		enabled |= 3;
+	}
+
 	/*
 	 * Calculate and update the self-refresh watermark only when one
 	 * display plane is used.
-- 
1.7.4.1

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

* [PATCH 13/14] drm/i915: if transcoder disable fails, say which
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (11 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 12/14] drm/i915: set watermarks for third pipe on IVB Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 15:12 ` [PATCH 14/14] drm/i915: remove transcoder PLL mashing from mode_set per specs Jesse Barnes
  2011-10-19 20:36 ` IVB fixes and 3 pipe support Eugeni Dodonov
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

Just some extra debug output.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 2c30e36..c95ac7f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1276,7 +1276,7 @@ static void intel_disable_transcoder(struct drm_i915_private *dev_priv,
 	I915_WRITE(reg, val);
 	/* wait for PCH transcoder off, transcoder state */
 	if (wait_for((I915_READ(reg) & TRANS_STATE_ENABLE) == 0, 50))
-		DRM_ERROR("failed to disable transcoder\n");
+		DRM_ERROR("failed to disable transcoder %d\n", pipe);
 }
 
 /**
-- 
1.7.4.1

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

* [PATCH 14/14] drm/i915: remove transcoder PLL mashing from mode_set per specs
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (12 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 13/14] drm/i915: if transcoder disable fails, say which Jesse Barnes
@ 2011-10-19 15:12 ` Jesse Barnes
  2011-10-19 20:36 ` IVB fixes and 3 pipe support Eugeni Dodonov
  14 siblings, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-19 15:12 UTC (permalink / raw)
  To: intel-gfx

Belongs in PCH enable instead.  The duplication is worrying and the
specs explicitly list transcoder select *after* actual PLL enable, which
doesn't occur until later.

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_display.c |   25 -------------------------
 1 files changed, 0 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c95ac7f..87a92a1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5570,31 +5570,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 		}
 	}
 
-	/* enable transcoder DPLL */
-	if (HAS_PCH_CPT(dev)) {
-		u32 transc_sel = intel_crtc->use_pll_a ? TRANSC_DPLLA_SEL :
-			TRANSC_DPLLB_SEL;
-		temp = I915_READ(PCH_DPLL_SEL);
-		switch (pipe) {
-		case 0:
-			temp |= TRANSA_DPLL_ENABLE | TRANSA_DPLLA_SEL;
-			break;
-		case 1:
-			temp |=	TRANSB_DPLL_ENABLE | TRANSB_DPLLB_SEL;
-			break;
-		case 2:
-			temp &= ~(TRANSC_DPLLB_SEL);
-			temp |= TRANSC_DPLL_ENABLE | transc_sel;
-			break;
-		default:
-			BUG();
-		}
-		I915_WRITE(PCH_DPLL_SEL, temp);
-
-		POSTING_READ(PCH_DPLL_SEL);
-		udelay(150);
-	}
-
 	/* The LVDS pin pair needs to be on before the DPLLs are enabled.
 	 * This is an exception to the general rule that mode_set doesn't turn
 	 * things on.
-- 
1.7.4.1

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

* Re: IVB fixes and 3 pipe support
  2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
                   ` (13 preceding siblings ...)
  2011-10-19 15:12 ` [PATCH 14/14] drm/i915: remove transcoder PLL mashing from mode_set per specs Jesse Barnes
@ 2011-10-19 20:36 ` Eugeni Dodonov
  14 siblings, 0 replies; 20+ messages in thread
From: Eugeni Dodonov @ 2011-10-19 20:36 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 1240 bytes --]

On Wed, Oct 19, 2011 at 13:12, Jesse Barnes <jbarnes@virtuousgeek.org>wrote:

> Latest patches; Eugeni can you reply with your tested-by?  I think
> they're all ready for upstream.
>

For the series:

Tested-By: Eugeni Dodonov <eugeni.dodonov@intel.com>
Reviewed-By: Eugeni Dodonov <eugeni.dodonov@intel.com>

There three reproducible issues I found out, but they were present with
previous patch set as well, and are not critical in my opinion at this
point:
 - when I boot with 3 monitors plugged in, the DE (in my case, xfce) waits
forever on login. When I go to console and then back to X, it proceeds. It
seems to be https://bugs.freedesktop.org/show_bug.cgi?id=41917.
 - after some switching between console and X, I can reproduce
https://bugs.freedesktop.org/show_bug.cgi?id=41976 - sometimes with just one
of the pipes, sometimes with both of them.
 - when starting fullscreen 3d app (I tested with openarena and nexuiz), all
3 pipes lose signal. When I go to console, kill the processes, and go back
to X, it is back into working state (
https://bugs.freedesktop.org/show_bug.cgi?id=42010).

But those can be dealt with later, I think that what we have now is good for
upstreaming.

-- 
Eugeni Dodonov
<http://eugeni.dodonov.net/>

[-- Attachment #1.2: Type: text/html, Size: 1934 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

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

* Re: [PATCH 07/14] drm/i915: add PLL sharing support to handle 3 pipes
  2011-10-19 15:12 ` [PATCH 07/14] drm/i915: add PLL sharing support to handle 3 pipes Jesse Barnes
@ 2011-10-21  6:18   ` Keith Packard
  2011-10-21 14:02     ` Jesse Barnes
  2011-10-21 19:00     ` Jesse Barnes
  0 siblings, 2 replies; 20+ messages in thread
From: Keith Packard @ 2011-10-21  6:18 UTC (permalink / raw)
  To: Jesse Barnes, intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 2196 bytes --]

On Wed, 19 Oct 2011 08:12:08 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:

>  	/* PCH eDP needs FDI, but CPU eDP does not */
> -	if (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
> +	if (!intel_crtc->no_pll &&
> +	    (!has_edp_encoder ||
> +	     intel_encoder_is_pch_edp(&has_edp_encoder->base))) {
>  		I915_WRITE(PCH_FP0(pipe), fp);
>  		I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
>  
>  		POSTING_READ(PCH_DPLL(pipe));
>  		udelay(150);
> +	} else {
> +		if (dpll == (I915_READ(PCH_DPLL(0)) & 0x7fffffff) &&
> +		    fp == I915_READ(PCH_FP0(0))) {
> +			intel_crtc->use_pll_a = true;
> +			DRM_DEBUG_KMS("using pipe a dpll\n");
> +		} else if (dpll == (I915_READ(PCH_DPLL(1)) & 0x7fffffff) &&
> +			   fp == I915_READ(PCH_FP0(1))) {
> +			intel_crtc->use_pll_a = false;
> +			DRM_DEBUG_KMS("using pipe b dpll\n");
> +		} else {
> +			DRM_DEBUG_KMS("no matching PLL configuration for pipe 2\n");
> +			return -EINVAL;
> +		}

This hunk breaks eDP nicely -- you end up in the 'else' clause still
looking for a DPLL to use.

Here's my suggested replacement:

 	/* PCH eDP needs FDI, but CPU eDP does not */
-	if (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
-		I915_WRITE(PCH_FP0(pipe), fp);
-		I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
-
-		POSTING_READ(PCH_DPLL(pipe));
-		udelay(150);
+	if (!intel_crtc->no_pll) {
+		if (!has_edp_encoder ||
+		    intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
+			I915_WRITE(PCH_FP0(pipe), fp);
+			I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
+
+			POSTING_READ(PCH_DPLL(pipe));
+			udelay(150);
+		}
+	} else {
+		if (dpll == (I915_READ(PCH_DPLL(0)) & 0x7fffffff) &&
+		    fp == I915_READ(PCH_FP0(0))) {
+			intel_crtc->use_pll_a = true;
+			DRM_DEBUG_KMS("using pipe a dpll\n");
+		} else if (dpll == (I915_READ(PCH_DPLL(1)) & 0x7fffffff) &&
+			   fp == I915_READ(PCH_FP0(1))) {
+			intel_crtc->use_pll_a = false;
+			DRM_DEBUG_KMS("using pipe b dpll\n");
+		} else {
+			DRM_DEBUG_KMS("no matching PLL configuration for pipe 2\n");
+			return -EINVAL;
+		}
 	}

-- 
keith.packard@intel.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

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

* Re: [PATCH 07/14] drm/i915: add PLL sharing support to handle 3 pipes
  2011-10-21  6:18   ` Keith Packard
@ 2011-10-21 14:02     ` Jesse Barnes
  2011-10-21 19:00     ` Jesse Barnes
  1 sibling, 0 replies; 20+ messages in thread
From: Jesse Barnes @ 2011-10-21 14:02 UTC (permalink / raw)
  To: Keith Packard; +Cc: intel-gfx

On Thu, 20 Oct 2011 23:18:06 -0700
Keith Packard <keithp@keithp.com> wrote:

> On Wed, 19 Oct 2011 08:12:08 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> 
> >  	/* PCH eDP needs FDI, but CPU eDP does not */
> > -	if (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
> > +	if (!intel_crtc->no_pll &&
> > +	    (!has_edp_encoder ||
> > +	     intel_encoder_is_pch_edp(&has_edp_encoder->base))) {
> >  		I915_WRITE(PCH_FP0(pipe), fp);
> >  		I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
> >  
> >  		POSTING_READ(PCH_DPLL(pipe));
> >  		udelay(150);
> > +	} else {
> > +		if (dpll == (I915_READ(PCH_DPLL(0)) & 0x7fffffff) &&
> > +		    fp == I915_READ(PCH_FP0(0))) {
> > +			intel_crtc->use_pll_a = true;
> > +			DRM_DEBUG_KMS("using pipe a dpll\n");
> > +		} else if (dpll == (I915_READ(PCH_DPLL(1)) & 0x7fffffff) &&
> > +			   fp == I915_READ(PCH_FP0(1))) {
> > +			intel_crtc->use_pll_a = false;
> > +			DRM_DEBUG_KMS("using pipe b dpll\n");
> > +		} else {
> > +			DRM_DEBUG_KMS("no matching PLL configuration for pipe 2\n");
> > +			return -EINVAL;
> > +		}
> 
> This hunk breaks eDP nicely -- you end up in the 'else' clause still
> looking for a DPLL to use.
> 
> Here's my suggested replacement:
> 
>  	/* PCH eDP needs FDI, but CPU eDP does not */
> -	if (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
> -		I915_WRITE(PCH_FP0(pipe), fp);
> -		I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
> -
> -		POSTING_READ(PCH_DPLL(pipe));
> -		udelay(150);
> +	if (!intel_crtc->no_pll) {
> +		if (!has_edp_encoder ||
> +		    intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
> +			I915_WRITE(PCH_FP0(pipe), fp);
> +			I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
> +
> +			POSTING_READ(PCH_DPLL(pipe));
> +			udelay(150);
> +		}
> +	} else {
> +		if (dpll == (I915_READ(PCH_DPLL(0)) & 0x7fffffff) &&
> +		    fp == I915_READ(PCH_FP0(0))) {
> +			intel_crtc->use_pll_a = true;
> +			DRM_DEBUG_KMS("using pipe a dpll\n");
> +		} else if (dpll == (I915_READ(PCH_DPLL(1)) & 0x7fffffff) &&
> +			   fp == I915_READ(PCH_FP0(1))) {
> +			intel_crtc->use_pll_a = false;
> +			DRM_DEBUG_KMS("using pipe b dpll\n");
> +		} else {
> +			DRM_DEBUG_KMS("no matching PLL configuration for pipe 2\n");
> +			return -EINVAL;
> +		}
>  	}

Ah of course.  Looks like your patch should work; I'll test on my CPU
eDP system to confirm.

-- 
Jesse Barnes, Intel Open Source Technology Center

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

* Re: [PATCH 07/14] drm/i915: add PLL sharing support to handle 3 pipes
  2011-10-21  6:18   ` Keith Packard
  2011-10-21 14:02     ` Jesse Barnes
@ 2011-10-21 19:00     ` Jesse Barnes
  2011-10-21 20:09       ` Keith Packard
  1 sibling, 1 reply; 20+ messages in thread
From: Jesse Barnes @ 2011-10-21 19:00 UTC (permalink / raw)
  To: Keith Packard; +Cc: intel-gfx

On Thu, 20 Oct 2011 23:18:06 -0700
Keith Packard <keithp@keithp.com> wrote:

> On Wed, 19 Oct 2011 08:12:08 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:
> 
> >  	/* PCH eDP needs FDI, but CPU eDP does not */
> > -	if (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
> > +	if (!intel_crtc->no_pll &&
> > +	    (!has_edp_encoder ||
> > +	     intel_encoder_is_pch_edp(&has_edp_encoder->base))) {
> >  		I915_WRITE(PCH_FP0(pipe), fp);
> >  		I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
> >  
> >  		POSTING_READ(PCH_DPLL(pipe));
> >  		udelay(150);
> > +	} else {
> > +		if (dpll == (I915_READ(PCH_DPLL(0)) & 0x7fffffff) &&
> > +		    fp == I915_READ(PCH_FP0(0))) {
> > +			intel_crtc->use_pll_a = true;
> > +			DRM_DEBUG_KMS("using pipe a dpll\n");
> > +		} else if (dpll == (I915_READ(PCH_DPLL(1)) & 0x7fffffff) &&
> > +			   fp == I915_READ(PCH_FP0(1))) {
> > +			intel_crtc->use_pll_a = false;
> > +			DRM_DEBUG_KMS("using pipe b dpll\n");
> > +		} else {
> > +			DRM_DEBUG_KMS("no matching PLL configuration for pipe 2\n");
> > +			return -EINVAL;
> > +		}
> 
> This hunk breaks eDP nicely -- you end up in the 'else' clause still
> looking for a DPLL to use.
> 
> Here's my suggested replacement:
> 
>  	/* PCH eDP needs FDI, but CPU eDP does not */
> -	if (!has_edp_encoder || intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
> -		I915_WRITE(PCH_FP0(pipe), fp);
> -		I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
> -
> -		POSTING_READ(PCH_DPLL(pipe));
> -		udelay(150);
> +	if (!intel_crtc->no_pll) {
> +		if (!has_edp_encoder ||
> +		    intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
> +			I915_WRITE(PCH_FP0(pipe), fp);
> +			I915_WRITE(PCH_DPLL(pipe), dpll & ~DPLL_VCO_ENABLE);
> +
> +			POSTING_READ(PCH_DPLL(pipe));
> +			udelay(150);
> +		}
> +	} else {
> +		if (dpll == (I915_READ(PCH_DPLL(0)) & 0x7fffffff) &&
> +		    fp == I915_READ(PCH_FP0(0))) {
> +			intel_crtc->use_pll_a = true;
> +			DRM_DEBUG_KMS("using pipe a dpll\n");
> +		} else if (dpll == (I915_READ(PCH_DPLL(1)) & 0x7fffffff) &&
> +			   fp == I915_READ(PCH_FP0(1))) {
> +			intel_crtc->use_pll_a = false;
> +			DRM_DEBUG_KMS("using pipe b dpll\n");
> +		} else {
> +			DRM_DEBUG_KMS("no matching PLL configuration for pipe 2\n");
> +			return -EINVAL;
> +		}
>  	}
> 

Yeah works much better with this applied.  Makes me want to change the
PLL sharing code a bit though; this should be factored out into a
separate function and I should probably just add a tiny PLL allocator
for the pipes.  That would make some of the code a little cleaner I
think, though add a bit more configuration complexity...

Tested-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center

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

* Re: [PATCH 07/14] drm/i915: add PLL sharing support to handle 3 pipes
  2011-10-21 19:00     ` Jesse Barnes
@ 2011-10-21 20:09       ` Keith Packard
  0 siblings, 0 replies; 20+ messages in thread
From: Keith Packard @ 2011-10-21 20:09 UTC (permalink / raw)
  To: Jesse Barnes; +Cc: intel-gfx


[-- Attachment #1.1: Type: text/plain, Size: 622 bytes --]

On Fri, 21 Oct 2011 12:00:26 -0700, Jesse Barnes <jbarnes@virtuousgeek.org> wrote:

> Yeah works much better with this applied.  Makes me want to change the
> PLL sharing code a bit though; this should be factored out into a
> separate function and I should probably just add a tiny PLL allocator
> for the pipes.

That would allow sharing of PLLs between any two pipes? Seems like a
nicer plan.

> Tested-by: Jesse Barnes <jbarnes@virtuousgeek.org>
> Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>

I just smashed your original patch so that bisect would work across
it.

-- 
keith.packard@intel.com

[-- Attachment #1.2: Type: application/pgp-signature, Size: 827 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

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

end of thread, other threads:[~2011-10-21 20:09 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-19 15:12 IVB fixes and 3 pipe support Jesse Barnes
2011-10-19 15:12 ` [PATCH 01/14] drm/i915: PLL macro cleanup and pipe assertion check Jesse Barnes
2011-10-19 15:12 ` [PATCH 02/14] drm/i915: support 3 pipes on IVB+ Jesse Barnes
2011-10-19 15:12 ` [PATCH 03/14] drm/i915: split refclk code out of ironlake_crtc_mode_set Jesse Barnes
2011-10-19 15:12 ` [PATCH 04/14] drm/i915: use transcoder select bits on VGA and HDMI on CPT Jesse Barnes
2011-10-19 15:12 ` [PATCH 05/14] drm/i915: fix PCH PLL assertion check for 3 pipes Jesse Barnes
2011-10-19 15:12 ` [PATCH 06/14] drm/i915: always set FDI composite sync bit Jesse Barnes
2011-10-19 15:12 ` [PATCH 07/14] drm/i915: add PLL sharing support to handle 3 pipes Jesse Barnes
2011-10-21  6:18   ` Keith Packard
2011-10-21 14:02     ` Jesse Barnes
2011-10-21 19:00     ` Jesse Barnes
2011-10-21 20:09       ` Keith Packard
2011-10-19 15:12 ` [PATCH 08/14] drm/i915: fix debug output for 3 pipe configs Jesse Barnes
2011-10-19 15:12 ` [PATCH 09/14] drm/i915: fix IVB cursor support Jesse Barnes
2011-10-19 15:12 ` [PATCH 10/14] drm/i915: fix transcoder PLL select masking Jesse Barnes
2011-10-19 15:12 ` [PATCH 11/14] drm/i915: export a CPT mode set verification function Jesse Barnes
2011-10-19 15:12 ` [PATCH 12/14] drm/i915: set watermarks for third pipe on IVB Jesse Barnes
2011-10-19 15:12 ` [PATCH 13/14] drm/i915: if transcoder disable fails, say which Jesse Barnes
2011-10-19 15:12 ` [PATCH 14/14] drm/i915: remove transcoder PLL mashing from mode_set per specs Jesse Barnes
2011-10-19 20:36 ` IVB fixes and 3 pipe support Eugeni Dodonov

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