Add mutex to protect Voodoo swap count and pending. Should fix hangs

sometimes changing video mode on Voodoo 3.
This commit is contained in:
SarahW 2020-11-03 21:17:29 +00:00
commit 193645a426
6 changed files with 37 additions and 6 deletions

View file

@ -90,6 +90,8 @@ void voodoo_wait_for_swap_complete(voodoo_t *voodoo)
{
thread_wait_event(voodoo->wake_fifo_thread, -1);
thread_reset_event(voodoo->wake_fifo_thread);
thread_lock_mutex(voodoo->swap_mutex);
if ((voodoo->swap_pending && voodoo->flush) || FIFO_FULL)
{
/*Main thread is waiting for FIFO to empty, so skip vsync wait and just swap*/
@ -98,8 +100,11 @@ void voodoo_wait_for_swap_complete(voodoo_t *voodoo)
if (voodoo->swap_count > 0)
voodoo->swap_count--;
voodoo->swap_pending = 0;
thread_unlock_mutex(voodoo->swap_mutex);
break;
}
else
thread_unlock_mutex(voodoo->swap_mutex);
}
}