Skip to contentSkip to conversation

drm/i915: set the right SDVO transcoder for CPT

PATCH In review [email protected] 3 participants 14 messages Oct 13, 2011 – Oct 24, 2011

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

PATCH 1/1 drm/i915: set the right SDVO transcoder for CPT

From: Paulo Zanoni <[email protected]>

Fixes fd.o #41272

---
 drivers/gpu/drm/i915/intel_sdvo.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

It would be nice to have this in Kernel 3.1 too

drivers/gpu/drm/i915/intel_sdvo.c +9 -1
index aa94110..c66c0b4 100644
@@ -1080,8 +1080,16 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
 		}
 		sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
 	}
-	if (intel_crtc->pipe == 1)
+
+	if (intel_sdvo->sdvo_reg == PCH_SDVOB) {
+	    if (HAS_PCH_IBX(dev))
+		sdvox |= TRANSCODER(intel_crtc->pipe);
+	    else
+		sdvox |= PORT_TRANS_SEL_CPT(intel_crtc->pipe);
+	} else if (intel_crtc->pipe == 1) {
 		sdvox |= SDVO_PIPE_B_SELECT;
+	}
+
 	if (intel_sdvo->has_hdmi_audio)
 		sdvox |= SDVO_AUDIO_ENABLE;
 
Signature · 1 line
1.7.6.3
#3 lore raw

PATCH 1/1 drm/i915: set the right SDVO transcoder for CPT

In reply to [email protected]

From: Paulo Zanoni <[email protected]>

Fixes fd.o #41272

v2: add a CPT-specific macro, make code cleaner

---
 drivers/gpu/drm/i915/i915_reg.h   |    8 ++++----
 drivers/gpu/drm/i915/intel_sdvo.c |    8 ++++++--
 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +4 -4
index 138eae1..e02b64c 100644
@@ -3275,10 +3275,10 @@
 /* or SDVOB */
 #define HDMIB   0xe1140
 #define  PORT_ENABLE    (1 << 31)
-#define  TRANSCODER_A   (0)
-#define  TRANSCODER_B   (1 << 30)
-#define  TRANSCODER(pipe)	((pipe) << 30)
-#define  TRANSCODER_MASK   (1 << 30)
+#define  TRANSCODER(pipe)       ((pipe) << 30)
+#define  TRANSCODER_CPT(pipe)   ((pipe) << 29)
+#define  TRANSCODER_MASK        (1 << 30)
+#define  TRANSCODER_MASK_CPT    (3 << 29)
 #define  COLOR_FORMAT_8bpc      (0)
 #define  COLOR_FORMAT_12bpc     (3 << 26)
 #define  SDVOB_HOTPLUG_ENABLE   (1 << 23)
drivers/gpu/drm/i915/intel_sdvo.c +6 -2
index aa94110..85fc976 100644
@@ -1080,8 +1080,12 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
 		}
 		sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
 	}
-	if (intel_crtc->pipe == 1)
-		sdvox |= SDVO_PIPE_B_SELECT;
+
+	if (INTEL_PCH_TYPE(dev) >= PCH_CPT)
+		sdvox |= TRANSCODER_CPT(intel_crtc->pipe);
+	else
+		sdvox |= TRANSCODER(intel_crtc->pipe);
+
 	if (intel_sdvo->has_hdmi_audio)
 		sdvox |= SDVO_AUDIO_ENABLE;
 
Signature · 1 line
1.7.6.3
Reviewed-by on v1 1/1
#4 lore raw
Quoted 3 lines · On Thu, 13 Oct 2011 14:41:38 -0300, [email protected] wrote:

From: Paulo Zanoni <[email protected]>

Fixes fd.o #41272

I prefer

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

and would think Rafel's script do as well ;-)

Can I talk you into submitting a patch to add

drivers/gpu/drm/i915/i915_debugfs.c +1 -0
index 3c395a5..58e4909 100644
@@ -61,6 +61,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
        const struct intel_device_info *info = INTEL_INFO(dev);
 
        seq_printf(m, "gen: %d\n", info->gen);
