radeonsi: prevent recursion in si_context_gfx_flush
authorMarek Olšák <marek.olsak@amd.com>
Sat, 7 Nov 2015 11:22:56 +0000 (12:22 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 13 Nov 2015 18:54:41 +0000 (19:54 +0100)
The recursion can only occur if you modify need_cs_space to always flush.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_hw_context.c
src/gallium/drivers/radeonsi/si_pipe.h

index 8eade11078c325656ddcba9ec5692e8ed6c1411f..e5f1c8462d25d318f9a4c7076e115b610b05bab8 100644 (file)
@@ -64,12 +64,18 @@ void si_context_gfx_flush(void *context, unsigned flags,
        struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs;
        struct radeon_winsys *ws = ctx->b.ws;
 
+       if (ctx->gfx_flush_in_progress)
+               return;
+
+       ctx->gfx_flush_in_progress = true;
+
        if (cs->cdw == ctx->b.initial_gfx_cs_size &&
            (!fence || ctx->last_gfx_fence)) {
                if (fence)
                        ws->fence_reference(fence, ctx->last_gfx_fence);
                if (!(flags & RADEON_FLUSH_ASYNC))
                        ws->cs_sync_flush(cs);
+               ctx->gfx_flush_in_progress = false;
                return;
        }
 
@@ -123,6 +129,7 @@ void si_context_gfx_flush(void *context, unsigned flags,
                si_check_vm_faults(ctx);
 
        si_begin_new_cs(ctx);
+       ctx->gfx_flush_in_progress = false;
 }
 
 void si_begin_new_cs(struct si_context *ctx)
index 20fd6952d8ca73111e25ebfb712b256647187118..6e742fc13421977740a9d514036e9468eb95a496 100644 (file)
@@ -173,6 +173,7 @@ struct si_context {
        struct pipe_fence_handle        *last_gfx_fence;
        struct si_shader_ctx_state      fixed_func_tcs_shader;
        LLVMTargetMachineRef            tm;
+       bool                            gfx_flush_in_progress;
 
        /* Atoms (direct states). */
        union si_state_atoms            atoms;