[Intel-gfx] [PATCH 1/2] SDVO: use EDID info for detect in digital output

Zhenyu Wang zhenyu.z.wang at intel.com
Mon Jan 5 09:35:33 CET 2009


EDID info is required for digital output and this trys
to check digital type within EDID info too for monitor
detection. For SDVO DVI-I, this can detect and drive
output right in VGA connection.
---
 src/i830_sdvo.c |   30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/src/i830_sdvo.c b/src/i830_sdvo.c
index 0750166..219eb6a 100644
--- a/src/i830_sdvo.c
+++ b/src/i830_sdvo.c
@@ -1449,6 +1449,18 @@ i830_sdvo_dump(ScrnInfoPtr pScrn)
     }
 }
 
+static Bool
+i830_sdvo_digital_output(xf86OutputPtr output)
+{
+    I830OutputPrivatePtr intel_output = output->driver_private;
+    struct i830_sdvo_priv *dev_priv = intel_output->dev_priv;
+
+    if (dev_priv->caps.output_flags & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1))
+	return TRUE;
+    else
+	return FALSE;
+}
+
 /**
  * Asks the SDVO device if any displays are currently connected.
  *
@@ -1461,6 +1473,8 @@ i830_sdvo_dump(ScrnInfoPtr pScrn)
 static xf86OutputStatus
 i830_sdvo_detect(xf86OutputPtr output)
 {
+    I830OutputPrivatePtr intel_output = output->driver_private;
+    xf86MonPtr edid_mon;
     uint8_t response[2];
     uint8_t status;
 
@@ -1470,10 +1484,20 @@ i830_sdvo_detect(xf86OutputPtr output)
     if (status != SDVO_CMD_STATUS_SUCCESS)
 	return XF86OutputStatusUnknown;
 
-    if (response[0] != 0 || response[1] != 0)
-	return XF86OutputStatusConnected;
-    else
+    if (response[0] == 0 && response[1] == 0)
 	return XF86OutputStatusDisconnected;
+
+    if (i830_sdvo_digital_output(output)) {
+	/* EDID is required and type should be digital, otherwise
+	   we don't assume it's connected. */
+	edid_mon = xf86OutputGetEDID (output, intel_output->pDDCBus);
+	if (!edid_mon || !DIGITAL(edid_mon->features.input_type)) {
+	    xfree(edid_mon);
+	    return XF86OutputStatusDisconnected;
+	}
+	xfree(edid_mon);
+    }
+    return XF86OutputStatusConnected;
 }
 
 static DisplayModePtr
-- 
1.5.6.5




More information about the Intel-gfx mailing list