From 8067368e10330a67550f9e3ee353da858266a6eb Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 2 Feb 2015 02:58:59 +0100 Subject: 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 --- sys/src/cmd/aux/vga/igfx.c | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) (limited to 'sys/src/cmd/aux/vga/igfx.c') 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; xnpipe; 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 = { -- cgit v1.2.3