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.
This commit is contained in:
cinap_lenrek 2015-01-02 17:07:47 +01:00
parent 9aec87c46c
commit 6cb93914f2

View file

@ -309,23 +309,18 @@ vgactl(Cmdbuf *cb)
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;