Skip to contentSkip to conversation

Deep color support

RFC In review Jesse Barnes 3 participants 17 messages Apr 19, 2011 – May 11, 2011

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

This collection of patches sits on top of my two DRM EDID patches to fetch display color format support. They fix a few bugs in our depth handling code, and allow for deep color configurations to be enabled in the core display code (still working on good tests for this).

Looking for comments on how things are split out and lots of review for implications on various chipsets.

Thanks,
Jesse

#1 lore raw

PATCH 1/7 drm/i915: color range only works on pre-ILK

ILK+ provides this feature in the transcoder and pipe configuration instead.

---
 drivers/gpu/drm/i915/intel_hdmi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +2 -1
index f289b86..a6871d8 100644
@@ -125,7 +125,8 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
 	u32 sdvox;
 
 	sdvox = SDVO_ENCODING_HDMI | SDVO_BORDER_ENABLE;
-	sdvox |= intel_hdmi->color_range;
+	if (!HAS_PCH_SPLIT(dev))
+		sdvox |= intel_hdmi->color_range;
 	if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
 		sdvox |= SDVO_VSYNC_ACTIVE_HIGH;
 	if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
Signature · 1 line
1.7.4.1
#2 lore raw

Re: [PATCH 1/7] drm/i915: color range only works on pre-ILK

Quoted 2 lines · Jesse Barnes

ILK+ provides this feature in the transcoder and pipe configuration instead.

This doesn't seem to add in a new implementation of this feature for ILK, just stops using the pre-ILK version on ILK. Please explain how this is sufficient?

Signature · 1 line
[email protected]

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

#3 lore raw

Re: [PATCH 1/7] drm/i915: color range only works on pre-ILK

Quoted 8 lines · On Tue, 10 May 2011 14:12:48 -0700 Keith Packard <[email protected]> wrote:
Quoted 2 lines · Jesse Barnes

ILK+ provides this feature in the transcoder and pipe configuration instead.

This doesn't seem to add in a new implementation of this feature for ILK, just stops using the pre-ILK version on ILK. Please explain how this is sufficient?

That's in patch 7/7, you want me to combine this fix with the feature addition for ILK+?

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#4 lore raw

Re: [PATCH 1/7] drm/i915: color range only works on pre-ILK

Quoted 8 lines · On Tue, 10 May 2011 14:16:57 -0700 Jesse Barnes <[email protected]>…
Quoted 5 lines · On Tue, 10 May 2011 14:12:48 -0700 Keith Packard <[email protected]> wrote:
Quoted 2 lines · Jesse Barnes

ILK+ provides this feature in the transcoder and pipe configuration instead.

Quoted 6 lines
Quoted 3 lines

This doesn't seem to add in a new implementation of this feature for ILK, just stops using the pre-ILK version on ILK. Please explain how this is sufficient?

That's in patch 7/7, you want me to combine this fix with the feature addition for ILK+?

Actually not; this is just a bug fix. I haven't looked at adding broadcast colorspace support to ILK+ yet.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#5 lore raw

Re: [PATCH 1/7] drm/i915: color range only works on pre-ILK

In reply to Jesse Barnes
Quoted 2 lines · Jesse Barnes

That's in patch 7/7, you want me to combine this fix with the feature addition for ILK+?

No, I'm good with separate patches, just want to see the patch described correctly.

Signature · 1 line
[email protected]

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

#6 lore raw

PATCH 2/7 drm/i915: don't set transcoder bpc on CougarPoint

In reply to Jesse Barnes

BPC is specified in FDI RX on CPT and above, rather than in the transcoder.

---
 drivers/gpu/drm/i915/intel_display.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +9 -6
