summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/devvga.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/devvga.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/devvga.c')
-rw-r--r--sys/src/9/pc/devvga.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/sys/src/9/pc/devvga.c b/sys/src/9/pc/devvga.c
index d9ddf9239..087088434 100644
--- a/sys/src/9/pc/devvga.c
+++ b/sys/src/9/pc/devvga.c
@@ -46,6 +46,7 @@ enum {
CMtextmode,
CMtype,
CMunblank,
+ CMsoftscreen,
};
static Cmdtab vgactlmsg[] = {
@@ -63,6 +64,7 @@ static Cmdtab vgactlmsg[] = {
CMtextmode, "textmode", 1,
CMtype, "type", 2,
CMunblank, "unblank", 1,
+ CMsoftscreen, "softscreen", 2,
};
static void
@@ -200,6 +202,7 @@ vgaread(Chan* c, void* a, long n, vlong off)
len += snprint(p+len, READSTR-len, "hwblank %s\n", hwblank ? "on" : "off");
len += snprint(p+len, READSTR-len, "panning %s\n", panning ? "on" : "off");
len += snprint(p+len, READSTR-len, "addr p 0x%lux v 0x%p size 0x%ux\n", scr->paddr, scr->vaddr, scr->apsize);
+ len += snprint(p+len, READSTR-len, "softscreen %s\n", scr->softscreen ? "on" : "off");
USED(len);
n = readstr(offset, a, n, p);
@@ -352,18 +355,36 @@ vgactl(Cmdbuf *cb)
scr->palettedepth = x;
return;
+ case CMsoftscreen:
+ if(strcmp(cb->f[1], "on") == 0)
+ scr->softscreen = 1;
+ else if(strcmp(cb->f[1], "off") == 0)
+ scr->softscreen = 0;
+ else
+ break;
+ if(scr->gscreen == nil)
+ return;
+ x = scr->gscreen->r.max.x;
+ y = scr->gscreen->r.max.y;
+ z = scr->gscreen->depth;
+ chan = scr->gscreen->chan;
+ cursoroff(1);
+ deletescreenimage();
+ if(screensize(x, y, z, chan))
+ error(Egreg);
+ /* no break */
case CMdrawinit:
if(scr->gscreen == nil)
error("drawinit: no gscreen");
if(scr->dev && scr->dev->drawinit)
scr->dev->drawinit(scr);
hwblank = scr->blank != nil;
- hwaccel = scr->scroll || scr->fill;
+ hwaccel = !scr->softscreen && (scr->scroll || scr->fill);
vgascreenwin(scr);
resetscreenimage();
cursoron(1);
return;
-
+
case CMlinear:
if(cb->nf!=2 && cb->nf!=3)
error(Ebadarg);