ref: 30871030f58f7f845dc5e6301df26acfecd0e5ac
parent: b41ca13526dcdeb526005e5407073c1cbd9b5607
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Feb 5 18:08:46 EST 2015
aux/vga: remove vbs/vbe from mode, use shs/ehs when sync is ment, prefer detailed timing in edid vbs/vbe members in Mode was only used in the vesadb and cannot be changed from vgadb. use shs/ehs in drivers when refering to the horizontal sync pulse. clarify the matter in a comment. link detailed timing modes at the head of the edid modelist. these are the modes we'r interested in, not the ones from vesadb.
--- a/sys/src/cmd/aux/vga/db.c
+++ b/sys/src/cmd/aux/vga/db.c
@@ -423,7 +423,7 @@
mode->shs, mode->shs, mode->ehs, mode->ehs);
Bprint(&stdout, "vt=%d (0x%X), vrs=%d (0x%X), vre=%d (0x%X)\n",
mode->vt, mode->vt, mode->vrs, mode->vrs, mode->vre, mode->vre);
- Bprint(&stdout, "hsync=%d, vsync=%d, interlace=%d\n",
+ Bprint(&stdout, "hsync=%c, vsync=%c, interlace=%c\n",
mode->hsync, mode->vsync, mode->interlace);
for(attr = mode->attr; attr; attr = attr->next)
--- a/sys/src/cmd/aux/vga/edid.c
+++ b/sys/src/cmd/aux/vga/edid.c
@@ -9,22 +9,23 @@
static Modelist*
addmode(Modelist *l, Mode m)
{
+ Modelist *ll;
int rr;
- Modelist **lp;
rr = (m.frequency+m.ht*m.vt/2)/(m.ht*m.vt);
snprint(m.name, sizeof m.name, "%dx%d@%dHz", m.x, m.y, rr);
- for(lp=&l; *lp; lp=&(*lp)->next){
- if(strcmp((*lp)->name, m.name) == 0){
- (*lp)->Mode = m;
+ for(ll = l; ll != nil; ll = ll->next){
+ if(strcmp(ll->name, m.name) == 0){
+ ll->Mode = m;
return l;
}
}
- *lp = alloc(sizeof(**lp));
- (*lp)->Mode = m;
- return l;
+ ll = alloc(sizeof(Modelist));
+ ll->Mode = m;
+ ll->next = l;
+ return ll;
}
/*
@@ -296,6 +297,7 @@
* Standard Timing Identifications: eight 2-byte selectors
* of more standard timings.
*/
+
for(i=0; i<8; i++, p+=2)
if(decodesti(&mode, p+2*i) == 0)
e->modelist = addmode(e->modelist, mode);
@@ -402,13 +404,10 @@
for(l=e->modelist; l; l=l->next){
printitem("edid", l->name);
- Bprint(&stdout, "\n\t\tclock=%g\n"
- "\t\tshb=%d ehb=%d ht=%d\n"
- "\t\tvrs=%d vre=%d vt=%d\n"
- "\t\thsync=%c vsync=%c %s\n",
- l->frequency/1.e6,
- l->shb, l->ehb, l->ht,
- l->vrs, l->vre, l->vt,
+ Bprint(&stdout, "\n\t\tclock=%g\n", l->frequency/1.e6);
+ Bprint(&stdout, "\t\tshb=%d ehb=%d ht=%d\n", l->shb, l->ehb, l->ht);
+ Bprint(&stdout, "\t\tvrs=%d vre=%d vt=%d\n", l->vrs, l->vre, l->vt);
+ Bprint(&stdout, "\t\thsync=%c vsync=%c %s\n",
l->hsync?l->hsync:'?',
l->vsync?l->vsync:'?',
l->interlace?"interlace=v" : "");
--- a/sys/src/cmd/aux/vga/geode.c
+++ b/sys/src/cmd/aux/vga/geode.c
@@ -105,10 +105,7 @@
geode = vga->private;
m = vga->mode;
- m->vbs = m->vrs;
- m->vbe = m->vre;
-
/* there has to be a better solution */
if(m->x < 1024) {
geode->regs[DC_GENERAL_CFG] = LBW_GENERAL;
@@ -136,7 +133,7 @@
geode->regs[DC_H_SYNC_TIMING] = (m->shs - 1) | ((m->ehs - 1) << 16);
geode->regs[DC_V_ACTIVE_TIMING] = (m->y - 1) | ((m->vt - 1) << 16);
geode->regs[DC_V_BLANK_TIMING] = (m->vrs - 1) | ((m->vre - 1) << 16);
- geode->regs[DC_V_SYNC_TIMING] = (m->vbs - 1) | ((m->vbe - 1) << 16);
+ geode->regs[DC_V_SYNC_TIMING] = (m->vrs - 1) | ((m->vre - 1) << 16);
geode->regs[DC_FB_ACTIVE] = (m->x - 1) | ((m->y - 1) << 16);
geode->regs[DC_GFX_PITCH] = geode->regs[DC_LINE_SIZE] = (m->x >> 3) * bpp;
@@ -215,4 +212,4 @@
0,
0,
0,
-};
\ No newline at end of file
+};
--- a/sys/src/cmd/aux/vga/i81x.c
+++ b/sys/src/cmd/aux/vga/i81x.c
@@ -282,9 +282,9 @@
vga->crt[0x39] = ((vga->mode->shb - vga->virtx)>>3 & 0x40) >>6;
// vga->crt[0x39] = (vga->mode->ehb>>9) & 0x01; //dhog
/* Horizontal Sync Start */
- vga->crt[4] = vga->mode->shb>>3 & 0xFF;
+ vga->crt[4] = vga->mode->shs>>3 & 0xFF;
/* Horizontal Sync End */
- vga->crt[5] |= vga->mode->ehb>>3 & 0x1F;
+ vga->crt[5] |= vga->mode->ehs>>3 & 0x1F;
/* Extended Vertical Total (vt) */
vga->crt[6] = (vt - 2) & 0xFF;
vga->crt[0x30] = (vt - 2)>>8 & 0x0F;
--- a/sys/src/cmd/aux/vga/igfx.c
+++ b/sys/src/cmd/aux/vga/igfx.c
@@ -670,7 +670,7 @@
/* trans/pipe timing */
t->ht.v = (m->ht - 1)<<16 | (m->x - 1);
- t->hs.v = (m->ehb - 1)<<16 | (m->shb - 1);
+ t->hs.v = (m->ehs - 1)<<16 | (m->shs - 1);
t->vt.v = (m->vt - 1)<<16 | (m->y - 1);
t->vs.v = (m->vre - 1)<<16 | (m->vrs - 1);
--- a/sys/src/cmd/aux/vga/main.c
+++ b/sys/src/cmd/aux/vga/main.c
@@ -355,6 +355,16 @@
if(vga->mode == nil)
error("main: %s@%s not in %s\n", type, psize, monitordb);
+ /*
+ * because vga programs shb/ehb (Crt02, Crt03) the same as
+ * shs/ehs (Crt04, Crt05), only shb/ehb is specified in vgadb
+ * meaning the horizontal sync pulse start and end position.
+ */
+ if(vga->mode->shs == 0)
+ vga->mode->shs = vga->mode->shb;
+ if(vga->mode->ehs == 0)
+ vga->mode->ehs = vga->mode->ehb;
+
if(virtual){
if((p = strchr(vsize, 'x')) == nil)
error("bad virtual size %s\n", vsize);
--- a/sys/src/cmd/aux/vga/radeon.c
+++ b/sys/src/cmd/aux/vga/radeon.c
@@ -368,11 +368,11 @@
radeon->crtc_h_total_disp = ((mode->ht/8 - 1) & 0x3ff) |
((mode->x/8 - 1) & 0x1ff) << 16;
- hsync_wid = (mode->ehb - mode->shb) / 8;
+ hsync_wid = (mode->ehs - mode->shs) / 8;
if (hsync_wid == 0)
hsync_wid = 1;
- hsync_start = mode->shb - 8 + hsync_fudge;
+ hsync_start = mode->shs - 8 + hsync_fudge;
DBGPRINT("hsync_start=%d hsync_wid=%d hsync_fudge=%d\n",
hsync_start, hsync_wid, hsync_fudge);
@@ -383,7 +383,7 @@
(mode->y - 1) << 16;
vsync_wid = mode->vre - mode->vrs;
- if (!vsync_wid)
+ if (vsync_wid == 0)
vsync_wid = 1;
radeon->crtc_v_sync_strt_wid = (((mode->vrs - 1) & 0xfff) |
--- a/sys/src/cmd/aux/vga/t2r4.c
+++ b/sys/src/cmd/aux/vga/t2r4.c
@@ -192,11 +192,7 @@
}
t2r4->g[CrtHac] = vga->mode->x/crtclocks;
t2r4->g[CrtHbl] = (vga->mode->ht-vga->mode->x)/crtclocks;
- if(vga->mode->shs == 0)
- vga->mode->shs = vga->mode->shb;
t2r4->g[CrtHfp] = (vga->mode->shs-vga->mode->x)/crtclocks;
- if(vga->mode->ehs == 0)
- vga->mode->ehs = vga->mode->ehb;
t2r4->g[CrtHs] = (vga->mode->ehs-vga->mode->shs)/crtclocks;
t2r4->g[CrtVac] = vga->mode->y * zoom;
t2r4->g[CrtVbl] = (vga->mode->vt-vga->mode->y) * zoom;
--- a/sys/src/cmd/aux/vga/vesadb.c
+++ b/sys/src/cmd/aux/vga/vesadb.c
@@ -1,5 +1,3 @@
-// DO NOT EDIT; this file is automatically generated from vesa.txt
-
#include <u.h>
#include <libc.h>
#include <bio.h>
@@ -21,16 +19,12 @@
.y = 480,
.ht = 800,
- .shb = 648,
- .ehb = 648+144,
- .shs = 656,
- .ehs = 656+96,
+ .shb = 656,
+ .ehb = 656+96,
.vt = 525,
.vrs = 490,
.vre = 490+2,
- .vbs = 488,
- .vbe = 488+29,
.frequency = 25175000,
@@ -45,16 +39,12 @@
.y = 480,
.ht = 832,
- .shb = 648,
- .ehb = 648+176,
- .shs = 664,
- .ehs = 664+40,
+ .shb = 664,
+ .ehb = 664+40,
.vt = 520,
.vrs = 489,
.vre = 489+3,
- .vbs = 488,
- .vbe = 488+24,
.frequency = 31500000,
@@ -69,16 +59,12 @@
.y = 480,
.ht = 840,
- .shb = 640,
- .ehb = 640+200,
- .shs = 656,
- .ehs = 656+64,
+ .shb = 656,
+ .ehb = 656+64,
.vt = 500,
.vrs = 481,
.vre = 481+3,
- .vbs = 480,
- .vbe = 480+20,
.frequency = 31500000,
@@ -93,16 +79,12 @@
.y = 480,
.ht = 832,
- .shb = 640,
- .ehb = 640+192,
- .shs = 696,
- .ehs = 696+56,
+ .shb = 696,
+ .ehb = 696+56,
.vt = 509,
.vrs = 481,
.vre = 481+3,
- .vbs = 480,
- .vbe = 480+29,
.frequency = 36000000,
@@ -117,16 +99,12 @@
.y = 600,
.ht = 1024,
- .shb = 800,
- .ehb = 800+224,
- .shs = 824,
- .ehs = 824+72,
+ .shb = 824,
+ .ehb = 824+72,
.vt = 625,
.vrs = 601,
.vre = 601+2,
- .vbs = 600,
- .vbe = 600+25,
.frequency = 36000000,
@@ -141,16 +119,12 @@
.y = 600,
.ht = 1056,
- .shb = 800,
- .ehb = 800+256,
- .shs = 840,
- .ehs = 840+128,
+ .shb = 840,
+ .ehb = 840+128,
.vt = 628,
.vrs = 601,
.vre = 601+4,
- .vbs = 600,
- .vbe = 600+28,
.frequency = 40000000,
@@ -165,16 +139,12 @@
.y = 600,
.ht = 1040,
- .shb = 800,
- .ehb = 800+240,
- .shs = 856,
- .ehs = 856+120,
+ .shb = 856,
+ .ehb = 856+120,
.vt = 666,
.vrs = 637,
.vre = 637+6,
- .vbs = 600,
- .vbe = 600+66,
.frequency = 50000000,
@@ -189,16 +159,12 @@
.y = 600,
.ht = 1056,
- .shb = 800,
- .ehb = 800+256,
- .shs = 816,
- .ehs = 816+80,
+ .shb = 816,
+ .ehb = 816+80,
.vt = 625,
.vrs = 601,
.vre = 601+3,
- .vbs = 600,
- .vbe = 600+25,
.frequency = 49500000,
@@ -213,16 +179,12 @@
.y = 600,
.ht = 1048,
- .shb = 800,
- .ehb = 800+248,
- .shs = 832,
- .ehs = 832+64,
+ .shb = 832,
+ .ehb = 832+64,
.vt = 631,
.vrs = 601,
.vre = 601+3,
- .vbs = 600,
- .vbe = 600+31,
.frequency = 56250000,
@@ -237,16 +199,12 @@
.y = 768,
.ht = 1344,
- .shb = 1024,
- .ehb = 1024+320,
- .shs = 1048,
- .ehs = 1048+136,
+ .shb = 1048,
+ .ehb = 1048+136,
.vt = 806,
.vrs = 771,
.vre = 771+6,
- .vbs = 768,
- .vbe = 768+38,
.frequency = 65000000,
@@ -261,16 +219,12 @@
.y = 768,
.ht = 1328,
- .shb = 1024,
- .ehb = 1024+304,
- .shs = 1048,
- .ehs = 1048+136,
+ .shb = 1048,
+ .ehb = 1048+136,
.vt = 806,
.vrs = 771,
.vre = 771+6,
- .vbs = 768,
- .vbe = 768+38,
.frequency = 75000000,
@@ -285,16 +239,12 @@
.y = 768,
.ht = 1312,
- .shb = 1024,
- .ehb = 1024+288,
- .shs = 1040,
- .ehs = 1040+96,
+ .shb = 1040,
+ .ehb = 1040+96,
.vt = 800,
.vrs = 769,
.vre = 769+3,
- .vbs = 768,
- .vbe = 768+32,
.frequency = 78750000,
@@ -309,16 +259,12 @@
.y = 768,
.ht = 1376,
- .shb = 1024,
- .ehb = 1024+352,
- .shs = 1072,
- .ehs = 1072+96,
+ .shb = 1072,
+ .ehb = 1072+96,
.vt = 808,
.vrs = 769,
.vre = 769+3,
- .vbs = 768,
- .vbe = 768+40,
.frequency = 94500000,
@@ -333,16 +279,12 @@
.y = 864,
.ht = 1600,
- .shb = 1152,
- .ehb = 1152+448,
- .shs = 1216,
- .ehs = 1216+128,
+ .shb = 1216,
+ .ehb = 1216+128,
.vt = 900,
.vrs = 865,
.vre = 865+3,
- .vbs = 864,
- .vbe = 864+36,
.frequency = 108000000,
@@ -357,16 +299,12 @@
.y = 960,
.ht = 1800,
- .shb = 1280,
- .ehb = 1280+520,
- .shs = 1376,
- .ehs = 1376+112,
+ .shb = 1376,
+ .ehb = 1376+112,
.vt = 1000,
.vrs = 961,
.vre = 961+3,
- .vbs = 960,
- .vbe = 960+40,
.frequency = 108000000,
@@ -381,16 +319,12 @@
.y = 960,
.ht = 1728,
- .shb = 1280,
- .ehb = 1280+448,
- .shs = 1344,
- .ehs = 1344+160,
+ .shb = 1344,
+ .ehb = 1344+160,
.vt = 1011,
.vrs = 961,
.vre = 961+3,
- .vbs = 960,
- .vbe = 960+51,
.frequency = 148500000,
@@ -405,16 +339,12 @@
.y = 1024,
.ht = 1688,
- .shb = 1280,
- .ehb = 1280+408,
- .shs = 1328,
- .ehs = 1328+112,
+ .shb = 1328,
+ .ehb = 1328+112,
.vt = 1066,
.vrs = 1025,
.vre = 1025+3,
- .vbs = 1024,
- .vbe = 1024+42,
.frequency = 108000000,
@@ -429,16 +359,12 @@
.y = 1024,
.ht = 1688,
- .shb = 1280,
- .ehb = 1280+408,
- .shs = 1296,
- .ehs = 1296+144,
+ .shb = 1296,
+ .ehb = 1296+144,
.vt = 1066,
.vrs = 1025,
.vre = 1025+3,
- .vbs = 1024,
- .vbe = 1024+42,
.frequency = 135000000,
@@ -453,16 +379,12 @@
.y = 1024,
.ht = 1728,
- .shb = 1280,
- .ehb = 1280+448,
- .shs = 1344,
- .ehs = 1344+160,
+ .shb = 1344,
+ .ehb = 1344+160,
.vt = 1072,
.vrs = 1025,
.vre = 1025+3,
- .vbs = 1024,
- .vbe = 1024+48,
.frequency = 157500000,
@@ -477,16 +399,12 @@
.y = 1200,
.ht = 2160,
- .shb = 1600,
- .ehb = 1600+560,
- .shs = 1664,
- .ehs = 1664+192,
+ .shb = 1664,
+ .ehb = 1664+192,
.vt = 1250,
.vrs = 1201,
.vre = 1201+3,
- .vbs = 1200,
- .vbe = 1200+50,
.frequency = 162000000,
@@ -501,16 +419,12 @@
.y = 1200,
.ht = 2160,
- .shb = 1600,
- .ehb = 1600+560,
- .shs = 1664,
- .ehs = 1664+192,
+ .shb = 1664,
+ .ehb = 1664+192,
.vt = 1250,
.vrs = 1201,
.vre = 1201+3,
- .vbs = 1200,
- .vbe = 1200+50,
.frequency = 175500000,
@@ -525,16 +439,12 @@
.y = 1200,
.ht = 2160,
- .shb = 1600,
- .ehb = 1600+560,
- .shs = 1664,
- .ehs = 1664+192,
+ .shb = 1664,
+ .ehb = 1664+192,
.vt = 1250,
.vrs = 1201,
.vre = 1201+3,
- .vbs = 1200,
- .vbe = 1200+50,
.frequency = 189000000,
@@ -549,16 +459,12 @@
.y = 1200,
.ht = 2160,
- .shb = 1600,
- .ehb = 1600+560,
- .shs = 1664,
- .ehs = 1664+192,
+ .shb = 1664,
+ .ehb = 1664+192,
.vt = 1250,
.vrs = 1201,
.vre = 1201+3,
- .vbs = 1200,
- .vbe = 1200+50,
.frequency = 202500000,
@@ -573,16 +479,12 @@
.y = 1200,
.ht = 2160,
- .shb = 1600,
- .ehb = 1600+560,
- .shs = 1664,
- .ehs = 1664+192,
+ .shb = 1664,
+ .ehb = 1664+192,
.vt = 1250,
.vrs = 1201,
.vre = 1201+3,
- .vbs = 1200,
- .vbe = 1200+50,
.frequency = 229500000,
@@ -597,16 +499,12 @@
.y = 1344,
.ht = 2448,
- .shb = 1792,
- .ehb = 1792+656,
- .shs = 1920,
- .ehs = 1920+200,
+ .shb = 1920,
+ .ehb = 1920+200,
.vt = 1394,
.vrs = 1345,
.vre = 1345+3,
- .vbs = 1344,
- .vbe = 1344+50,
.frequency = 204750000,
@@ -621,16 +519,12 @@
.y = 1344,
.ht = 2456,
- .shb = 1792,
- .ehb = 1792+664,
- .shs = 1888,
- .ehs = 1888+216,
+ .shb = 1888,
+ .ehb = 1888+216,
.vt = 1417,
.vrs = 1345,
.vre = 1345+3,
- .vbs = 1344,
- .vbe = 1344+73,
.frequency = 261000000,
@@ -645,16 +539,12 @@
.y = 1392,
.ht = 2528,
- .shb = 1856,
- .ehb = 1856+672,
- .shs = 1952,
- .ehs = 1952+224,
+ .shb = 1952,
+ .ehb = 1952+224,
.vt = 1439,
.vrs = 1393,
.vre = 1393+3,
- .vbs = 1392,
- .vbe = 1392+47,
.frequency = 218250000,
@@ -669,16 +559,12 @@
.y = 1392,
.ht = 2560,
- .shb = 1856,
- .ehb = 1856+704,
- .shs = 1984,
- .ehs = 1984+224,
+ .shb = 1984,
+ .ehb = 1984+224,
.vt = 1500,
.vrs = 1393,
.vre = 1393+3,
- .vbs = 1392,
- .vbe = 1392+108,
.frequency = 288000000,
@@ -693,16 +579,12 @@
.y = 1440,
.ht = 2600,
- .shb = 1920,
- .ehb = 1920+680,
- .shs = 2048,
- .ehs = 2048+208,
+ .shb = 2048,
+ .ehb = 2048+208,
.vt = 1500,
.vrs = 1441,
.vre = 1441+3,
- .vbs = 1440,
- .vbe = 1440+60,
.frequency = 234000000,
@@ -717,16 +599,12 @@
.y = 1440,
.ht = 2640,
- .shb = 1920,
- .ehb = 1920+720,
- .shs = 2064,
- .ehs = 2064+224,
+ .shb = 2064,
+ .ehb = 2064+224,
.vt = 1500,
.vrs = 1441,
.vre = 1441+3,
- .vbs = 1440,
- .vbe = 1440+60,
.frequency = 297000000,
--- a/sys/src/cmd/aux/vga/vga.c
+++ b/sys/src/cmd/aux/vga/vga.c
@@ -249,11 +249,7 @@
if(tmp & 0x20)
vga->crt[0x05] |= 0x80;
- if(mode->shs == 0)
- mode->shs = mode->shb;
vga->crt[0x04] = mode->shs>>3;
- if(mode->ehs == 0)
- mode->ehs = mode->ehb;
vga->crt[0x05] |= ((mode->ehs>>3) & 0x1F);
/*
--- a/sys/src/cmd/aux/vga/vga.h
+++ b/sys/src/cmd/aux/vga/vga.h
@@ -111,9 +111,6 @@
int vt; /* Vertical Total (Crt06) */
int vrs; /* Vertical Retrace Start (Crt10) */
int vre; /* Vertical Retrace End (Crt11) */
-
- int vbs; /* optional Vertical Blank Start */
- int vbe; /* optional Vertical Blank End */
ulong videobw;
--
⑨