diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-02-02 02:58:59 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-02-02 02:58:59 +0100 |
commit | 8067368e10330a67550f9e3ee353da858266a6eb (patch) | |
tree | da29460c6810b48ee67b2d330c04a22a3ab35379 /sys/src/cmd/aux/vga/edid.c | |
parent | e34fa15921cd76d78e7adc28e471204de036d66a (diff) |
aux/vga: use optional edid information to determine mode when vgadb fails
igfx and vesa can determine monitor timing information from ddc
and store the edid info for connected monitors in vga->edid[].
when monitor type cannot be found in vgadb, we consult the edid
information and make a mode based on the edid info.
this avoids having to maintain a vgadb entry for each monitor.
monitor can be set to "[width]x[height]@[freq]Hz" for a specific
edid setting. when not found, a mode is searched based on the
size.
so the following should work:
aux/vga -m 1366x768@60Hz -l 1366x768x32
aux/vga -m auto -l 1366x768x32
Diffstat (limited to 'sys/src/cmd/aux/vga/edid.c')
-rw-r--r-- | sys/src/cmd/aux/vga/edid.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/src/cmd/aux/vga/edid.c b/sys/src/cmd/aux/vga/edid.c index ba95d2611..e0ac6ce58 100644 --- a/sys/src/cmd/aux/vga/edid.c +++ b/sys/src/cmd/aux/vga/edid.c @@ -5,7 +5,6 @@ #include "pci.h" #include "vga.h" -#include "edid.h" static Modelist* addmode(Modelist *l, Mode m) @@ -182,28 +181,31 @@ decodesti(Mode *m, uchar *p) return vesalookup(m, str); } -int -parseedid128(Edid *e, void *v) +Edid* +parseedid128(void *v) { static uchar magic[8] = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 }; uchar *p, *q, sum; int dpms, estab, i, m, vid; Mode mode; + Edid *e; - memset(e, 0, sizeof *e); + e = alloc(sizeof(Edid)); p = (uchar*)v; if(memcmp(p, magic, 8) != 0) { + free(e); werrstr("bad edid header"); - return -1; + return nil; } sum = 0; for(i=0; i<128; i++) sum += p[i]; if(sum != 0) { + free(e); werrstr("bad edid checksum"); - return -1; + return nil; } p += 8; @@ -342,7 +344,7 @@ parseedid128(Edid *e, void *v) } assert(p == (uchar*)v+8+10+2+5+10+3+16+72); - return 0; + return e; } Flag edidflags[] = { |