sync vga Reference: /n/atom/patch/applied2013/vgasync Date: Thu Jun 20 00:44:08 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/cmd/aux/vga/data.c Thu Jun 20 00:43:53 2013 +++ /sys/src/cmd/aux/vga/data.c Thu Jun 20 00:43:53 2013 @@ -47,8 +47,8 @@ &mga2164whwgc, /* hwgc */ &neomagic, /* ctlr */ &neomagichwgc, /* hwgc */ -// &nvidia, /* ctlr */ -// &nvidiahwgc, /* hwgc */ + &nvidia, /* ctlr */ + &nvidiahwgc, /* hwgc */ &radeon, /* ctlr */ &radeonhwgc, /* hwgc */ &palette, /* ctlr */ --- /sys/src/cmd/aux/vga/main.c Thu Jun 20 00:43:53 2013 +++ /sys/src/cmd/aux/vga/main.c Thu Jun 20 00:43:53 2013 @@ -328,9 +328,11 @@ freq = vga->f[1]; rr = (double)freq/(vga->mode->ht*vga->mode->vt); - if(rr > 85.0) /* >85Hz is ridiculous */ + trace("refresh %.1g\n", rr); + if(rr > 85.0){ /* >85Hz is ridiculous */ + fprint(2, "reducing %.1g to 85Hz\n", rr); rr = 85.0; - + } bytes = (vga->mode->x*vga->mode->y*vga->mode->z)/8; membw = rr*bytes; if(vga->membw != 0 && membw > vga->membw){ --- /sys/src/cmd/aux/vga/nvidia.c Thu Jun 20 00:43:53 2013 +++ /sys/src/cmd/aux/vga/nvidia.c Thu Jun 20 00:43:53 2013 @@ -1,4 +1,3 @@ - /* Portions of this file derived from work with the following copyright */ /***************************************************************************\ @@ -95,8 +94,6 @@ ulong dither; ulong crtcsync; ulong displayV; - ulong usablesz; - ulong arb[2]; int islcd; int fpwidth; @@ -160,7 +157,7 @@ nv->pfb = mmio+0x00100000/4; nv->pramdac = mmio+0x00680000/4; nv->pextdev = mmio+0x00101000/4; - nv->pmc = mmio+0x00000000/4; + nv->pmc = mmio; nv->ptimer = mmio+0x00009000/4; nv->pfifo = mmio+0x00002000/4; nv->pramin = mmio+0x00710000/4; @@ -198,24 +195,24 @@ case 0x0340: /* GeForceFX 5700 */ nv->arch = 30; break; - case 0x0040: /* GeForce 6800 */ + case 0x0040: case 0x0090: case 0x00C0: case 0x0120: case 0x0130: case 0x0140: /* GeForce 6600 */ - case 0x0160: /* GeForce 6200 */ - case 0x01D0: /* GeForce 7200, 7300, 7400 */ - case 0x0210: /* GeForce 6200 */ - case 0x0220: - case 0x0290: /* GeForce 7900 */ - case 0x0390: /* GeForce 6100 */ - case 0x03D0: /* ? */ - case 0x0240: /* nForce 4 6100/6150 */ + case 0x0160: + case 0x01D0: + case 0x0210: + case 0x0290: /* nvidia 7950 */ + case 0x0390: + case 0x0220: /* nvidia 6200 */ nv->arch = 40; break; default: - break; + error("%s: DID %#4.4ux - %#ux unsupported\n", + ctlr->name, nv->did, (nv->did & 0x0ff0)); + break; } } nv = vga->private; @@ -226,23 +223,29 @@ */ vgaxo(Crtx, 0x1F, 0x57); - nv->twoheads = nv->arch >= 10 && - implementation != 0x0100 && - implementation != 0x0150 && - implementation != 0x01A0 && - implementation != 0x0200; - - nv->twostagepll = implementation == 0x0310 || - implementation == 0x0340 || - nv->arch >= 40; - - if(nv->pextdev[0x00000000] & (1<<6)) + if (nv->pextdev[0] & 0x40) nv->crystalfreq = RefFreq; else nv->crystalfreq = 13500000; - if(nv->twoheads && implementation != 0x0110) - if(nv->pextdev[0x00000000] & (1 << 22)) + if ((implementation == 0x0170) || + (implementation == 0x0180) || + (implementation == 0x01F0) || + (implementation >= 0x0250)) + if(nv->pextdev[0] & (1 << 22)) + nv->crystalfreq = 27000000; + + nv->twoheads = (nv->arch >= 10) && + (implementation != 0x0100) && + (implementation != 0x0150) && + (implementation != 0x01A0) && + (implementation != 0x0200); + + nv->twostagepll = (implementation == 0x0310) || + (implementation == 0x0340) || (nv->arch >= 40); + + if (nv->twoheads && (implementation != 0x0110)) + if(nv->pextdev[0] & (1 << 22)) nv->crystalfreq = 27000000; /* laptop chips */ @@ -282,16 +285,12 @@ case 0x034C: case 0x0160: case 0x0166: - case 0x0169: - case 0x016B: - case 0x016C: - case 0x016D: case 0x00C8: case 0x00CC: case 0x0144: case 0x0146: case 0x0148: - case 0x0149: + case 0x01D7: nv->islcd = 1; break; default: @@ -299,10 +298,10 @@ } if (nv->arch == 4) { - tmp = nv->pfb[0x00000000]; - if (tmp & 0x0100) { - vga->vmz = ((tmp >> 12) & 0x0F) * 1024 + 1024 * 2; - } else { + tmp = nv->pfb[0]; + if (tmp & 0x0100) + vga->vmz = ((tmp >> 12) & 0x0F)*1024 + 2*1024; + else { tmp &= 0x03; if (tmp) vga->vmz = (1024*1024*2) << tmp; @@ -326,7 +325,7 @@ break; } tmp = pcicfgr32(p, 0x84); - vga->vmz = (((tmp >> 4) & 127) + 1) * 1024 * 1024; + vga->vmz = (((tmp >> 4) & 127) + 1) * 1024*1024; } else { tmp = (nv->pfb[0x0000020C/4] >> 20) & 0xFFF; if (tmp == 0) @@ -336,10 +335,6 @@ nv->repaint0 = vgaxi(Crtx, 0x19); nv->repaint1 = vgaxi(Crtx, 0x1A); - nv->arb[0] = vgaxi(Crtx, 0x1B); - nv->arb[1] = vgaxi(Crtx, 0x20); - if(nv->arch >= 30) - nv->arb[1] |= vgaxi(Crtx, 0x47) << 8; // xf86 uses 1 bit, but must be bug since it uses 0x480 nv->screen = vgaxi(Crtx, 0x25); nv->pixel = vgaxi(Crtx, 0x28); nv->horiz = vgaxi(Crtx, 0x2D); @@ -348,21 +343,20 @@ nv->cursor2 = vgaxi(Crtx, 0x2F); nv->interlace = vgaxi(Crtx, 0x39); - nv->vpll = nv->pramdac[0x00000508/4]; + nv->vpll = nv->pramdac[0x508/4]; if (nv->twoheads) - nv->vpll2 = nv->pramdac[0x00000520/4]; + nv->vpll2 = nv->pramdac[0x520/4]; if (nv->twostagepll) { - nv->vpllB = nv->pramdac[0x00000578/4]; - nv->vpll2B = nv->pramdac[0x0000057C/4]; + nv->vpllB = nv->pramdac[0x578/4]; + nv->vpll2B = nv->pramdac[0x57C/4]; } - nv->pllsel = nv->pramdac[0x0000050C/4]; - nv->general = nv->pramdac[0x00000600/4]; - nv->scale = nv->pramdac[0x00000848/4]; - nv->config = nv->pfb[0x00000200/4]; + nv->pllsel = nv->pramdac[0x50C/4]; + nv->general = nv->pramdac[0x600/4]; + nv->scale = nv->pramdac[0x848/4]; + nv->config = nv->pfb[0x200/4]; - if (nv->pixel & 0x80){ + if (nv->pixel & 0x80) nv->islcd = 1; - } if (nv->arch >= 10) { if (nv->twoheads) { @@ -376,6 +370,10 @@ nv->dither = nv->pramdac[0x0528/4]; else if (nv->twoheads) nv->dither = nv->pramdac[0x083C/4]; + if(nv->islcd){ + nv->timingH = vgaxi(Crtx, 0x53); + nv->timingV = vgaxi(Crtx, 0x54); + } } /* @@ -399,127 +397,70 @@ ctlr->flag |= Hlinear|Foptions; } -/* calculations in KHz to avoid overflow */ -enum{ - KHz = 1000, -}; - -static void -clock1stage(ulong vclk, Vga* vga, Nvidia *nv) -{ - ulong m0, ν, Δ, Δ0, f, m, n, p; - - Δ0 = ~0; - vclk /= KHz; - ν = nv->crystalfreq/KHz; - - vga->p[1] = 4; - m0 = 7; - vga->m[1] = 13; - if(ν != 13500){ - m0++; - vga->m[1]++; - } - vga->f[1] = 350000000; - - for(p = 0; p <= vga->p[1]; p++){ - f = vclk< 350000) - continue; - for(m = m0; m <= vga->m[1]; m++){ - n = ((vclk< 255) - continue; - f = ν*n/m>>p; - if(f > vclk) - Δ = f-vclk; - else - Δ = vclk-f; - if(Δ && Δ >= Δ0) - continue; -print("bzzt!\n"); - vga->n[0] = n; - vga->m[0] = m; - vga->p[0] = p; - vga->d[0] = Δ; - Δ0 = Δ; - print("n = %uld; m = %uld; p = %uld; d = %uld; %uld (%uld)\n", n, m, p, Δ, vga->f[0], vclk); - } - } - } - -static void -clock2stage(ulong vclk, Vga* vga, Nvidia *nv) -{ - ulong ν, Δ, Δ0, f, m, n, p; - - Δ0 = ~0; - vclk /= KHz; - ν = nv->crystalfreq/KHz<<2; - vga->p[1] = 6; - vga->m[1] = 13; - vga->f[1] = 400000*KHz<<2; - - for(p = 0; p <= vga->p[1]; p++){ - f = vclk< 1000000) - continue; - for(m = 1; m <= vga->m[1]; m++){ - n = ((vclk< 255) - continue; - f = (ν*n)/m>>p; - if(f>vclk) - Δ = f-vclk; - else - Δ = vclk-f; - if(Δ >= Δ0) - continue; - vga->n[0] = n; - vga->m[0] = m; - vga->p[0] = p; - vga->d[0] = Δ; - Δ0 = Δ; - print("n = %uld; m = %uld; p = %uld; d = %uld; %uld (%uld)\n", n, m, p, Δ, nv->crystalfreq*n/(m<private; if(vga->f[0] == 0) vga->f[0] = vga->mode->frequency; + vga->d[0] = vga->f[0]+1; - vga->n[1] = 255; - nv = vga->private; + vga->n[1] = 255; if (nv->twostagepll) { + vga->p[1] = 6; + vga->m[1] = 13; + vga->f[1] = 400000000 << 2; + crystalfreq = nv->crystalfreq << 2; + fmin = 100000000 << 2; + mmin = 1; + nmin = 5; nv->vpllB = 0x80000401; - clock2stage(vga->f[0], vga, nv); - } else - clock1stage(vga->f[0], vga, nv); - -if(getenv("doit") == nil)exits("fu"); + } else { + vga->p[1] = 4; + if (nv->crystalfreq == 13500000) + vga->m[1] = 13; + else + vga->m[1] = 14; + vga->f[1] = 350000000; + crystalfreq = nv->crystalfreq; + fmin = 128000000; + mmin = 7; + nmin = 0; + } + + for (p=0; p <= vga->p[1]; p++){ + f = vga->f[0] << p; + if ((f >= fmin) && (f <= vga->f[1])) { + for (m=mmin; m <= vga->m[1]; m++){ + trouble = (double) crystalfreq / (double) (m << p); + n = (vga->f[0] / trouble)+0.5; + f = n*trouble + 0.5; + d = vga->f[0] - f; + if (d < 0) + d = -d; + if ((n & ~0xFF) && (n >= nmin)) + d = vga->d[0] + 1; + if (d <= vga->d[0]){ + vga->n[0] = n; + vga->m[0] = m; + vga->p[0] = p; + vga->d[0] = d; + } + } + } + } if (vga->d[0] > vga->f[0]) - error("%s: vclk %lud/%uld out of range\n", ctlr->name, vga->f[0], vga->d[0]); + error("%s: vclk %lud out of range\n", ctlr->name, vga->f[0]); } -static void -arb(Vga *vga, Ctlr *) -{ - Nvidia *nv; - nv = vga->private; - if((nv->did&0xfff0) == 0x240){ -print("setting 0240 arb\n"); - nv->arb[0] = 256; - nv->arb[1] = 0x480; - } -} - static void init(Vga* vga, Ctlr* ctlr) { @@ -528,8 +469,6 @@ char *p, *val; int tmp, pixeldepth; ulong cursorstart; - int hdis, hsta, hend, htot, hbls, hble; - int vdis, vsta, vtot, vbls, vble; mode = vga->mode; if(mode->z == 24) @@ -541,93 +480,56 @@ ctlr->flag |= Ulinear; clock(vga, ctlr); - arb(vga, ctlr); if(val = dbattr(vga->mode->attr, "lcd")){ if((nv->islcd = strtol(val, &p, 0)) == 0 && p == val) error("%s: invalid 'lcd' attr\n", ctlr->name); } - nv->usablesz = vga->vmz-128*1024; - if(nv->arch >= 40) - nv->usablesz = vga->vmz-560*1024; - if(nv->arch == 4) { - nv->cursor0 = 0x00; + nv->cursor0 = 0; nv->cursor1 = 0xBC; nv->cursor2 = 0; nv->config = 0x00001114; - } else if(nv->arch >= 10) { - cursorstart = nv->usablesz+32*1024; + } else if(nv->arch >= 10) { + cursorstart = vga->vmz - 96 * 1024; nv->cursor0 = 0x80 | (cursorstart >> 17); nv->cursor1 = (cursorstart >> 11) << 2; nv->cursor2 = cursorstart >> 24; nv->config = nv->pfb[0x200/4]; } -print("%uld : %uld : %uld\n", vga->p[0], vga->n[0], vga->m[0]); - nv->vpll = (vga->p[0] << 16) | (vga->n[0] << 8) | vga->m[0]; nv->pllsel = 0x10000700; if (mode->z == 16) nv->general = 0x00001100; else nv->general = 0x00000100; - //if (mode->z != 8) - // nv->general |= 0x00000030; + if (0 && mode->z != 8) + nv->general |= 0x00000030; if (mode->x < 1280) nv->repaint1 = 0x04; else nv->repaint1 = 0; - hdis = mode->x/8-1; - hsta = mode->shs/8-1; - hend = mode->ehs/8-1; - htot = mode->ht/8-5; - hbls = mode->shb/8-1; - hble = mode->ehb/8-1; - - vdis = mode->y-1; - vsta = vdis+1; - vtot = mode->vt-2; - vbls = mode->vt-1; - vble = mode->y-1; - if(nv->islcd){ - hsta = htot-5; - hend = htot-2; - hble = htot+4; - vsta = mode->vt-3; - vtot = mode->vt-2; - vbls = vsta; - } - -// USED(hdis, hsta, hend, htot, hbls, hble); -// USED(vdis, vsta, vtot, vbls); - - vga->crt[0x03] = 0x80 | (htot+1 & 0x1F); - vga->crt[0x04] = hsta; // prevents r side flashes - vga->crt[0x06] = vtot; - vga->crt[0x12] = vdis; - vga->crt[0x13] = (vga->virtx/8)*(mode->z/8); // magic to get cursor to work. - vga->crt[0x15] = vbls; -// vga->crt[0x16] = vble; -// vga->crt[0x17] |= 8; -// vga->crt[0x17] &= ~ 0x40; -/* NB: nv driver has this - - vga->attribute[0x10] = 1; - if(nv->television) - vga->attribute[0x11] = Pblack; -*/ vga->attribute[0x10] &= ~0x40; vga->attribute[0x11] = Pblack; - vga->crt[0x14] = 0x00; + vga->crt[0x14] = 0; + + if(1 && vga->f[0] != VgaFreq0 && vga->f[1] != VgaFreq1) + vga->misc |= 0x08; /* set vert blanking to cover full overscan */ + vga->crt[0x04] = mode->shs/8-1; // prevents r side flashes + vga->crt[0x06] = mode->vt-2; + vga->crt[0x12] = mode->y-1; + vga->crt[0x13] = (vga->virtx/8)*(mode->z/8); // magic to get cursor to work. + vga->crt[0x15] = mode->shb/8-1; + tmp = vga->crt[0x12]; -// vga->crt[0x15] = tmp; + vga->crt[0x15] = tmp; if(tmp & 0x100) vga->crt[0x07] |= 0x08; else @@ -637,21 +539,21 @@ else vga->crt[0x09] &= ~0x20; -// vga->crt[0x16] = vga->crt[0x06] + 1; + vga->crt[0x16] = vga->crt[0x06] + 1; /* set horiz blanking to cover full overscan */ vga->crt[0x02] = vga->crt[0x01]; - tmp = vga->crt[0x00] + 4; -// vga->crt[0x03] = 0x80 | (tmp & 0x1F); -// if (tmp & 0x20) -// vga->crt[0x05] |= 0x80; -// else -// vga->crt[0x05] &= ~0x80; + tmp = vga->crt[0] + 4; + vga->crt[0x03] = 0x80 | (tmp & 0x1F); + if (tmp & 0x20) + vga->crt[0x05] |= 0x80; + else + vga->crt[0x05] &= ~0x80; if (tmp & 0x40) nv->screen = 0x10; else - nv->screen = 0x00; + nv->screen = 0; /* overflow bits */ @@ -680,19 +582,19 @@ else vga->crt[0x09] &= ~0x20; - vga->crt[0x04] = vga->crt[0x00] - 5; + vga->crt[0x04] = vga->crt[0] - 5; vga->crt[0x05] &= ~0x1F; - vga->crt[0x05] |= (0x1F & (vga->crt[0x00] - 2)); + vga->crt[0x05] |= (0x1F & (vga->crt[0] - 2)); } - nv->pixel = pixeldepth = (mode->z +1)/8; - if (pixeldepth > 2) + nv->repaint0 = (vga->crt[0x13] & 0x0700) >> 3; + + pixeldepth = (mode->z +1)/8; + if (pixeldepth > 3) nv->pixel = 3; else nv->pixel = pixeldepth; - nv->repaint0 = ((mode->x/8*pixeldepth) & 0x0700) >> 3; -// nv->repaint0 = (vga->crt[0x13] & 0x0700) >> 3; nv->scale &= 0xFFF000FF; if(nv->islcd){ @@ -700,38 +602,35 @@ nv->scale |= 0x100; } - nv->screen = 0; - if(hble & (1<<6)) - nv->screen |= 1<<4; - if(vbls & (1<<10)) - nv->screen |= 1<<3; - if(vsta & (1<<10)) - nv->screen |= 1<<2; - if(vdis & (1<<10)) - nv->screen |= 1<<1; - if (vtot & 0x400) + if (vga->crt[0x06] & 0x400) nv->screen |= 0x01; -// if (vga->crt[0x13] & 0x800) -// nv->screen |= 0x20; + if (vga->crt[0x12] & 0x400) + nv->screen |= 0x02; + if (vga->crt[0x10] & 0x400) + nv->screen |= 0x04; + if (vga->crt[0x15] & 0x400) + nv->screen |= 0x08; + if (vga->crt[0x13] & 0x800) + nv->screen |= 0x20; - nv->horiz = 0x00; - if (htot & 0x100) + nv->horiz = 0; + if (vga->crt[0] & 0x100) nv->horiz = 0x01; - if(hdis & 0x100) + if(vga->crt[0x01] & 0x100) nv->horiz |= 0x02; - if(hbls & 0x100) + if(vga->crt[0x02] & 0x100) nv->horiz |= 0x04; - if(hble & 0x100) + if(vga->crt[0x04] & 0x100) nv->horiz |= 0x08; - nv->extra = 0x00; - if (vtot & 0x800) // + nv->extra = 0; + if (vga->crt[0x06] & 0x800) nv->extra |= 0x01; - if (vdis & 0x800) + if (vga->crt[0x12] & 0x800) nv->extra |= 0x04; - if (vsta & 0x800) + if (vga->crt[0x10] & 0x800) nv->extra |= 0x10; - if (vbls & 0x800) + if (vga->crt[0x15] & 0x800) nv->extra |= 0x40; nv->interlace = 0xFF; @@ -768,14 +667,13 @@ */ vgaxo(Crtx, 0x1F, 0x57); -nv->pcrtc[0x800/4] = 0; - nv->pmc[0x0140/4] = 0x00000000; + nv->pmc[0x0140/4] = 0; nv->pmc[0x0200/4] = 0xFFFF00FF; nv->pmc[0x0200/4] = 0xFFFFFFFF; - nv->ptimer[0x0200] = 0x00000008; - nv->ptimer[0x0210] = 0x00000003; - nv->ptimer[0x0140] = 0x00000000; + nv->ptimer[0x0200] = 8; + nv->ptimer[0x0210] = 3; + nv->ptimer[0x0140] = 0; nv->ptimer[0x0100] = 0xFFFFFFFF; if (nv->arch == 4) @@ -783,19 +681,18 @@ else if((nv->arch < 40) || ((nv->did & 0xfff0) == 0x0040)){ for(i = 0; i < 8; i++){ nv->pfb[(0x0240 + (i * 0x10))/4] = 0; - nv->pfb[(0x0244 + (i * 0x10))/4] = vga->vmz - 1; + nv->pfb[(0x0244 + (i * 0x10))/4] = vga->vmz - 1;; } } else{ if(((nv->did & 0xfff0) == 0x0090) || ((nv->did & 0xfff0) == 0x01D0) || ((nv->did & 0xfff0) == 0x0290) - || ((nv->did & 0xfff0) == 0x0390) - || ((nv->did & 0xfff0) == 0x03D0)) + || ((nv->did & 0xfff0) == 0x0390)) regions = 15; else regions = 12; - + for(i = 0; i < regions; i++){ nv->pfb[(0x0600 + (i * 0x10))/4] = 0; nv->pfb[(0x0604 + (i * 0x10))/4] = vga->vmz - 1; @@ -803,7 +700,7 @@ } if (nv->arch >= 40) { - nv->pramin[0x0000] = 0x80000010; + nv->pramin[0] = 0x80000010; nv->pramin[0x0001] = 0x00101202; nv->pramin[0x0002] = 0x80000011; nv->pramin[0x0003] = 0x00101204; @@ -823,56 +720,56 @@ nv->pramin[0x0801] = vga->vmz - 1; nv->pramin[0x0802] = 0x00000002; nv->pramin[0x0808] = 0x02080062; - nv->pramin[0x0809] = 0x00000000; + nv->pramin[0x0809] = 0; nv->pramin[0x080A] = 0x00001200; nv->pramin[0x080B] = 0x00001200; - nv->pramin[0x080C] = 0x00000000; - nv->pramin[0x080D] = 0x00000000; + nv->pramin[0x080C] = 0; + nv->pramin[0x080D] = 0; nv->pramin[0x0810] = 0x02080043; - nv->pramin[0x0811] = 0x00000000; - nv->pramin[0x0812] = 0x00000000; - nv->pramin[0x0813] = 0x00000000; - nv->pramin[0x0814] = 0x00000000; - nv->pramin[0x0815] = 0x00000000; + nv->pramin[0x0811] = 0; + nv->pramin[0x0812] = 0; + nv->pramin[0x0813] = 0; + nv->pramin[0x0814] = 0; + nv->pramin[0x0815] = 0; nv->pramin[0x0818] = 0x02080044; nv->pramin[0x0819] = 0x02000000; - nv->pramin[0x081A] = 0x00000000; - nv->pramin[0x081B] = 0x00000000; - nv->pramin[0x081C] = 0x00000000; - nv->pramin[0x081D] = 0x00000000; + nv->pramin[0x081A] = 0; + nv->pramin[0x081B] = 0; + nv->pramin[0x081C] = 0; + nv->pramin[0x081D] = 0; nv->pramin[0x0820] = 0x02080019; - nv->pramin[0x0821] = 0x00000000; - nv->pramin[0x0822] = 0x00000000; - nv->pramin[0x0823] = 0x00000000; - nv->pramin[0x0824] = 0x00000000; - nv->pramin[0x0825] = 0x00000000; + nv->pramin[0x0821] = 0; + nv->pramin[0x0822] = 0; + nv->pramin[0x0823] = 0; + nv->pramin[0x0824] = 0; + nv->pramin[0x0825] = 0; nv->pramin[0x0828] = 0x020A005C; - nv->pramin[0x0829] = 0x00000000; - nv->pramin[0x082A] = 0x00000000; - nv->pramin[0x082B] = 0x00000000; - nv->pramin[0x082C] = 0x00000000; - nv->pramin[0x082D] = 0x00000000; + nv->pramin[0x0829] = 0; + nv->pramin[0x082A] = 0; + nv->pramin[0x082B] = 0; + nv->pramin[0x082C] = 0; + nv->pramin[0x082D] = 0; nv->pramin[0x0830] = 0x0208009F; - nv->pramin[0x0831] = 0x00000000; + nv->pramin[0x0831] = 0; nv->pramin[0x0832] = 0x00001200; nv->pramin[0x0833] = 0x00001200; - nv->pramin[0x0834] = 0x00000000; - nv->pramin[0x0835] = 0x00000000; + nv->pramin[0x0834] = 0; + nv->pramin[0x0835] = 0; nv->pramin[0x0838] = 0x0208004A; nv->pramin[0x0839] = 0x02000000; - nv->pramin[0x083A] = 0x00000000; - nv->pramin[0x083B] = 0x00000000; - nv->pramin[0x083C] = 0x00000000; - nv->pramin[0x083D] = 0x00000000; + nv->pramin[0x083A] = 0; + nv->pramin[0x083B] = 0; + nv->pramin[0x083C] = 0; + nv->pramin[0x083D] = 0; nv->pramin[0x0840] = 0x02080077; - nv->pramin[0x0841] = 0x00000000; + nv->pramin[0x0841] = 0; nv->pramin[0x0842] = 0x00001200; nv->pramin[0x0843] = 0x00001200; - nv->pramin[0x0844] = 0x00000000; - nv->pramin[0x0845] = 0x00000000; + nv->pramin[0x0844] = 0; + nv->pramin[0x0845] = 0; nv->pramin[0x084C] = 0x00003002; nv->pramin[0x084D] = 0x00007FFF; - nv->pramin[0x084E] = nv->usablesz | 0x00000002; + nv->pramin[0x084E] = (vga->vmz - 128*1024) | 2; } else { nv->pramin[0x0000] = 0x80000010; nv->pramin[0x0001] = 0x80011201; @@ -898,40 +795,40 @@ nv->pramin[0x0804] = 0x01008062; else nv->pramin[0x0804] = 0x01008042; - nv->pramin[0x0805] = 0x00000000; + nv->pramin[0x0805] = 0; nv->pramin[0x0806] = 0x12001200; - nv->pramin[0x0807] = 0x00000000; + nv->pramin[0x0807] = 0; nv->pramin[0x0808] = 0x01008043; - nv->pramin[0x0809] = 0x00000000; - nv->pramin[0x080A] = 0x00000000; - nv->pramin[0x080B] = 0x00000000; + nv->pramin[0x0809] = 0; + nv->pramin[0x080A] = 0; + nv->pramin[0x080B] = 0; nv->pramin[0x080C] = 0x01008044; nv->pramin[0x080D] = 0x00000002; - nv->pramin[0x080E] = 0x00000000; - nv->pramin[0x080F] = 0x00000000; + nv->pramin[0x080E] = 0; + nv->pramin[0x080F] = 0; nv->pramin[0x0810] = 0x01008019; - nv->pramin[0x0811] = 0x00000000; - nv->pramin[0x0812] = 0x00000000; - nv->pramin[0x0813] = 0x00000000; + nv->pramin[0x0811] = 0; + nv->pramin[0x0812] = 0; + nv->pramin[0x0813] = 0; nv->pramin[0x0814] = 0x0100A05C; - nv->pramin[0x0815] = 0x00000000; - nv->pramin[0x0816] = 0x00000000; - nv->pramin[0x0817] = 0x00000000; + nv->pramin[0x0815] = 0; + nv->pramin[0x0816] = 0; + nv->pramin[0x0817] = 0; nv->pramin[0x0818] = 0x0100805F; - nv->pramin[0x0819] = 0x00000000; + nv->pramin[0x0819] = 0; nv->pramin[0x081A] = 0x12001200; - nv->pramin[0x081B] = 0x00000000; + nv->pramin[0x081B] = 0; nv->pramin[0x081C] = 0x0100804A; nv->pramin[0x081D] = 0x00000002; - nv->pramin[0x081E] = 0x00000000; - nv->pramin[0x081F] = 0x00000000; + nv->pramin[0x081E] = 0; + nv->pramin[0x081F] = 0; nv->pramin[0x0820] = 0x01018077; - nv->pramin[0x0821] = 0x00000000; + nv->pramin[0x0821] = 0; nv->pramin[0x0822] = 0x01201200; - nv->pramin[0x0823] = 0x00000000; + nv->pramin[0x0823] = 0; nv->pramin[0x0824] = 0x00003002; nv->pramin[0x0825] = 0x00007FFF; - nv->pramin[0x0826] = nv->usablesz | 0x00000002; + nv->pramin[0x0826] = (vga->vmz - 128*1024) | 2; nv->pramin[0x0827] = 0x00000002; } if (nv->arch < 10) { @@ -946,23 +843,23 @@ nv->pgraph[0x008C/4] = 0x0004FF31; nv->pgraph[0x008C/4] = 0x4004FF31; - nv->pgraph[0x0140/4] = 0x00000000; + nv->pgraph[0x0140/4] = 0; nv->pgraph[0x0100/4] = 0xFFFFFFFF; nv->pgraph[0x0170/4] = 0x10010100; nv->pgraph[0x0710/4] = 0xFFFFFFFF; - nv->pgraph[0x0720/4] = 0x00000001; + nv->pgraph[0x0720/4] = 1; - nv->pgraph[0x0810/4] = 0x00000000; + nv->pgraph[0x0810/4] = 0; nv->pgraph[0x0608/4] = 0xFFFFFFFF; } else { nv->pgraph[0x0080/4] = 0xFFFFFFFF; - nv->pgraph[0x0080/4] = 0x00000000; + nv->pgraph[0x0080/4] = 0; - nv->pgraph[0x0140/4] = 0x00000000; + nv->pgraph[0x0140/4] = 0; nv->pgraph[0x0100/4] = 0xFFFFFFFF; nv->pgraph[0x0144/4] = 0x10010100; nv->pgraph[0x0714/4] = 0xFFFFFFFF; - nv->pgraph[0x0720/4] = 0x00000001; + nv->pgraph[0x0720/4] = 1; nv->pgraph[0x0710/4] &= 0x0007ff00; nv->pgraph[0x0710/4] |= 0x00020100; @@ -972,14 +869,14 @@ nv->pgraph[0x008C/4] = 0x55DE0030; for(i = 0; i < 32; i++) - nv->pgraph[(0x0B00/4) + i] = nv->pfb[(0x0240/4) + i]; + nv->pgraph[0x0B00/4 + i] = nv->pfb[0x0240/4 + i]; nv->pgraph[0x640/4] = 0; nv->pgraph[0x644/4] = 0; nv->pgraph[0x684/4] = vga->vmz - 1; nv->pgraph[0x688/4] = vga->vmz - 1; - nv->pgraph[0x0810/4] = 0x00000000; + nv->pgraph[0x0810/4] = 0; nv->pgraph[0x0608/4] = 0xFFFFFFFF; } else { if (nv->arch >= 40) { @@ -1004,7 +901,6 @@ switch(nv->did & 0xfff0) { case 0x0040: - case 0x0210: nv->pgraph[0x09b8/4] = 0x0078e366; nv->pgraph[0x09bc/4] = 0x0000014c; nv->pfb[0x033C/4] &= 0xffff7fff; @@ -1017,7 +913,6 @@ case 0x0160: case 0x01D0: case 0x0240: - case 0x03D0: nv->pmc[0x1700/4] = nv->pfb[0x020C/4]; nv->pmc[0x1704/4] = 0; nv->pmc[0x1708/4] = 0; @@ -1061,7 +956,7 @@ } else { nv->pgraph[0x0084/4] = 0x00118700; nv->pgraph[0x008C/4] = 0xF20E0431; - nv->pgraph[0x0090/4] = 0x00000000; + nv->pgraph[0x0090/4] = 0; nv->pgraph[0x009C/4] = 0x00000040; if((nv->did & 0x0ff0) >= 0x0250) { @@ -1094,8 +989,7 @@ if(((nv->did & 0xfff0) == 0x0090) || ((nv->did & 0xfff0) == 0x01D0) || ((nv->did & 0xfff0) == 0x0290) - || ((nv->did & 0xfff0) == 0x0390) - || ((nv->did & 0xfff0) == 0x03D0)){ + || ((nv->did & 0xfff0) == 0x0390)){ for(i = 0; i < 60; i++) { nv->pgraph[(0x0D00/4) + i] = nv->pfb[(0x0600/4) + i]; nv->pgraph[(0x6900/4) + i] = nv->pfb[(0x0600/4) + i]; @@ -1124,16 +1018,8 @@ nv->pgraph[0x0864/4] = vga->vmz - 1; nv->pgraph[0x0868/4] = vga->vmz - 1; } else { - if((nv->did & 0xfff0) == 0x0090 - ||(nv->did & 0xfff0) == 0x01D0 - ||(nv->did & 0xfff0) == 0x0290 - ||(nv->did & 0xfff0) == 0x0390){ - nv->pgraph[0x0DF0/4] = nv->pfb[0x0200/4]; - nv->pgraph[0x0DF4/4] = nv->pfb[0x0204/4]; - }else{ - nv->pgraph[0x09F0/4] = nv->pfb[0x0200/4]; - nv->pgraph[0x09F4/4] = nv->pfb[0x0204/4]; - } + nv->pgraph[0x09F0/4] = nv->pfb[0x0200/4]; + nv->pgraph[0x09F4/4] = nv->pfb[0x0204/4]; nv->pgraph[0x69F0/4] = nv->pfb[0x0200/4]; nv->pgraph[0x69F4/4] = nv->pfb[0x0204/4]; @@ -1156,7 +1042,7 @@ nv->pgraph[0x0868/4] = vga->vmz - 1; } - nv->pgraph[0x0B20/4] = 0x00000000; + nv->pgraph[0x0B20/4] = 0; nv->pgraph[0x0B04/4] = 0xFFFFFFFF; } } @@ -1166,32 +1052,32 @@ nv->pgraph[0x0544/4] = 0x00007FFF; nv->pgraph[0x0548/4] = 0x00007FFF; - nv->pfifo[0x0140] = 0x00000000; + nv->pfifo[0x0140] = 0; nv->pfifo[0x0141] = 0x00000001; - nv->pfifo[0x0480] = 0x00000000; - nv->pfifo[0x0494] = 0x00000000; + nv->pfifo[0x0480] = 0; + nv->pfifo[0x0494] = 0; if (nv->arch >= 40) nv->pfifo[0x0481] = 0x00010000; else nv->pfifo[0x0481] = 0x00000100; - nv->pfifo[0x0490] = 0x00000000; - nv->pfifo[0x0491] = 0x00000000; + nv->pfifo[0x0490] = 0; + nv->pfifo[0x0491] = 0; if (nv->arch >= 40) nv->pfifo[0x048B] = 0x00001213; else nv->pfifo[0x048B] = 0x00001209; - nv->pfifo[0x0400] = 0x00000000; - nv->pfifo[0x0414] = 0x00000000; + nv->pfifo[0x0400] = 0; + nv->pfifo[0x0414] = 0; nv->pfifo[0x0084] = 0x03000100; nv->pfifo[0x0085] = 0x00000110; nv->pfifo[0x0086] = 0x00000112; nv->pfifo[0x0143] = 0x0000FFFF; nv->pfifo[0x0496] = 0x0000FFFF; - nv->pfifo[0x0050] = 0x00000000; + nv->pfifo[0x0050] = 0; nv->pfifo[0x0040] = 0xFFFFFFFF; nv->pfifo[0x0415] = 0x00000001; - nv->pfifo[0x048C] = 0x00000000; - nv->pfifo[0x04A0] = 0x00000000; + nv->pfifo[0x048C] = 0; + nv->pfifo[0x04A0] = 0; nv->pfifo[0x0489] = 0x000F0078; nv->pfifo[0x0488] = 0x00000001; nv->pfifo[0x0480] = 0x00000001; @@ -1235,12 +1121,6 @@ vgaxo(Crtx, 0x25, nv->screen); vgaxo(Crtx, 0x28, nv->pixel); vgaxo(Crtx, 0x2D, nv->horiz); - vgaxo(Crtx, 0x1B, nv->arb[0]); - vgaxo(Crtx, 0x20, nv->arb[1]); - if(nv->arch >= 30) - vgaxo(Crtx, 0x47, nv->arb[1]>>8); - // mode->fifo - vgaxo(Crtx, 0x1C, vgaxi(Crtx, 0x1C) & ~(1<<5)); vgaxo(Crtx, 0x30, nv->cursor0); vgaxo(Crtx, 0x31, nv->cursor1); vgaxo(Crtx, 0x2F, nv->cursor2); @@ -1250,13 +1130,13 @@ nv->pramdac[0x00000848/4] = nv->scale; nv->pramdac[0x00000828/4] = nv->crtcsync; } else { - nv->pramdac[0x0000050C/4] = nv->pllsel; - nv->pramdac[0x00000508/4] = nv->vpll; + nv->pramdac[0x50C/4] = nv->pllsel; + nv->pramdac[0x508/4] = nv->vpll; if (nv->twoheads) - nv->pramdac[0x00000520/4] = nv->vpll2; + nv->pramdac[0x520/4] = nv->vpll2; if (nv->twostagepll) { - nv->pramdac[0x00000578/4] = nv->vpllB; - nv->pramdac[0x0000057C/4] = nv->vpll2B; + nv->pramdac[0x578/4] = nv->vpllB; + nv->pramdac[0x57C/4] = nv->vpll2B; } } nv->pramdac[0x00000600/4] = nv->general; @@ -1357,11 +1237,6 @@ Bprint(&stdout, " %d\n", nv->fpwidth); printitem(ctlr->name, "fpheight"); Bprint(&stdout, " %d\n", nv->fpheight); - - printitem(ctlr->name, "arb[0]"); - Bprint(&stdout, " %lux\n", nv->arb[0]); - printitem(ctlr->name, "arb[1]"); - Bprint(&stdout, " %lux\n", nv->arb[1]); }