index 09b20b1..69649b2 100644
@@ -1157,12 +1157,15 @@ static void intel_enable_transcoder(struct drm_i915_private *dev_priv,
 
 	reg = TRANSCONF(pipe);
 	val = I915_READ(reg);
-	/*
-	 * make the BPC in transcoder be consistent with
-	 * that in pipeconf reg.
-	 */
-	val &= ~PIPE_BPC_MASK;
-	val |= I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK;
+
+	if (HAS_PCH_IBX(dev_priv->dev)) {
+		/*
+		 * make the BPC in transcoder be consistent with
+		 * that in pipeconf reg.
+		 */
+		val &= ~PIPE_BPC_MASK;
+		val |= I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK;
+	}
 	I915_WRITE(reg, val | TRANS_ENABLE);
 	if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100))
 		DRM_ERROR("failed to enable transcoder %d\n", pipe);
Signature · 1 line
1.7.4.1
#7 lore raw

PATCH 3/7 drm/i915: set bpc for DP transcoder

In reply to Jesse Barnes

This may not be the default value, so pull the bpc out of the pipe reg and write it to the DP transcoder so proper dithering and signaling occurs.

---
 drivers/gpu/drm/i915/intel_display.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -1
index 69649b2..8ef0c39 100644
@@ -2504,6 +2504,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 	/* For PCH DP, enable TRANS_DP_CTL */
 	if (HAS_PCH_CPT(dev) &&
 	    intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT)) {
+		u32 bpc = (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) >> 5;
 		reg = TRANS_DP_CTL(pipe);
 		temp = I915_READ(reg);
 		temp &= ~(TRANS_DP_PORT_SEL_MASK |
@@ -2511,7 +2512,7 @@ static void ironlake_pch_enable(struct drm_crtc *crtc)
 			  TRANS_DP_BPC_MASK);
 		temp |= (TRANS_DP_OUTPUT_ENABLE |
 			 TRANS_DP_ENH_FRAMING);
-		temp |= TRANS_DP_8BPC;
+		temp |= bpc << 9; /* same format but at 11:9 */
 
 		if (crtc->mode.flags & DRM_MODE_FLAG_PHSYNC)
 			temp |= TRANS_DP_HSYNC_ACTIVE_HIGH;
Signature · 1 line
1.7.4.1
#8 lore raw

PATCH 4/7 drm/i915: split out Ironlake pipe bpp picking code

In reply to Jesse Barnes

Figuring out which pipe bpp to use is a bit painful. It depends on both the encoder and display configuration attached to a pipe. For instance, to drive a 24bpp framebuffer out to an 18bpp panel, we need to use 6bpc on the pipe but also enable dithering. But driving that same framebuffer to a DisplayPort output on another pipe means using 8bpc and no dithering.

So split out and enhance the code to handle the various cases, returning an appropriate pipe bpp as well as whether dithering should be enabled.

Save the resulting pipe bpp in the intel_crtc struct for use by encoders in calculating bandwidth requirements (defaults to 24bpp on pre-ILK).

---
 drivers/gpu/drm/i915/intel_display.c |  181 ++++++++++++++++++++++++++--------
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 2 files changed, 140 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/intel_display.c +139 -42
index 8ef0c39..e81e418 100644
@@ -4232,6 +4232,120 @@ static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
 	return dev_priv->lvds_use_ssc && i915_panel_use_ssc;
 }
 
