From d13b24439d322d4bf3b5253b9d2b7651942f28ff Mon Sep 17 00:00:00 2001 From: Zhenyu Wang Date: Thu, 8 Jan 2009 11:45:33 +0800 Subject: [PATCH] sdvo: Add new option for output type setting For SDVO encoder that advertise multiple functions, driver does a capability parsing in a priority order, might cause wrong result against real connect type. This trys to add option to let user setup connect type in early stage. --- man/intel.man | 14 ++++++++++++++ src/i830.h | 4 ++++ src/i830_driver.c | 8 ++++++++ src/i830_sdvo.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 0 deletions(-) diff --git a/man/intel.man b/man/intel.man index 81a94ac..cc9e655 100644 --- a/man/intel.man +++ b/man/intel.man @@ -228,6 +228,20 @@ Instead of depending on SDVO detect status bit to initialize SDVO outputs, this option trys to ignore that status bit and try to probe on all SDVO ports anyway. Try this if some output is not detected on your ADD2 card. Use of this option will slow down your startup time. Default: Disabled. +.TP +.BI "Option \*qSDVOBOutput\*q \*q" string \*q +.TP +.BI "Option \*qSDVOCOutput\*q \*q" string \*q +This option can override SDVO output capability according with current +connection. With multi-function SDVO encoder, board vendor might provide +different output types, e.g chrontel 7021A for VGA or TV output. Driver +has a priority in parsing SDVO output capability, TMDS, TV, VGA and LVDS. +If the result doesn't match the connection, this option can be used to +set that. SDVOB is first SDVO connection, SDVOC is second. Normal config +should only use SDVOBOutput. If unsure, Xorg log should give info on what +to use. Possible setting might be "TV", "VGA-1", "VGA-2", "TMDS-1", "TMDS-2", +"HDMI-1", "HDMI-2", "LVDS-1", "LVDS-2". See next section for more details +on output configuration. .SH OUTPUT CONFIGURATION On 830M and better chipsets, the driver supports runtime configuration of diff --git a/src/i830.h b/src/i830.h index 25bf482..08cd803 100644 --- a/src/i830.h +++ b/src/i830.h @@ -736,6 +736,10 @@ typedef struct _I830Rec { Bool force_sdvo_detect; /** User option to print acceleration fallback info to the server log. */ Bool fallback_debug; + /** User option to override SDVO encoder capability in case default + capability parsing priority result wrong for real output type */ + char *sdvob_output; + char *sdvoc_output; } I830Rec; #define I830PTR(p) ((I830Ptr)((p)->driverPrivate)) diff --git a/src/i830_driver.c b/src/i830_driver.c index 3e27b07..887db21 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -315,6 +315,8 @@ typedef enum { #endif OPTION_FORCE_SDVO_DETECT, OPTION_PREFER_OVERLAY, + OPTION_SDVOB_OUTPUT, + OPTION_SDVOC_OUTPUT, } I830Opts; static OptionInfoRec I830Options[] = { @@ -343,6 +345,8 @@ static OptionInfoRec I830Options[] = { #endif {OPTION_FORCE_SDVO_DETECT, "ForceSDVODetect", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_PREFER_OVERLAY, "XvPreferOverlay", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_SDVOB_OUTPUT, "SDVOBOutput", OPTV_ANYSTR, {0}, FALSE}, + {OPTION_SDVOC_OUTPUT, "SDVOCOutput", OPTV_ANYSTR, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; /* *INDENT-ON* */ @@ -1564,6 +1568,10 @@ I830GetEarlyOptions(ScrnInfoPtr pScrn) pI830->force_sdvo_detect = FALSE; } + pI830->sdvob_output = (char *)xf86GetOptValString(pI830->Options, + OPTION_SDVOB_OUTPUT); + pI830->sdvoc_output = (char *)xf86GetOptValString(pI830->Options, + OPTION_SDVOC_OUTPUT); return TRUE; } diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c index 0750166..fb5dcbf 100644 --- a/src/i830_sdvo.c +++ b/src/i830_sdvo.c @@ -1749,9 +1749,55 @@ i830_sdvo_get_digital_encoding_mode(xf86OutputPtr output) return TRUE; } +static void +i830_sdvo_user_config_output (ScrnInfoPtr pScrn, xf86OutputPtr output) +{ + I830Ptr pI830 = I830PTR(pScrn); + I830OutputPrivatePtr intel_output = output->driver_private; + struct i830_sdvo_priv *dev_priv = intel_output->dev_priv; + uint16_t cap; + char *s; + + if (dev_priv->output_device == SDVOB) + s = pI830->sdvob_output; + else + s = pI830->sdvoc_output; + + if (s == NULL) + return; + + if (!strcmp(s, "TV")) + cap = SDVO_OUTPUT_SVID0; + else if (!strcmp(s, "VGA-1")) + cap = SDVO_OUTPUT_RGB0; + else if (!strcmp(s, "VGA-2")) + cap = SDVO_OUTPUT_RGB1; + else if (!strcmp(s, "TMDS-1") || !strcmp(s, "HDMI-1")) + cap = SDVO_OUTPUT_TMDS0; + else if (!strcmp(s, "TMDS-2") || !strcmp(s, "HDMI-2")) + cap = SDVO_OUTPUT_TMDS1; + else if (!strcmp(s, "LVDS-1")) + cap = SDVO_OUTPUT_LVDS0; + else if (!strcmp(s, "LVDS-2")) + cap = SDVO_OUTPUT_LVDS1; + else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Unknown SDVO output type name\n"); + return; + } + + dev_priv->caps.output_flags = cap; + if (pI830->debug_modes) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "%s: user config output %s\n", + SDVO_NAME(dev_priv), s); + return; +} + Bool i830_sdvo_init(ScrnInfoPtr pScrn, int output_device) { + I830Ptr pI830 = I830PTR(pScrn); xf86OutputPtr output; I830OutputPrivatePtr intel_output; struct i830_sdvo_priv *dev_priv; @@ -1867,6 +1913,8 @@ i830_sdvo_init(ScrnInfoPtr pScrn, int output_device) i830_sdvo_get_capabilities(output, &dev_priv->caps); + i830_sdvo_user_config_output(pScrn, output); + if (dev_priv->caps.output_flags & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) { if (dev_priv->caps.output_flags & SDVO_OUTPUT_TMDS0) -- 1.5.6.5