aboutsummaryrefslogtreecommitdiffstats
path: root/vbe.c
diff options
context:
space:
mode:
Diffstat (limited to 'vbe.c')
-rw-r--r--vbe.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/vbe.c b/vbe.c
index 8eb74fc..56882d3 100644
--- a/vbe.c
+++ b/vbe.c
@@ -209,11 +209,10 @@ static int vbe_check_ddc_capabilities(int port)
return 1;
}
-static int vbe_get_edid_info(char *edid, int port)
+static int vbe_get_edid_info(char *edid, int port, int block)
{
int i;
unsigned char *mem;
- const int EDID_BLOCK_SIZE = 128;
struct LRMI_regs regs;
/* initialize LRMI */
@@ -235,6 +234,7 @@ static int vbe_get_edid_info(char *edid, int port)
regs.eax = 0x4f15;
regs.ebx = 0x0001;
regs.ecx = port;
+ regs.edx = block;
regs.es = (uintptr_t)(mem - LRMI_base_addr()) >> 4;
regs.edi = (uintptr_t)(mem - LRMI_base_addr()) & 0x0f;
@@ -262,6 +262,7 @@ static int vbe_get_edid_info(char *edid, int port)
int get_edid(char *edid, int port)
{
+ int i, extensions;
int ok = 0;
if (getuid() != 0) {
@@ -272,9 +273,26 @@ int get_edid(char *edid, int port)
ok =
(box_is_xbox() || (vbe_check_vbe_info() &&
vbe_check_ddc_capabilities(port))) &&
- vbe_get_edid_info(edid, port);
+ vbe_get_edid_info(edid, port, 0);
- return ok ? 128 : 0;
+ if (!ok)
+ return 0;
+
+ extensions = ((unsigned char*)edid)[126];
+ if (extensions > MAX_EXTENSION_COUNT) {
+ log_err("EDID: Reported %d extensions, only reading %d\n",
+ extensions, MAX_EXTENSION_COUNT);
+ extensions = MAX_EXTENSION_COUNT;
+ }
+
+ for (i = 1; i <= extensions; i++) {
+ if (!vbe_get_edid_info(edid + i * EDID_BLOCK_SIZE, port, i)) {
+ log_err("EDID: Failure reading extension block %d\n", i);
+ break;
+ }
+ }
+
+ return i * EDID_BLOCK_SIZE;
}
int box_is_xbox() {