summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/vganvidia.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2012-07-18 10:16:00 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2012-07-18 10:16:00 +0200
commitb9ca8e83784b94e709e7d412eb4f87fa0a1885a8 (patch)
treee941217032e777d7ec33805930924d7fdd265aec /sys/src/9/pc/vganvidia.c
parent5654f15e56087986812c557412d558482383fc8b (diff)
vga: softscreen
allow the shadow framebuffer (softscreen) to be used with any vga driver, not just vesa. this removes the ugly scr->paddr = 0 hack employed by vesa driver to force softscreen and adds a softscreen vgactl message that can switch the feature on and off at runtime. softscreen can greatly improve graphics performance when bus reads are slow even tho it disables hardware acceleration.
Diffstat (limited to 'sys/src/9/pc/vganvidia.c')
-rw-r--r--sys/src/9/pc/vganvidia.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/sys/src/9/pc/vganvidia.c b/sys/src/9/pc/vganvidia.c
index 5ef910451..d4ce5b889 100644
--- a/sys/src/9/pc/vganvidia.c
+++ b/sys/src/9/pc/vganvidia.c
@@ -69,12 +69,12 @@ enum {
#define SKIPS 8
-struct {
+static struct {
ulong *dmabase;
- int dmacurrent;
- int dmaput;
- int dmafree;
- int dmamax;
+ int dmacurrent;
+ int dmaput;
+ int dmafree;
+ int dmamax;
} nv;
static Pcidev*
@@ -91,11 +91,6 @@ nvidiapci(void)
}
static void
-nvidialinear(VGAscr*, int, int)
-{
-}
-
-static void
nvidiaenable(VGAscr* scr)
{
Pcidev *p;
@@ -114,11 +109,9 @@ nvidiaenable(VGAscr* scr)
if(scr->mmio == nil)
return;
addvgaseg("nvidiammio", p->mem[0].bar&~0x0F, p->mem[0].size);
-
vgalinearpci(scr);
if(scr->apsize)
addvgaseg("nvidiascreen", scr->paddr, scr->apsize);
-
/* find video memory size */
switch (scr->id & 0x0ff0) {
case 0x0020:
@@ -156,6 +149,11 @@ nvidiaenable(VGAscr* scr)
}
static void
+nvidialinear(VGAscr *, int, int)
+{
+}
+
+static void
nvidiacurdisable(VGAscr* scr)
{
if(scr->mmio == 0)
@@ -223,8 +221,6 @@ nvidiacurload(VGAscr* scr, Cursor* curs)
scr->offset = curs->offset;
vgaxo(Crtx, 0x31, vgaxi(Crtx, 0x31) | 0x01);
-
- return;
}
static int
@@ -355,11 +351,14 @@ waitforidle(VGAscr *scr)
iprint("idle stat %lud scrio %#p scr %#p pc %#p\n", *pgraph, scr->mmio, scr, getcallerpc(&scr));
}
-static void
+static int
nvresetgraphics(VGAscr *scr)
{
ulong surfaceFormat, patternFormat, rectFormat, lineFormat;
- int pitch, i;
+ int pitch, i;
+
+ if(scr->paddr == 0)
+ return -1;
pitch = scr->gscreen->width*BY2WD;
@@ -373,10 +372,8 @@ nvresetgraphics(VGAscr *scr)
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;
+ return -1;
}
}
}
@@ -455,6 +452,8 @@ nvresetgraphics(VGAscr *scr)
nvdmakickoff(scr);
waitforidle(scr);
+
+ return 0;
}
@@ -513,9 +512,9 @@ nvidiablank(VGAscr*, int blank)
static void
nvidiadrawinit(VGAscr *scr)
{
- nvresetgraphics(scr);
scr->blank = nvidiablank;
- hwblank = 1;
+ if(nvresetgraphics(scr) < 0)
+ return;
scr->fill = nvidiahwfill;
scr->scroll = nvidiahwscroll;
}