ref: 6cb93914f2b955209aabd63c44cecac36aaca6c6
parent: 9aec87c46c483ca1cf560e0e8a929cdf72447371
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Jan 2 12:07:47 EST 2015
devvga: better way to prevent blank hwaccel race don't hold drawlock duing vga enable and disable, but just zero the function pointers under drawlock *before* disabling the vga device. holding the drawlock while calling out into enable and disable is not a good idea. with vgavesa, this might deadlock when userspace realemu tries to print in a rio window with vgavesa.
--- a/sys/src/9/pc/devvga.c
+++ b/sys/src/9/pc/devvga.c
@@ -309,23 +309,18 @@
for(i = 0; vgadev[i]; i++){
if(strcmp(cb->f[1], vgadev[i]->name))
continue;
- qlock(&drawlock);
- if(waserror()){
- qunlock(&drawlock);
- nexterror();
- }
if(scr->dev){
- if(scr->dev->disable)
- scr->dev->disable(scr);
+ qlock(&drawlock);
scr->fill = nil;
scr->scroll = nil;
scr->blank = nil;
+ qunlock(&drawlock);
+ if(scr->dev->disable)
+ scr->dev->disable(scr);
}
scr->dev = vgadev[i];
if(scr->dev->enable)
scr->dev->enable(scr);
- qunlock(&drawlock);
- poperror();
return;
}
break;