+/**
+ * intel_choose_pipe_bpp - figure out what color depth the pipe should send
+ * @crtc: CRTC structure
+ *
+ * A pipe may be connected to one or more outputs.  Based on the depth of the
+ * attached framebuffer, choose a good color depth to use on the pipe.
+ *
+ * If possible, match the pipe depth to the fb depth.  In some cases, this
+ * isn't ideal, because the connected output supports a lesser or restricted
+ * set of depths.  Resolve that here:
+ *    LVDS typically supports only 6bpc, so clamp down in that case
+ *    HDMI supports only 8bpc or 12bpc, so clamp to 8bpc with dither for 10bpc
+ *    Displays may support a restricted set as well, check EDID and clamp as
+ *      appropriate.
+ *
+ * RETURNS:
+ * Dithering requirement (i.e. false if display bpc and pipe bpc match,
+ * true if they don't match).
+ */
+static bool intel_choose_pipe_bpp(struct drm_crtc *crtc, unsigned int *pipe_bpp)
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_encoder *encoder;
+	struct drm_connector *connector;
+	unsigned int display_bpc = UINT_MAX, fb_bpc, bpc;
+
+	fb_bpc = crtc->fb->depth / 3;
+
+	/* Walk the encoders & connectors on this crtc, get min bpc */
+	list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
+		struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
+
+		if (encoder->crtc != crtc)
+			continue;
+
+		if (intel_encoder->type == INTEL_OUTPUT_LVDS) {
+			unsigned int lvds_bpc;
+
+			if ((I915_READ(PCH_LVDS) & LVDS_A3_POWER_MASK) ==
+			    LVDS_A3_POWER_UP)
+				lvds_bpc = 8;
+			else
+				lvds_bpc = 6;
+
+			if (lvds_bpc < display_bpc)
+				display_bpc = lvds_bpc;
+			continue;
+		}
+
+		if (intel_encoder->type == INTEL_OUTPUT_EDP) {
+			/* Use VBT settings if we have an eDP panel */
+			unsigned int edp_bpc = dev_priv->edp.bpp / 3;
+
+			if (edp_bpc < display_bpc)
+				display_bpc = edp_bpc;
+			continue;
+		}
+
+		/* Not one of the known troublemakers, check the EDID */
+		list_for_each_entry(connector, &dev->mode_config.connector_list,
+				    head) {
+			if (connector->encoder != encoder)
+				continue;
+
+			if (connector->display_info.bpc < display_bpc)
+				display_bpc = connector->display_info.bpc;
+		}
+
+		/*
+		 * HDMI is either 12 or 8, so if the display let 10bpc sneak
+		 * through, clamp it down.  (Note: >12bpc will be caught below.)
+		 */
+		if (intel_encoder->type == INTEL_OUTPUT_HDMI) {
+			if (display_bpc > 8 && display_bpc < 12)
+				display_bpc = 12;
+			else
+				display_bpc = 8;
+		}
+	}
+
+	/*
+	 * We could just drive the pipe at the highest bpc all the time and
+	 * enable dithering as needed, but that costs bandwidth.  So choose
+	 * the minimum value that expresses the full color range of the fb but
+	 * also stays within the max display bpc discovered above.
+	 */
+
+	switch (crtc->fb->depth) {
+	case 8:
+	case 15:
+	case 16:
+		bpc = 6; /* min is 18bpp */
+		break;
+	case 24:
+		bpc = min((unsigned int)8, display_bpc);
+		break;
+	case 30:
+		bpc = min((unsigned int)10, display_bpc);
+		break;
+	case 48:
+		bpc = min((unsigned int)12, display_bpc);
+		break;
+	default:
+		DRM_DEBUG("unsupported depth, assuming 24 bits\n");
+		bpc = min((unsigned int)8, display_bpc);
+		break;
+	}
+
+	*pipe_bpp = bpc * 3;
+
+	return display_bpc != bpc;
+}
+
 static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
 			      struct drm_display_mode *mode,
 			      struct drm_display_mode *adjusted_mode,
@@ -4644,7 +4758,9 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 	struct fdi_m_n m_n = {0};
 	u32 temp;
 	u32 lvds_sync = 0;