+       seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev));
 #define B(x) seq_printf(m, #x ": %s\n", yesno(info->x))
        B(is_mobile);
        B(is_i85x);

as well?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#5 lore raw

PATCH 1/3 drm/i915: set the right SDVO transcoder for CPT

In reply to [email protected]

From: Paulo Zanoni <[email protected]>

v2: add a CPT-specific macro, make code cleaner
v3: fix commit message

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

---
 drivers/gpu/drm/i915/i915_reg.h   |    8 ++++----
 drivers/gpu/drm/i915/intel_sdvo.c |    8 ++++++--
 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +4 -4
index 138eae1..e02b64c 100644
@@ -3275,10 +3275,10 @@
 /* or SDVOB */
 #define HDMIB   0xe1140
 #define  PORT_ENABLE    (1 << 31)
-#define  TRANSCODER_A   (0)
-#define  TRANSCODER_B   (1 << 30)
-#define  TRANSCODER(pipe)	((pipe) << 30)
-#define  TRANSCODER_MASK   (1 << 30)
+#define  TRANSCODER(pipe)       ((pipe) << 30)
+#define  TRANSCODER_CPT(pipe)   ((pipe) << 29)
+#define  TRANSCODER_MASK        (1 << 30)
+#define  TRANSCODER_MASK_CPT    (3 << 29)
 #define  COLOR_FORMAT_8bpc      (0)
 #define  COLOR_FORMAT_12bpc     (3 << 26)
 #define  SDVOB_HOTPLUG_ENABLE   (1 << 23)
drivers/gpu/drm/i915/intel_sdvo.c +6 -2
index aa94110..85fc976 100644
@@ -1080,8 +1080,12 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
 		}
 		sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
 	}
-	if (intel_crtc->pipe == 1)
-		sdvox |= SDVO_PIPE_B_SELECT;
+
+	if (INTEL_PCH_TYPE(dev) >= PCH_CPT)
+		sdvox |= TRANSCODER_CPT(intel_crtc->pipe);
+	else
+		sdvox |= TRANSCODER(intel_crtc->pipe);
+
 	if (intel_sdvo->has_hdmi_audio)
 		sdvox |= SDVO_AUDIO_ENABLE;
 
Signature · 1 line
1.7.6.3
Reviewed-by on v1 1/3
#6 lore raw
Quoted 8 lines · On Fri, 14 Oct 2011 18:16:22 -0300, [email protected] wrote:

From: Paulo Zanoni <[email protected]>

v2: add a CPT-specific macro, make code cleaner
v3: fix commit message

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

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#7 lore raw

Hi Keith,

This patch isn't in your -next pull request. Please consider merging for 3.2.

Thank you,
Paulo

2011/10/14 Chris Wilson <[email protected]>:

Quoted 15 lines · On Fri, 14 Oct 2011 18:16:22 -0300, [email protected] wrote:
Quoted 8 lines

From: Paulo Zanoni <[email protected]>

v2: add a CPT-specific macro, make code cleaner
v3: fix commit message

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

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

Signature · 1 line
Paulo Zanoni
#8 lore raw

PATCH 2/3 drm/i915: Rename HDMI register field definitions

In reply to [email protected]

From: Paulo Zanoni <[email protected]>

Also making the differences between HDMI{B,C,D} and SDVO registers for non-PCH, IBX and CPT more explicit.

---
 drivers/gpu/drm/i915/i915_reg.h      |   49 ++++++++++++++++++++--------------
 drivers/gpu/drm/i915/intel_display.c |   16 ++++++-----
 drivers/gpu/drm/i915/intel_hdmi.c    |    6 ++--
 drivers/gpu/drm/i915/intel_sdvo.c    |    5 ++-
 4 files changed, 44 insertions(+), 32 deletions(-)

As discussed on IRC

