freedreno: fix potential hang when destroying batch
authorRob Clark <robdclark@gmail.com>
Tue, 11 Sep 2018 18:04:57 +0000 (14:04 -0400)
committerRob Clark <robdclark@gmail.com>
Thu, 27 Sep 2018 19:29:45 +0000 (15:29 -0400)
batch_flush_reset_dependencies() expects to be called unlocked, and can
call fd_batch_reference() which can try to aquire the screen lock again.

Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/freedreno_batch.c

index b3d1466..340756e 100644 (file)
@@ -235,10 +235,10 @@ __fd_batch_destroy(struct fd_batch *batch)
        debug_assert(batch->resources->entries == 0);
        _mesa_set_destroy(batch->resources, NULL);
 
+       fd_context_unlock(ctx);
        batch_flush_reset_dependencies(batch, false);
        debug_assert(batch->dependents_mask == 0);
 
-       fd_context_unlock(ctx);
        util_copy_framebuffer_state(&batch->framebuffer, NULL);
        batch_fini(batch);
        free(batch);