From 996f3d4dc337b07c9561107daa02339da191762b Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Wed, 30 Dec 2020 03:28:51 -0700 Subject: [PATCH] nv2a: Grab lock before marking pending download --- hw/xbox/nv2a/pgraph.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/xbox/nv2a/pgraph.c b/hw/xbox/nv2a/pgraph.c index aded949fb1..356b27ae78 100644 --- a/hw/xbox/nv2a/pgraph.c +++ b/hw/xbox/nv2a/pgraph.c @@ -3847,10 +3847,9 @@ static void pgraph_wait_for_surface_download(SurfaceBinding *e) NV2AState *d = g_nv2a; if (atomic_read(&e->draw_dirty)) { + qemu_mutex_lock(&d->pfifo.lock); atomic_set(&e->download_pending, true); atomic_set(&d->pgraph.downloads_pending, true); - - qemu_mutex_lock(&d->pfifo.lock); do { qemu_cond_broadcast(&d->pfifo.fifo_cond); qemu_cond_wait(&d->pfifo.fifo_idle_cond, &d->pfifo.lock);