xserver: Branch 'master'
Adam Jackson
ajax at kemper.freedesktop.org
Mon Nov 3 11:55:46 PST 2008
hw/xfree86/ddc/interpret_edid.c | 53 ++++++++++++++++++++++++++++++++++++++++
hw/xfree86/ddc/xf86DDC.h | 5 ++-
hw/xfree86/loader/xf86sym.c | 1
3 files changed, 57 insertions(+), 2 deletions(-)
New commits:
commit 4cf2f4172abc4bf848c1726e6dac535713e08f0b
Author: Adam Jackson <ajax at redhat.com>
Date: Mon Nov 3 12:50:28 2008 -0500
Add xf86MonitorIsHDMI() helper.
diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index fbb17b1..c4d8963 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -459,3 +459,56 @@ validate_version(int scrnIndex, struct edid_version *r)
return TRUE;
}
+
+/*
+ * Returns true if HDMI, false if definitely not or unknown.
+ */
+_X_EXPORT Bool
+xf86MonitorIsHDMI(xf86MonPtr mon)
+{
+ int i = 0, version, offset;
+ char *edid = NULL;
+
+ if (!mon)
+ return FALSE;
+
+ if (!(mon->flags & EDID_COMPLETE_RAWDATA))
+ return FALSE;
+
+ if (!mon->no_sections)
+ return FALSE;
+
+ edid = (char *)mon->rawData;
+ if (!edid)
+ return FALSE;
+
+ /* find the CEA extension block */
+ for (i = 1; i <= mon->no_sections; i++)
+ if (edid[i * 128] == 0x02)
+ break;
+ if (i == mon->no_sections + 1)
+ return FALSE;
+ edid += (i * 128);
+
+ version = edid[1];
+ offset = edid[2];
+ if (version < 3 || offset < 4)
+ return FALSE;
+
+ /* walk the cea data blocks */
+ for (i = 4; i < offset; i += (edid[i] & 0x1f) + 1) {
+ char *x = edid + i;
+
+ /* find a vendor specific block */
+ if ((x[0] & 0xe0) >> 5 == 0x03) {
+ int oui = (x[3] << 16) + (x[2] << 8) + x[1];
+
+ /* find the HDMI vendor OUI */
+ if (oui == 0x000c03)
+ return TRUE;
+ }
+ }
+
+ /* guess it's not HDMI after all */
+ return FALSE;
+}
diff --git a/hw/xfree86/ddc/xf86DDC.h b/hw/xfree86/ddc/xf86DDC.h
index 42d9ce6..3172b55 100644
--- a/hw/xfree86/ddc/xf86DDC.h
+++ b/hw/xfree86/ddc/xf86DDC.h
@@ -59,6 +59,7 @@ extern Bool xf86SetDDCproperties(
DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
-#endif
-
+extern Bool
+xf86MonitorIsHDMI(xf86MonPtr mon);
+#endif
diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c
index 4891be2..d3a7807 100644
--- a/hw/xfree86/loader/xf86sym.c
+++ b/hw/xfree86/loader/xf86sym.c
@@ -922,6 +922,7 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86DoEEDID)
SYMFUNC(xf86DDCMonitorSet)
SYMFUNC(xf86SetDDCproperties)
+ SYMFUNC(xf86MonitorIsHDMI)
SYMFUNC(xf86CreateI2CBusRec)
SYMFUNC(xf86CreateI2CDevRec)
More information about the xorg-commit
mailing list