Correct big-memory bug.
[rsc] --rw-rw-r-- M 852702 glenda sys 12395 Jan 19 11:45 sys/src/9/pc/vganvidia.c
/n/sourcesdump/2006/0119/plan9/sys/src/9/pc/vganvidia.c:189,195 -
/n/sourcesdump/2006/0120/plan9/sys/src/9/pc/vganvidia.c:189,195
* have allocated less storage than aux/vga
* expected.
*/
- tmp = scr->storage - 96*1024;
+ tmp = scr->apsize - 96*1024;
p = (void*)((uchar*)scr->vaddr + tmp);
vgaxo(Crtx, 0x30, 0x80|(tmp>>17));
vgaxo(Crtx, 0x31, (tmp>>11)<<2);
/n/sourcesdump/2006/0119/plan9/sys/src/9/pc/vganvidia.c:363,369 -
/n/sourcesdump/2006/0120/plan9/sys/src/9/pc/vganvidia.c:363,385
pitch = scr->gscreen->width*BY2WD;
- nv.dmabase = (void*)((uchar*)scr->vaddr + scr->storage - 128*1024);
+ /*
+ * DMA is at the end of the virtual window,
+ * but we might have cut it short when mapping it.
+ */
+ if(nv.dmabase == nil){
+ if(scr->storage <= scr->apsize)
+ nv.dmabase = (ulong*)((uchar*)scr->vaddr + scr->storage - 128*1024);
+ else{
+ nv.dmabase = (void*)vmap(scr->paddr + scr->storage - 128*1024, 128*1024);
+ if(nv.dmabase == 0){
+ hwaccel = 0;
+ hwblank = 0;
+ print("vmap nvidia dma failed\n");
+ return;
+ }
+ }
+ }
for(i=0; i<SKIPS; i++)
nv.dmabase[i] = 0x00000000;
|