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/igfx.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/igfx.c')
-rw-r--r-- | sys/src/cmd/aux/vga/igfx.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/sys/src/cmd/aux/vga/igfx.c b/sys/src/cmd/aux/vga/igfx.c index 9367d1788..4b8a3900e 100644 --- a/sys/src/cmd/aux/vga/igfx.c +++ b/sys/src/cmd/aux/vga/igfx.c @@ -4,7 +4,6 @@ #include "pci.h" #include "vga.h" -#include "edid.h" typedef struct Reg Reg; typedef struct Dpll Dpll; @@ -156,9 +155,6 @@ struct Igfx { Reg lvds; Reg vgacntrl; - - Edid *adpaedid; - Edid *lvdsedid; }; static u32int @@ -465,8 +461,13 @@ snarf(Vga* vga, Ctlr* ctlr) for(x=0; x<igfx->npipe; x++) snarfpipe(igfx, x); - igfx->adpaedid = snarfedid(igfx, 2, 0x50); - igfx->lvdsedid = snarfedid(igfx, 3, 0x50); + vga->edid[0] = snarfedid(igfx, 2, 0x50); + vga->edid[1] = snarfedid(igfx, 3, 0x50); + if(vga->edid[1] != nil){ + Modelist *l; + for(l = vga->edid[1]->modelist; l != nil; l = l->next) + l->attr = mkattr(l->attr, "lcd", "1"); + } ctlr->flag |= Fsnarf; } @@ -1332,15 +1333,6 @@ dump(Vga* vga, Ctlr* ctlr) dumpreg(ctlr->name, "sdvoc", igfx->sdvoc); dumpreg(ctlr->name, "vgacntrl", igfx->vgacntrl); - - if(igfx->adpaedid != nil){ - Bprint(&stdout, "edid adpa\n"); - printedid(igfx->adpaedid); - } - if(igfx->lvdsedid != nil){ - Bprint(&stdout, "edid lvds\n"); - printedid(igfx->lvdsedid); - } } enum { @@ -1404,7 +1396,6 @@ static Edid* snarfedid(Igfx *igfx, int port, int addr) { uchar buf[256], tmp[256]; - Edid *e; int i; /* read twice */ @@ -1424,13 +1415,7 @@ snarfedid(Igfx *igfx, int port, int addr) } } - e = malloc(sizeof(Edid)); - if(parseedid128(e, buf) != 0){ - free(e); - return nil; - } - - return e; + return parseedid128(buf); } Ctlr igfx = { |