drivers/gpu/drm/i915/i915_reg.h +29 -20
index e02b64c..8fdee99 100644
@@ -3272,27 +3272,36 @@
 #define  ADPA_CRT_HOTPLUG_VOLREF_475MV  (1<<17)
 #define  ADPA_CRT_HOTPLUG_FORCE_TRIGGER (1<<16)
 
-/* or SDVOB */
+/*
+ * - Fields named "HDMI" are present for HDMI{B,C,D}
+ * - Fields named "PCH_SDVO" are present only for HDMIB (aka PCH_SDVOB or
+ *   SDVO_HDMI_CTL on newer chips). Some of them, not all, are compatible with
+ *   the old SDVO registers (SDVOB, SDVOC)
+ * - Fields valid only for IBX have the _IBX suffix
+ * - Fields valid only for CPT (and newer?) have the _CPT suffix
+ */
 #define HDMIB   0xe1140
-#define  PORT_ENABLE    (1 << 31)
-#define  TRANSCODER(pipe)       ((pipe) << 30)
-#define  TRANSCODER_CPT(pipe)   ((pipe) << 29)
-#define  TRANSCODER_MASK        (1 << 30)
-#define  TRANSCODER_MASK_CPT    (3 << 29)
-#define  COLOR_FORMAT_8bpc      (0)
-#define  COLOR_FORMAT_12bpc     (3 << 26)
-#define  SDVOB_HOTPLUG_ENABLE   (1 << 23)
-#define  SDVO_ENCODING          (0)
-#define  TMDS_ENCODING          (2 << 10)
-#define  NULL_PACKET_VSYNC_ENABLE       (1 << 9)
-/* CPT */
-#define  HDMI_MODE_SELECT	(1 << 9)
-#define  DVI_MODE_SELECT	(0)
-#define  SDVOB_BORDER_ENABLE    (1 << 7)
-#define  AUDIO_ENABLE           (1 << 6)
-#define  VSYNC_ACTIVE_HIGH      (1 << 4)
-#define  HSYNC_ACTIVE_HIGH      (1 << 3)
-#define  PORT_DETECTED          (1 << 2)
+#define HDMI_PORT_ENABLE            (1 << 31)
+#define HDMI_TRANSCODER_IBX(pipe)   ((pipe) << 30)
+#define HDMI_TRANSCODER_CPT(pipe)   ((pipe) << 29)
+#define HDMI_TRANSCODER_MASK_IBX    (1 << 30)
+#define HDMI_TRANSCODER_MASK_CPT    (3 << 29)
+#define HDMI_COLOR_FORMAT_8bpc      (0 << 26)
+#define HDMI_COLOR_FORMAT_12bpc     (3 << 26)
+#define HDMI_COLOR_MASK             (7 << 26)
+#define PCH_SDVO_STALL_SELECT_IBX   SDVO_STALL_SELECT
+#define PCH_SDVO_STALL_SELECT_CPT   (1 << 25)
+#define PCH_SDVO_HOTPLUG_INT_ENABLE (1 << 23)
+#define PCH_SDVO_ENCODING_SDVO      SDVO_ENCODING_SDVO
+#define PCH_SDVO_ENCODING_TMDS      SDVO_ENCODING_HDMI
+#define PCH_SDVO_ENCODING_MASK      (3 << 10)
+#define HDMI_MODE_DVI               (0 << 9)
+#define HDMI_MODE_HDMI              SDVO_NULL_PACKETS_DURING_VSYNC
+#define PCH_SDVO_BORDER_ENABLE      SDVO_BORDER_ENABLE
+#define HDMI_AUDIO_ENABLE           SDVO_AUDIO_ENABLE
+#define HDMI_VSYNC_ACTIVE_HIGH      SDVO_VSYNC_ACTIVE_HIGH
+#define HDMI_HSYNC_ACTIVE_HIGH      SDVO_HSYNC_ACTIVE_HIGH
+#define HDMI_PORT_DETECTED          SDVO_DETECTED
 
 /* PCH SDVOB multiplex with HDMIB */
 #define PCH_SDVOB	HDMIB
