git: 9front

Download patch

ref: 32294a09beef99d88a39c3f8ae5bf22d0e9cff6c
parent: 13e3ef33d50ad8de38c26d6bfe655481d08eea34
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Sun Jul 7 17:02:46 EDT 2013

vesa: fix blank/unblank wakeups

it could happen that we unblanked while vesaproc was
currently blanking (when manually blanking using vgactl
for example). the wakeup of the unblank is lost.

--- a/sys/src/9/pc/vgavesa.c
+++ b/sys/src/9/pc/vgavesa.c
@@ -163,9 +163,9 @@
 }
 
 static int
-vesadisabled(void *)
+gotctl(void *arg)
 {
-	return vesactl == Cdisable;
+	return vesactl != *((int*)arg);
 }
 
 static void
@@ -172,13 +172,16 @@
 vesaproc(void*)
 {
 	Ureg u;
+	int ctl;
 
-	while(vesactl != Cdisable){
+	ctl = Cenable;
+	while(ctl != Cdisable){
 		if(!waserror()){
-			sleep(&vesar, vesadisabled, nil);
+			sleep(&vesar, gotctl, &ctl);
+			ctl = vesactl;
 
 			vbesetup(&u, 0x4f10);
-			if(vesactl == Cblank)
+			if(ctl == Cblank)
 				u.bx = 0x0101;
 			else	
 				u.bx = 0x0001;
--