Skip to contentSkip to conversation

drm/i915: fix pipeconf dither bit definitions

PATCH Applied Jesse Barnes 2 participants 4 messages Sep 7, 2010 – Sep 8, 2010

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

PATCH 1/2 drm/i915: fix pipeconf dither bit definitions

Make them match the others and add BPP definitions.

---
 drivers/gpu/drm/i915/i915_reg.h      |   16 +++++++++++-----
 drivers/gpu/drm/i915/intel_display.c |    8 ++++----
 2 files changed, 15 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +11 -5
index 9951471..3937fb2 100644
@@ -2077,11 +2077,6 @@
 
 /* Display & cursor control */
 
-/* dithering flag on Ironlake */
-#define PIPE_ENABLE_DITHER		(1 << 4)
-#define PIPE_DITHER_TYPE_MASK		(3 << 2)
-#define PIPE_DITHER_TYPE_SPATIAL	(0 << 2)
-#define PIPE_DITHER_TYPE_ST01		(1 << 2)
 /* Pipe A */
 #define PIPEADSL		0x70000
 #define   DSL_LINEMASK	       	0x00000fff
@@ -2100,6 +2095,17 @@
 #define   PIPECONF_INTERLACE_W_FIELD_INDICATION	(6 << 21)
 #define   PIPECONF_INTERLACE_FIELD_0_ONLY		(7 << 21)
 #define   PIPECONF_CXSR_DOWNCLOCK	(1<<16)
+#define   PIPECONF_BPP_MASK	(0x000000e0)
+#define   PIPECONF_BPP_8	(0<<5)
+#define   PIPECONF_BPP_10	(1<<5)
+#define   PIPECONF_BPP_6	(2<<5)
+#define   PIPECONF_BPP_12	(3<<5)
+#define   PIPECONF_DITHER_EN	(1<<4)
+#define   PIPECONF_DITHER_TYPE_MASK (0x0000000c)
+#define   PIPECONF_DITHER_TYPE_SP (0<<2)
+#define   PIPECONF_DITHER_TYPE_ST1 (1<<2)
+#define   PIPECONF_DITHER_TYPE_ST2 (2<<2)
+#define   PIPECONF_DITHER_TYPE_TEMP (3<<2)
 #define PIPEASTAT		0x70024
 #define   PIPE_FIFO_UNDERRUN_STATUS		(1UL<<31)
 #define   PIPE_CRC_ERROR_ENABLE			(1UL<<29)
drivers/gpu/drm/i915/intel_display.c +4 -4
index f470e60..c23e7e3 100644
@@ -3913,8 +3913,8 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
 	}
 
 	if (HAS_PCH_SPLIT(dev)) {
-		pipeconf &= ~PIPE_ENABLE_DITHER;
-		pipeconf &= ~PIPE_DITHER_TYPE_MASK;
+		pipeconf &= ~PIPECONF_DITHER_EN;
+		pipeconf &= ~PIPECONF_DITHER_TYPE_MASK;
 	}
 
 	/* The LVDS pin pair needs to be on before the DPLLs are enabled.
@@ -3958,8 +3958,8 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
 		if (IS_I965G(dev)) {
 			if (dev_priv->lvds_dither) {
 				if (HAS_PCH_SPLIT(dev)) {
-					pipeconf |= PIPE_ENABLE_DITHER;
-					pipeconf |= PIPE_DITHER_TYPE_ST01;
+					pipeconf |= PIPECONF_DITHER_EN;
+					pipeconf |= PIPECONF_DITHER_TYPE_ST1;
 				} else
 					lvds |= LVDS_ENABLE_DITHER;
 			} else {
Signature · 1 line
1.6.3.3
#1 lore raw

PATCH 2/2 drm/i915: set dither bits on eDP panels too

We really need a macro to test whether a given connector has a panel attached rather than sprinkling HAS_PCH_SPLIT/IS_eDP/has_edp_encoder etc all over.

---
 drivers/gpu/drm/i915/intel_display.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_display.c +13 -12
index c23e7e3..f0a9f00 100644
@@ -3954,23 +3954,24 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
 		 * appropriately here, but we need to look more thoroughly into how
 		 * panels behave in the two modes.
 		 */
-		/* set the dithering flag */
+		/* set the dithering flag on non-PCH LVDS as needed */
 		if (IS_I965G(dev)) {
-			if (dev_priv->lvds_dither) {
-				if (HAS_PCH_SPLIT(dev)) {
-					pipeconf |= PIPECONF_DITHER_EN;
-					pipeconf |= PIPECONF_DITHER_TYPE_ST1;
-				} else
-					lvds |= LVDS_ENABLE_DITHER;
-			} else {
-				if (!HAS_PCH_SPLIT(dev)) {
-					lvds &= ~LVDS_ENABLE_DITHER;
-				}
-			}
+			if (dev_priv->lvds_dither && !HAS_PCH_SPLIT(dev))
+				lvds |= LVDS_ENABLE_DITHER;
+			else if (!HAS_PCH_SPLIT(dev))
+				lvds &= ~LVDS_ENABLE_DITHER;
 		}
 		I915_WRITE(lvds_reg, lvds);
 		I915_READ(lvds_reg);
 	}
+
+	/* set the dithering flag if needed */
+	if (IS_I965G(dev) && HAS_PCH_SPLIT(dev) && dev_priv->lvds_dither &&
+	    (is_lvds || has_edp_encoder)) {
+		pipeconf |= PIPECONF_DITHER_EN;
+		pipeconf |= PIPECONF_DITHER_TYPE_ST1;
+	}
+
 	if (is_dp)
 		intel_dp_set_m_n(crtc, mode, adjusted_mode);
 	else if (HAS_PCH_SPLIT(dev)) {
Signature · 1 line
1.6.3.3
#2 lore raw

Re: [PATCH 2/2] drm/i915: set dither bits on eDP panels too

Quoted 1 line · Jesse Barnes

We really need a macro to test whether a given connector has a panel attached rather than sprinkling HAS_PCH_SPLIT/IS_eDP/has_edp_encoder etc all over.

Now that you mention it, it would be nice. ;-)

Comment inline.

Quoted 21 lines
---
 drivers/gpu/drm/i915/intel_display.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -6
index c23e7e3..f0a9f00 100644
@@ -3954,23 +3954,24 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
 		 * appropriately here, but we need to look more thoroughly into how
 		 * panels behave in the two modes.
 		 */
-		/* set the dithering flag */
+		/* set the dithering flag on non-PCH LVDS as needed */
 		if (IS_I965G(dev)) {
-			if (dev_priv->lvds_dither) {
-				if (HAS_PCH_SPLIT(dev)) {
-					pipeconf |= PIPECONF_DITHER_EN;
-					pipeconf |= PIPECONF_DITHER_TYPE_ST1;
-				} else

drivers/gpu/drm/i915/intel_display.c static int intel_crtc_mode_set(struct drm_crtc *crtc, · line 3962

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +4 -6
-					lvds |= LVDS_ENABLE_DITHER;
-			} else {
-				if (!HAS_PCH_SPLIT(dev)) {
-					lvds &= ~LVDS_ENABLE_DITHER;
-				}
-			}
+			if (dev_priv->lvds_dither && !HAS_PCH_SPLIT(dev))
+				lvds |= LVDS_ENABLE_DITHER;
+			else if (!HAS_PCH_SPLIT(dev))
+				lvds &= ~LVDS_ENABLE_DITHER;

Lets take one more step in cleaning up this conditional...

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

Re: [PATCH 2/2] drm/i915: set dither bits on eDP panels too

In reply to Jesse Barnes

Applied to -next with minor tweaks.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre