[Intel-gfx] [PATCH 3/3] set hdtv broadcast mode for hdmi

Ma Ling ling.ma at intel.com
Mon Feb 23 08:07:03 CET 2009


enable hdtv broadcast color mode for corresponding hdmi output

---
 src/i830_hdmi.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/src/i830_hdmi.c b/src/i830_hdmi.c
index 05aa9ac..d11c38f 100644
--- a/src/i830_hdmi.c
+++ b/src/i830_hdmi.c
@@ -40,6 +40,12 @@ struct i830_hdmi_priv {
     uint32_t save_SDVO;
 
     Bool has_hdmi_sink;
+
+    /**
+     * This is set if user requir hdtv use broadcast rgb.
+     */
+    Bool hdtv_use_broadcast;
+
 };
 
 static int
@@ -87,6 +93,10 @@ i830_hdmi_mode_set(xf86OutputPtr output, DisplayModePtr mode,
     if (intel_crtc->pipe == 1)
 	sdvox |= SDVO_PIPE_B_SELECT;
 
+    /* apply 16-235 color range to the output */
+    if (dev_priv->hdtv_use_broadcast)
+	sdvox |= SDVO_COLOR_RANGE;
+
     OUTREG(dev_priv->output_reg, sdvox);
     POSTING_READ(dev_priv->output_reg);
 }
@@ -228,6 +238,20 @@ static const xf86OutputFuncsRec i830_hdmi_output_funcs = {
     .destroy = i830_hdmi_destroy
 };
 
+static void i830_hdmi_hdtv_use_broadcast(xf86OutputPtr output)
+{
+    ScrnInfoPtr pScrn = output->scrn;
+    I830Ptr pI830 = I830PTR(pScrn);
+    I830OutputPrivatePtr    intel_output = output->driver_private;
+    struct i830_hdmi_priv   *dev_priv = intel_output->dev_priv;
+
+    /* only R G B are 8bit color mode*/
+    if (pScrn->depth == 24 &&
+	/* only DevCL and DevCTG */
+	(IS_I965G(pI830) || IS_GM45(pI830)))
+        dev_priv->hdtv_use_broadcast = TRUE;
+}
+
 void
 i830_hdmi_init(ScrnInfoPtr pScrn, int output_reg)
 {
@@ -264,6 +288,14 @@ i830_hdmi_init(ScrnInfoPtr pScrn, int output_reg)
     else
 	I830I2CInit(pScrn, &intel_output->pDDCBus, GPIOD, "HDMIDDC_C");
 
+    /* apply 16-235 color range to the output */
+    if ((I830PTR(pScrn)->hdtv_1_use_broadcast &&
+	(strcmp(output->name, "HDMI-1") == 0)))
+	i830_hdmi_hdtv_use_broadcast(output);
+    else if ((I830PTR(pScrn)->hdtv_2_use_broadcast &&
+	(strcmp(output->name, "HDMI-2") == 0)))
+	i830_hdmi_hdtv_use_broadcast(output);
+
     xf86DrvMsg(pScrn->scrnIndex, X_INFO,
 	       "HDMI output %d detected\n",
 	       (output_reg == SDVOB) ? 1 : 2);
-- 
1.5.4.4






More information about the Intel-gfx mailing list