[Intel-gfx] [PATCH] Set TV format according to connector type

ling.ma at intel.com ling.ma at intel.com
Mon Jul 6 10:48:28 CEST 2009


In TV code we set NTSC-M is default format when TV start.
However if our connector type is Component, NTSC or PAL should
not be default format. This patch try to find appropriate format
for current connector type i.e. NTSC/PAL for S-VIDEO or Composit,
the others for Component.
 
Signed-off-by: Ma Ling <ling.ma at intel.com>
---
 src/i830_tv.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/src/i830_tv.c b/src/i830_tv.c
index 7082aba..fd71af8 100644
--- a/src/i830_tv.c
+++ b/src/i830_tv.c
@@ -943,6 +943,39 @@ i830_tv_mode_lookup (char *tv_format)
     return NULL;
 }
 
+/* We will set right tv format according to DAC connection:
+ * NTSC and PAL are for SVIDOE or COMPOSIT,
+ * the others are for COMPONIENT.
+ */
+static void
+i830_tv_find_tv_format_for_dac(xf86OutputPtr output)
+{
+    I830OutputPrivatePtr    intel_output = output->driver_private;
+    struct i830_tv_priv	    *dev_priv = intel_output->dev_priv;
+    const tv_mode_t         *tv_mode = i830_tv_mode_lookup(dev_priv->tv_format);
+    int  i;
+    Bool component = FALSE;
+
+    /* TV format matchs connector type */
+    if (tv_mode->component_only == (dev_priv->type == TV_TYPE_COMPONENT))
+	return;
+
+    if (dev_priv->type == TV_TYPE_COMPONENT)
+        component = TRUE;
+
+    for (i = 0; i < NUM_TV_MODES; i++)
+        if (tv_modes[i].component_only == component)
+            break;
+
+    if (i == NUM_TV_MODES)
+        return;
+
+    if (dev_priv->tv_format)
+        xfree(dev_priv->tv_format);
+    dev_priv->tv_format = xalloc(strlen(tv_modes[i].name) + 1);
+    strcpy(dev_priv->tv_format, tv_modes[i].name);
+}
+
 static const tv_mode_t *
 i830_tv_mode_find (xf86OutputPtr output)
 {
@@ -1482,6 +1515,7 @@ i830_tv_detect(xf86OutputPtr output)
 #endif
     }
 
+
     switch (type) {
     case TV_TYPE_NONE:
         return XF86OutputStatusDisconnected;
@@ -1733,6 +1767,7 @@ i830_tv_create_resources(xf86OutputPtr output)
 		   "RRConfigureOutputProperty error, %d\n", err);
     }
 
+    i830_tv_find_tv_format_for_dac(output);
     /* Set the current value of the tv_format property */
     if (!i830_tv_format_set_property (output))
 	xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-- 
1.5.4.4




More information about the Intel-gfx mailing list