drivers/gpu/drm/i915/intel_display.c +9 -7
index f0e5f9f..d18db3b 100644
@@ -1002,14 +1002,16 @@ static bool dp_pipe_enabled(struct drm_i915_private *dev_priv,
 static bool hdmi_pipe_enabled(struct drm_i915_private *dev_priv,
 			      enum pipe pipe, u32 val)
 {
-	if ((val & PORT_ENABLE) == 0)
+	if ((val & HDMI_PORT_ENABLE) == 0)
 		return false;
 
 	if (HAS_PCH_CPT(dev_priv->dev)) {
-		if ((val & PORT_TRANS_SEL_MASK) != PORT_TRANS_SEL_CPT(pipe))
+		if ((val & HDMI_TRANSCODER_MASK_CPT) !=
+		    HDMI_TRANSCODER_CPT(pipe))
 			return false;
 	} else {
-		if ((val & TRANSCODER_MASK) != TRANSCODER(pipe))
+		if ((val & HDMI_TRANSCODER_MASK_IBX) !=
+		    HDMI_TRANSCODER_IBX(pipe))
 			return false;
 	}
 	return true;
@@ -1421,7 +1423,7 @@ static void disable_pch_hdmi(struct drm_i915_private *dev_priv,
 	if (hdmi_pipe_enabled(dev_priv, val, pipe)) {
 		DRM_DEBUG_KMS("Disabling pch HDMI %x on pipe %d\n",
 			      reg, pipe);
-		I915_WRITE(reg, val & ~PORT_ENABLE);
+		I915_WRITE(reg, val & ~HDMI_PORT_ENABLE);
 	}
 }
 
@@ -7292,7 +7294,7 @@ static void intel_setup_outputs(struct drm_device *dev)
 	if (HAS_PCH_SPLIT(dev)) {
 		int found;
 
-		if (I915_READ(HDMIB) & PORT_DETECTED) {
+		if (I915_READ(HDMIB) & HDMI_PORT_DETECTED) {
 			/* PCH SDVOB multiplex with HDMIB */
 			found = intel_sdvo_init(dev, PCH_SDVOB);
 			if (!found)
@@ -7301,10 +7303,10 @@ static void intel_setup_outputs(struct drm_device *dev)
 				intel_dp_init(dev, PCH_DP_B);
 		}
 
-		if (I915_READ(HDMIC) & PORT_DETECTED)
+		if (I915_READ(HDMIC) & HDMI_PORT_DETECTED)
 			intel_hdmi_init(dev, HDMIC);
 
-		if (I915_READ(HDMID) & PORT_DETECTED)
+		if (I915_READ(HDMID) & HDMI_PORT_DETECTED)
 			intel_hdmi_init(dev, HDMID);
 
 		if (I915_READ(PCH_DP_C) & DP_DETECTED)
drivers/gpu/drm/i915/intel_hdmi.c +3 -3
index 75026ba..27e7ebf 100644
@@ -236,13 +236,13 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
 		sdvox |= SDVO_HSYNC_ACTIVE_HIGH;
 
 	if (intel_crtc->bpp > 24)
-		sdvox |= COLOR_FORMAT_12bpc;
+		sdvox |= HDMI_COLOR_FORMAT_12bpc;
 	else
-		sdvox |= COLOR_FORMAT_8bpc;
+		sdvox |= HDMI_COLOR_FORMAT_8bpc;
 
 	/* Required on CPT */
 	if (intel_hdmi->has_hdmi_sink && HAS_PCH_CPT(dev))
-		sdvox |= HDMI_MODE_SELECT;
+		sdvox |= HDMI_MODE_HDMI;
 
 	if (intel_hdmi->has_audio) {
 		DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n",
drivers/gpu/drm/i915/intel_sdvo.c +3 -2
index 85fc976..2c31c0d 100644
@@ -1082,9 +1082,10 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
 	}
 
 	if (INTEL_PCH_TYPE(dev) >= PCH_CPT)
-		sdvox |= TRANSCODER_CPT(intel_crtc->pipe);
+		sdvox |= HDMI_TRANSCODER_CPT(intel_crtc->pipe);
 	else
-		sdvox |= TRANSCODER(intel_crtc->pipe);
+		/* works for IBX and non-PCH */
+		sdvox |= HDMI_TRANSCODER_IBX(intel_crtc->pipe);
 
 	if (intel_sdvo->has_hdmi_audio)
 		sdvox |= SDVO_AUDIO_ENABLE;
Signature · 1 line
1.7.6.3
#9 lore raw

Re: [PATCH 2/3] drm/i915: Rename HDMI register field definitions

Quoted 6 lines · On Fri, 14 Oct 2011 18:17:09 -0300, [email protected] wrote:

From: Paulo Zanoni <[email protected]>

Also making the differences between HDMI{B,C,D} and SDVO registers for non-PCH, IBX and CPT more explicit.

I'm a little more dubious over the value of this patch. The extra information is nice, but the patch doesn't impact much upon the readibility of the code. It seems like this should have the potential to clarify quite a bit of the logic and make it more consistent, yet that is not addressed here. Do you have plans to make use of the cleanup? Does it catch any bugs?
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#10 lore raw

Re: [PATCH 2/3] drm/i915: Rename HDMI register field definitions

2011/10/14 Chris Wilson <[email protected]>:

Quoted 5 lines

I'm a little more dubious over the value of this patch. The extra information is nice, but the patch doesn't impact much upon the readibility of the code. It seems like this should have the potential to clarify quite a bit of the logic and make it more consistent, yet that is not addressed here. Do you have plans to make use of the cleanup?

Well, "readability" has a different definition for each different reader. The patch was based on my own definition, but I'm open to suggestions. If you think it's not worth, just drop it: no problem.

Quoted 1 line

Does it catch any bugs?

Not yet, but it would have helped catch the one from my previous patch...

Signature · 1 line
Paulo Zanoni
#11 lore raw

PATCH 3/3 drm/i915: add PCH info to i915_capabilities

In reply to [email protected]

From: Paulo Zanoni <[email protected]>

---
 drivers/gpu/drm/i915/i915_debugfs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Chris actually wrote the patch, not just suggested it...

drivers/gpu/drm/i915/i915_debugfs.c +1 -0
index 8e95d66..9fdabd6 100644
@@ -61,6 +61,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
 	const struct intel_device_info *info = INTEL_INFO(dev);
 
 	seq_printf(m, "gen: %d\n", info->gen);
+	seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev));
 #define B(x) seq_printf(m, #x ": %s\n", yesno(info->x))
 	B(is_mobile);
 	B(is_i85x);
Signature · 1 line
1.7.6.3
#12 lore raw

Re: [PATCH 3/3] drm/i915: add PCH info to i915_capabilities

Quoted 9 lines · On Fri, 14 Oct 2011 18:17:41 -0300, [email protected] wrote:

From: Paulo Zanoni <[email protected]>

---
 drivers/gpu/drm/i915/i915_debugfs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Chris actually wrote the patch, not just suggested it...

I didn't even compile check it ;-)

In that case, also include my signed-of-by rather than suggested-by.

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#13 lore raw

Re: [PATCH 3/3] drm/i915: add PCH info to i915_capabilities

Hi Keith,

This patch isn't in your -next pull request. Please consider merging for 3.2.

Thank you,
Paulo

2011/10/14 Chris Wilson <[email protected]>:

Quoted 20 lines · On Fri, 14 Oct 2011 18:17:41 -0300, [email protected] wrote:
Quoted 9 lines

From: Paulo Zanoni <[email protected]>

---
 drivers/gpu/drm/i915/i915_debugfs.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)

Chris actually wrote the patch, not just suggested it...

I didn't even compile check it ;-)

In that case, also include my signed-of-by rather than suggested-by.

-Chris

--
Chris Wilson, Intel Open Source Technology Centre

Signature · 1 line
Paulo Zanoni