-	int target_clock, pixel_multiplier, lane, link_bw, bpp, factor;
+	int target_clock, pixel_multiplier, lane, link_bw, factor;
+	unsigned int pipe_bpp;
+	bool dither;
 
 	list_for_each_entry(encoder, &mode_config->encoder_list, base.head) {
 		if (encoder->base.crtc != crtc)
@@ -4771,56 +4887,37 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 	/* determine panel color depth */
 	temp = I915_READ(PIPECONF(pipe));
 	temp &= ~PIPE_BPC_MASK;
-	if (is_lvds) {
-		/* the BPC will be 6 if it is 18-bit LVDS panel */
-		if ((I915_READ(PCH_LVDS) & LVDS_A3_POWER_MASK) == LVDS_A3_POWER_UP)
-			temp |= PIPE_8BPC;
-		else
-			temp |= PIPE_6BPC;
-	} else if (has_edp_encoder) {
-		switch (dev_priv->edp.bpp/3) {
-		case 8:
-			temp |= PIPE_8BPC;
-			break;
-		case 10:
-			temp |= PIPE_10BPC;
-			break;
-		case 6:
-			temp |= PIPE_6BPC;
-			break;
-		case 12:
-			temp |= PIPE_12BPC;
-			break;
-		}
-	} else
-		temp |= PIPE_8BPC;
-	I915_WRITE(PIPECONF(pipe), temp);
-
-	switch (temp & PIPE_BPC_MASK) {
-	case PIPE_8BPC:
-		bpp = 24;
+	dither = intel_choose_pipe_bpp(crtc, &pipe_bpp);
+	switch (pipe_bpp) {
+	case 18:
+		temp |= PIPE_6BPC;
 		break;
-	case PIPE_10BPC:
-		bpp = 30;
+	case 24:
+		temp |= PIPE_8BPC;
 		break;
-	case PIPE_6BPC:
-		bpp = 18;
+	case 30:
+		temp |= PIPE_10BPC;
 		break;
-	case PIPE_12BPC:
-		bpp = 36;
+	case 36:
+		temp |= PIPE_12BPC;
 		break;
 	default:
-		DRM_ERROR("unknown pipe bpc value\n");
-		bpp = 24;
+		WARN(1, "intel_choose_pipe_bpp returned invalid value\n");
+		temp |= PIPE_8BPC;
+		pipe_bpp = 24;
+		break;
 	}
 
+	intel_crtc->bpp = pipe_bpp;
+	I915_WRITE(PIPECONF(pipe), temp);
+
 	if (!lane) {
 		/*
 		 * Account for spread spectrum to avoid
 		 * oversubscribing the link. Max center spread
 		 * is 2.5%; use 5% for safety's sake.
 		 */
-		u32 bps = target_clock * bpp * 21 / 20;
+		u32 bps = target_clock * intel_crtc->bpp * 21 / 20;
 		lane = bps / (link_bw * 8) + 1;
 	}
 
@@ -4828,7 +4925,8 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 
 	if (pixel_multiplier > 1)
 		link_bw *= pixel_multiplier;
-	ironlake_compute_m_n(bpp, lane, target_clock, link_bw, &m_n);
+	ironlake_compute_m_n(intel_crtc->bpp, lane, target_clock, link_bw,
+			     &m_n);
 
 	/* Ironlake: try to setup display ref clock before DPLL
 	 * enabling. This is only under driver's control after
@@ -5031,14 +5129,12 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc,
 		I915_WRITE(PCH_LVDS, temp);
 	}
 
-	/* set the dithering flag and clear for anything other than a panel. */
 	pipeconf &= ~PIPECONF_DITHER_EN;
 	pipeconf &= ~PIPECONF_DITHER_TYPE_MASK;
-	if (dev_priv->lvds_dither && (is_lvds || has_edp_encoder)) {
+	if ((is_lvds && dev_priv->lvds_dither) || dither) {
 		pipeconf |= PIPECONF_DITHER_EN;
 		pipeconf |= PIPECONF_DITHER_TYPE_ST1;
 	}
-
 	if (is_dp || intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
 		intel_dp_set_m_n(crtc, mode, adjusted_mode);
 	} else {
@@ -6330,6 +6426,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe)
 
 	intel_crtc_reset(&intel_crtc->base);
 	intel_crtc->active = true; /* force the pipe off on setup_init_config */
+	intel_crtc->bpp = 24; /* default for pre-Ironlake */
 
 	if (HAS_PCH_SPLIT(dev)) {
 		intel_helper_funcs.prepare = ironlake_crtc_prepare;
drivers/gpu/drm/i915/intel_drv.h +1 -0
index f5b0d83..051345c 100644
@@ -171,6 +171,7 @@ struct intel_crtc {
 	int16_t cursor_x, cursor_y;
 	int16_t cursor_width, cursor_height;
 	bool cursor_visible;
+	unsigned int bpp;
 };
 
 #define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
Signature · 1 line
1.7.4.1
#9 lore raw

Re: [PATCH 4/7] drm/i915: split out Ironlake pipe bpp picking code

Quoted 38 lines · Jesse Barnes

Figuring out which pipe bpp to use is a bit painful. It depends on both the encoder and display configuration attached to a pipe. For instance, to drive a 24bpp framebuffer out to an 18bpp panel, we need to use 6bpc on the pipe but also enable dithering. But driving that same framebuffer to a DisplayPort output on another pipe means using 8bpc and no dithering.

So split out and enhance the code to handle the various cases, returning an appropriate pipe bpp as well as whether dithering should be enabled.

Save the resulting pipe bpp in the intel_crtc struct for use by encoders in calculating bandwidth requirements (defaults to 24bpp on pre-ILK).

---
 drivers/gpu/drm/i915/intel_display.c |  181 ++++++++++++++++++++++++++--------
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 2 files changed, 140 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/intel_display.c +11 -0
index 8ef0c39..e81e418 100644
@@ -4232,6 +4232,120 @@ static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
 	return dev_priv->lvds_use_ssc && i915_panel_use_ssc;
 }
 
+/**
+ * intel_choose_pipe_bpp - figure out what color depth the pipe should send
+ * @crtc: CRTC structure
+ *
+ * A pipe may be connected to one or more outputs.  Based on the depth of the
+ * attached framebuffer, choose a good color depth to use on the pipe.
+ *
+ * If possible, match the pipe depth to the fb depth.  In some cases, this
+ * isn't ideal, because the connected output supports a lesser or restricted
+ * set of depths.  Resolve that here:
+ *    LVDS typically supports only 6bpc, so clamp down in that case

drivers/gpu/drm/i915/intel_display.c static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) · line 4255

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +9 -0
+ *    HDMI supports only 8bpc or 12bpc, so clamp to 8bpc with dither for 10bpc
+ *    Displays may support a restricted set as well, check EDID and clamp as
+ *      appropriate.
+ *
+ * RETURNS:
+ * Dithering requirement (i.e. false if display bpc and pipe bpc match,
+ * true if they don't match).
+ */
+static bool intel_choose_pipe_bpp(struct drm_crtc *crtc, unsigned int
 *pipe_bpp)

Should mention dithering in the name, perhaps choose_pipe_bpp_and_dithering or some such? Perhaps returning the dithering in another by-reference parameter?

drivers/gpu/drm/i915/intel_display.c static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) · line 4264

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_encoder *encoder;
+	struct drm_connector *connector;
+	unsigned int display_bpc = UINT_MAX, fb_bpc, bpc;
+
+	fb_bpc = crtc->fb->depth / 3;
+
+	/* Walk the encoders & connectors on this crtc, get min bpc */

Don't you want the max bpc?

Quoted 18 lines
drivers/gpu/drm/i915/intel_display.c +18 -0
+
+	/*
+	 * We could just drive the pipe at the highest bpc all the time and
+	 * enable dithering as needed, but that costs bandwidth.  So choose
+	 * the minimum value that expresses the full color range of the fb but
+	 * also stays within the max display bpc discovered above.
+	 */
+
+	switch (crtc->fb->depth) {
+	case 8:
+	case 15:
+	case 16:
+		bpc = 6; /* min is 18bpp */
+		break;
+	case 24:
+		bpc = min((unsigned int)8, display_bpc);
+		break;
+	case 30:

drivers/gpu/drm/i915/intel_display.c static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) · line 4342

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+		bpc = min((unsigned int)10, display_bpc);
+		break;
+	case 48:
+		bpc = min((unsigned int)12, display_bpc);
+		break;
+	default:
+		DRM_DEBUG("unsupported depth, assuming 24 bits\n");
+		bpc = min((unsigned int)8, display_bpc);
+		break;
+	}

Hrm. 8-bit through a colormap should probably use 8 bpc? We can probably ignore 15/16-bit direct color (which might want 8bpc as well).

The simple fix would be to use 8bpc on 8bpp and otherwise leave things alone.

Signature · 1 line
[email protected]

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

#10 lore raw

Re: [PATCH 4/7] drm/i915: split out Ironlake pipe bpp picking code

Quoted 45 lines · On Tue, 10 May 2011 14:23:18 -0700 Keith Packard <[email protected]> wrote:
Quoted 44 lines · Jesse Barnes

Figuring out which pipe bpp to use is a bit painful. It depends on both the encoder and display configuration attached to a pipe. For instance, to drive a 24bpp framebuffer out to an 18bpp panel, we need to use 6bpc on the pipe but also enable dithering. But driving that same framebuffer to a DisplayPort output on another pipe means using 8bpc and no dithering.

So split out and enhance the code to handle the various cases, returning an appropriate pipe bpp as well as whether dithering should be enabled.

Save the resulting pipe bpp in the intel_crtc struct for use by encoders in calculating bandwidth requirements (defaults to 24bpp on pre-ILK).

---
 drivers/gpu/drm/i915/intel_display.c |  181 ++++++++++++++++++++++++++--------
 drivers/gpu/drm/i915/intel_drv.h     |    1 +
 2 files changed, 140 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/intel_display.c +17 -0
index 8ef0c39..e81e418 100644
@@ -4232,6 +4232,120 @@ static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)
 	return dev_priv->lvds_use_ssc && i915_panel_use_ssc;
 }
 
+/**
+ * intel_choose_pipe_bpp - figure out what color depth the pipe should send
+ * @crtc: CRTC structure
+ *
+ * A pipe may be connected to one or more outputs.  Based on the depth of the
+ * attached framebuffer, choose a good color depth to use on the pipe.
+ *
+ * If possible, match the pipe depth to the fb depth.  In some cases, this
+ * isn't ideal, because the connected output supports a lesser or restricted
+ * set of depths.  Resolve that here:
+ *    LVDS typically supports only 6bpc, so clamp down in that case
+ *    HDMI supports only 8bpc or 12bpc, so clamp to 8bpc with dither for 10bpc
+ *    Displays may support a restricted set as well, check EDID and clamp as
+ *      appropriate.
+ *
+ * RETURNS:
+ * Dithering requirement (i.e. false if display bpc and pipe bpc match,
Quoted 8 lines

drivers/gpu/drm/i915/intel_display.c static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv)

Quoted 4 lines
drivers/gpu/drm/i915/intel_display.c +3 -0
+ * true if they don't match).
+ */
+static bool intel_choose_pipe_bpp(struct drm_crtc *crtc, unsigned int
 *pipe_bpp)

Should mention dithering in the name, perhaps choose_pipe_bpp_and_dithering or some such? Perhaps returning the dithering in another by-reference parameter?

