[PATCH 8/9] handle cea-ext data block in interpret_edid.c

Ma Ling ling.ma at intel.com
Thu Jan 22 00:10:37 PST 2009


handle CEA extension data block from CEA extension

---
 hw/xfree86/ddc/interpret_edid.c |   57 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index 327f7d1..ef37a60 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -159,6 +159,63 @@ void xf86ForEachDetailedBlock(xf86MonPtr mon,
     }
 }
 
+static void handle_cea_data_block(Uchar *ext, int data_type, void *data)
+{
+    struct cea_ext_body *cea;
+    struct cea_data_blk *data_collection;
+    struct cea_data_blk *data_end;
+
+    cea = (struct cea_ext_body *)ext;
+
+    if (cea->dt_offset <= CEA_EXT_MIN_DATA_OFFSET)
+        return;
+
+    data_collection = &cea->data_collection;
+    data_end = (struct cea_data_blk *)(cea->dt_offset + ext);
+
+    for ( ;data_collection < data_end;) {
+
+	if (data_type == data_collection->tag) {
+	    *((struct cea_data_blk **)data) = data_collection;
+	    return;
+	}
+	data_collection = (unsigned char *)data_collection +
+	    data_collection->len + 1 ;
+    }
+
+}
+
+void xf86FetchDataBlock(xf86MonPtr mon,
+                        int ext_type, int data_type,
+                        void *data)
+{
+    int i;
+    Uchar *ext;
+
+    if (mon == NULL)
+	return;
+
+    for (i = 0; i < mon->no_sections; i++) {
+	ext = mon->rawData + EDID1_LEN * (i + 1);
+	if (ext[EXT_TAG]  == ext_type)
+	    break;
+    }
+    /* return if don't find corresponding extension type */
+    if (i == mon->no_sections)
+	return;
+
+    switch (ext[EXT_TAG]){
+    case CEA_EXT:
+	handle_cea_data_block(ext, data_type, data);
+	break;
+    case VTB_EXT:
+    case DI_EXT:
+    case LS_EXT:
+    case MI_EXT:
+	break;
+    }
+}
+
 struct det_hv_parameter {
     int real_hsize;
     int real_vsize;
-- 
1.5.4.4






More information about the xorg mailing list