shithub: riscv

Download patch

ref: b5008f3b562404811a81a755c6d06b47f47e545f
parent: ce2e8e56873cae9889ce8eadd056a62ae0636d63
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Jan 3 13:33:35 EST 2015

devvga: disable hardware blanking when switching drivers, check softscreen

we have to reset hwblank when switching drivers to
prevent the generic vgablank() to be called by
blankscreen().

remove code setting hwblank from vga drivers as
devvga will always force hwblank to be 1 or 0
depending on if the driver provides a native blanking
routine.

set hwaccel to 1 when the driver provides native fill
and scroll routines independent of softscreen being
disabled. this allows hw acceleration to be used when
softscreen gets switched off.

--- a/sys/src/9/pc/devvga.c
+++ b/sys/src/9/pc/devvga.c
@@ -314,6 +314,8 @@
 				scr->fill = nil;
 				scr->scroll = nil;
 				scr->blank = nil;
+				hwblank = 0;
+				hwaccel = 0;
 				qunlock(&drawlock);
 				if(scr->dev->disable)
 					scr->dev->disable(scr);
@@ -410,7 +412,7 @@
 		if(scr->dev && scr->dev->drawinit)
 			scr->dev->drawinit(scr);
 		hwblank = scr->blank != nil;
-		hwaccel = !scr->softscreen && (scr->scroll || scr->fill);
+		hwaccel = scr->fill != nil || scr->scroll != nil;
 		vgascreenwin(scr);
 		resetscreenimage();
 		cursoron();
--- a/sys/src/9/pc/screen.c
+++ b/sys/src/9/pc/screen.c
@@ -393,8 +393,8 @@
 	scr->cur->load(scr, curs);
 }
 
-int hwaccel = 1;
-int hwblank = 0;	/* turned on by drivers that are known good */
+int hwaccel = 0;
+int hwblank = 0;
 int panning = 0;
 
 int
@@ -423,12 +423,10 @@
 		if(mask && mask->data->bdata == scrd->bdata)
 			swcursoravoid(par->mr);
 	}
-	if(hwaccel == 0)
+	if(!hwaccel || scr->softscreen)
 		return 0;
 	if(dst->data->bdata != scrd->bdata || src == nil || mask == nil)
 		return 0;
-	if(scr->fill==nil && scr->scroll==nil)
-		return 0;
 
 	/*
 	 * If we have an opaque mask and source is one opaque
@@ -669,9 +667,6 @@
 	scr->softscreen = 0;
 	scr->useflush = 0;
 	scr->dev = nil;
-
-	hwblank = 0;
-	hwaccel = 0;
 
 	physgscreenr = gscreen->r;
 
--- a/sys/src/9/pc/screen.h
+++ b/sys/src/9/pc/screen.h
@@ -135,9 +135,9 @@
 extern void mouseredraw(void);
 
 /* screen.c */
-extern int		hwaccel;	/* use hw acceleration; default on */
-extern int		hwblank;	/* use hw blanking; default on */
-extern int		panning;	/* use virtual screen panning; default off */
+extern int		hwaccel;	/* use hw acceleration */
+extern int		hwblank;	/* use hw blanking */
+extern int		panning;	/* use virtual screen panning */
 extern void addvgaseg(char*, ulong, ulong);
 extern uchar* attachscreen(Rectangle*, ulong*, int*, int*, int*);
 extern void	flushmemscreen(Rectangle);
--- a/sys/src/9/pc/vgai81x.c
+++ b/sys/src/9/pc/vgai81x.c
@@ -103,7 +103,6 @@
 	scr->storage = cursor;
 
 	scr->blank = i81xblank;
-	hwblank = 1;
 }
 
 static void
--- a/sys/src/9/pc/vgamach64xx.c
+++ b/sys/src/9/pc/vgamach64xx.c
@@ -956,7 +956,6 @@
 	case ('L'<<8)|'M':		/* 4C4D: Rage Mobility */
 	case ('L'<<8)|'P':		/* 4C50: Rage 3D LTPro */
 		scr->blank = mach64lcdblank;
-		hwblank = 1;
 		break;
 	}
 }
--- a/sys/src/9/pc/vgaradeon.c
+++ b/sys/src/9/pc/vgaradeon.c
@@ -450,10 +450,7 @@
 
 	scr->fill = radeonfill;
 	scr->scroll = radeonscroll;
-	hwaccel = 1;
-
 	scr->blank = radeonblank;
-	hwblank = 1;
 }
 
 /* hw overlay */
--- a/sys/src/9/pc/vgas3.c
+++ b/sys/src/9/pc/vgas3.c
@@ -523,7 +523,6 @@
 	 * above.
 	 */
 	scr->blank = s3blank;
-	/* hwblank = 1;		not known to work well */
 
 	switch(id){
 	case VIRGE:
--- a/sys/src/9/pc/vgasavage.c
+++ b/sys/src/9/pc/vgasavage.c
@@ -567,5 +567,4 @@
 	scr->fill = savagefill;
 	scr->scroll = savagescroll;
 	scr->blank = savageblank;
-	hwblank = 0;
 }
--- a/sys/src/9/pc/vgat2r4.c
+++ b/sys/src/9/pc/vgat2r4.c
@@ -499,7 +499,6 @@
 	scr->fill = t2r4hwfill;
 	scr->scroll = t2r4hwscroll;
 	scr->blank = t2r4blank;
-	hwblank = 1;
 }
 
 VGAdev vgat2r4dev = {