Ok fixed, just added _dither to the name.

Quoted 13 lines

drivers/gpu/drm/i915/intel_display.c static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) · line 4264

Quoted 11 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+{
+	struct drm_device *dev = crtc->dev;
+	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_encoder *encoder;
+	struct drm_connector *connector;
+	unsigned int display_bpc = UINT_MAX, fb_bpc, bpc;
+
+	fb_bpc = crtc->fb->depth / 3;
+
+	/* Walk the encoders & connectors on this crtc, get min bpc */

Don't you want the max bpc?

If the comment is confusing, I can remove it. Or maybe I need to expand it.

What we're trying to do is find a common bpc for all the displays attached to the pipe. But we need to use the minimum of all attached in order to set the pipe's dithering correctly, since dithering occurs at the pipe level, not the output (at least on ILK+).

Quoted 32 lines
Quoted 18 lines
drivers/gpu/drm/i915/intel_display.c +18 -0
+
+	/*
+	 * We could just drive the pipe at the highest bpc all the time and
+	 * enable dithering as needed, but that costs bandwidth.  So choose
+	 * the minimum value that expresses the full color range of the fb but
+	 * also stays within the max display bpc discovered above.
+	 */
+
+	switch (crtc->fb->depth) {
+	case 8:
+	case 15:
+	case 16:
+		bpc = 6; /* min is 18bpp */
+		break;
+	case 24:
+		bpc = min((unsigned int)8, display_bpc);
+		break;
+	case 30:

drivers/gpu/drm/i915/intel_display.c static inline bool intel_panel_use_ssc(struct drm_i915_private *dev_priv) · line 4342

Quoted 10 lines
drivers/gpu/drm/i915/intel_display.c +10 -0
+		bpc = min((unsigned int)10, display_bpc);
+		break;
+	case 48:
+		bpc = min((unsigned int)12, display_bpc);
+		break;
+	default:
+		DRM_DEBUG("unsupported depth, assuming 24 bits\n");
+		bpc = min((unsigned int)8, display_bpc);
+		break;
+	}

Hrm. 8-bit through a colormap should probably use 8 bpc? We can probably ignore 15/16-bit direct color (which might want 8bpc as well).

Quoted 1 line

The simple fix would be to use 8bpc on 8bpp and otherwise leave things alone.

Ok, fixed. New patches on their way.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#11 lore raw

PATCH 5/7 drm/i915: split out plane update code

In reply to Jesse Barnes

Updating the planes is device specific, so create a new display callback and use it in pipe_set_base. (In fact we could go even further, valid display plane bits have changed with each generation, as has tiled buffer handling.)

---
 drivers/gpu/drm/i915/i915_drv.h      |    2 +
 drivers/gpu/drm/i915/intel_display.c |  107 +++++++++++++++++++++++++++++++---
 2 files changed, 100 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
index 7ee0ac8..04fe37e 100644
@@ -208,6 +208,8 @@ struct drm_i915_display_funcs {
 			     struct drm_display_mode *adjusted_mode,
 			     int x, int y,
 			     struct drm_framebuffer *old_fb);
+	int (*update_plane)(struct drm_crtc *crtc, struct drm_framebuffer *fb,
+			    int x, int y);
 
 	/* clock updates for mode set */
 	/* cursor updates */
drivers/gpu/drm/i915/intel_display.c +98 -9

140 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#12 lore raw

PATCH 6/7 drm/i915: use pipe bpp in DP link bandwidth calculations

In reply to Jesse Barnes

The pipe may be driving various bpp values depending on the display configuration, so take that into account when calculating link bandwidth requirements.

---
 drivers/gpu/drm/i915/intel_dp.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +2 -3
index 0daefca..bce9edb 100644
@@ -684,7 +684,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
 	struct drm_encoder *encoder;
 	struct drm_i915_private *dev_priv = dev->dev_private;
 	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-	int lane_count = 4, bpp = 24;
+	int lane_count = 4;
 	struct intel_dp_m_n m_n;
 	int pipe = intel_crtc->pipe;
 
@@ -703,7 +703,6 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
 			break;
 		} else if (is_edp(intel_dp)) {
 			lane_count = dev_priv->edp.lanes;
-			bpp = dev_priv->edp.bpp;
 			break;
 		}
 	}
@@ -713,7 +712,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
 	 * the number of bytes_per_pixel post-LUT, which we always
 	 * set up for 8-bits of R/G/B, or 3 bytes total.
 	 */
-	intel_dp_compute_m_n(bpp, lane_count,
+	intel_dp_compute_m_n(intel_crtc->bpp, lane_count,
 			     mode->clock, adjusted_mode->clock, &m_n);
 
 	if (HAS_PCH_SPLIT(dev)) {
Signature · 1 line
1.7.4.1
#13 lore raw

Re: [PATCH 6/7] drm/i915: use pipe bpp in DP link bandwidth calculations

Quoted 4 lines · On Tue, 19 Apr 2011 12:12:40 -0700 Jesse Barnes <[email protected]>…

The pipe may be driving various bpp values depending on the display configuration, so take that into account when calculating link bandwidth requirements.

Oops, mixed up this changelog with another piece. The bpp is actually being used to calculate the PLL values here, not bw requirements.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#14 lore raw

PATCH 7/7 drm/i915: use pipe bpp when setting HDMI bpc

In reply to Jesse Barnes

The Intel HDMI encoder can support 8bpc or 12bpc. Set the appropriate value based on the pipe bpp when configuring the output.

---
 drivers/gpu/drm/i915/intel_hdmi.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +5 -0
index a6871d8..5cf7b23 100644
@@ -132,6 +132,11 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
 		sdvox |= SDVO_HSYNC_ACTIVE_HIGH;
 
+	if (intel_crtc->bpp > 24)
+		sdvox |= COLOR_FORMAT_12bpc;
+	else
+		sdvox |= COLOR_FORMAT_8bpc;
+
 	/* Required on CPT */
 	if (intel_hdmi->has_hdmi_sink && HAS_PCH_CPT(dev))
 		sdvox |= HDMI_MODE_SELECT;
Signature · 1 line
1.7.4.1
#15 lore raw

PATCH 1/1 Enable 30-bit depth

In reply to Jesse Barnes

---

This patch is over a year old, caused problems, and probably doesn't even apply anymore. It worked at least a little bit, though. There's a lot more that needs doing, especially in relation to DirectColor mode.

 src/intel_driver.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
src/intel_driver.c +3 -2
index 1ef16ed..99d32b8 100644
@@ -372,10 +372,10 @@ static void intel_check_dri_option(ScrnInfoPtr scrn)
 	if (!xf86ReturnOptValBool(intel->Options, OPTION_DRI, TRUE))
 		intel->directRenderingType = DRI_DISABLED;
 
-	if (scrn->depth != 16 && scrn->depth != 24) {
+	if (scrn->depth != 16 && scrn->depth != 24 && scrn->depth != 30) {
 		xf86DrvMsg(scrn->scrnIndex, X_CONFIG,
 			   "DRI is disabled because it "
-			   "runs only at depths 16 and 24.\n");
+			   "runs only at depths 16, 24, and 30.\n");
 		intel->directRenderingType = DRI_DISABLED;
 	}
 }
@@ -570,6 +570,7 @@ static Bool I830PreInit(ScrnInfoPtr scrn, int flags)
 	case 15:
 	case 16:
 	case 24:
+	case 30:
 		break;
 	default:
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
Signature · 1 line
1.7.4.2
#16 lore raw

Re: [ANCIENT PATCH] Enable 30-bit depth

Quoted 4 lines · On Tue, 19 Apr 2011 15:50:01 -0400 Andy Lutomirski <[email protected]> wrote:

---

This patch is over a year old, caused problems, and probably doesn't even apply anymore. It worked at least a little bit, though. There's a lot more that needs doing, especially in relation to DirectColor mode.

Wouldn't be surprised if you ran into kernel issues as well; the bits have moved around and various paths had issues with non-24bpp formats.

I'll try mucking with the DDX though and see what I can get working...

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center