winsys/radeon: fix a race condition between winsys_create and winsys_destroy
[mesa.git] / src / gallium / drivers / radeonsi / si_hw_context.c
index 7e40255a6f253c56ac6580de6668f78bffe87b9e..c952c8d31f70517bc536a6cccbf4879597dfeefc 100644 (file)
@@ -81,7 +81,7 @@ void si_context_flush(struct si_context *ctx, unsigned flags)
 {
        struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs;
 
-       if (!cs->cdw)
+       if (cs->cdw == ctx->b.initial_gfx_cs_size)
                return;
 
        /* suspend queries */
@@ -176,7 +176,11 @@ void si_begin_new_cs(struct si_context *ctx)
                r600_resume_nontimer_queries(&ctx->b);
        }
 
+       ctx->framebuffer.atom.dirty = true;
+       ctx->b.streamout.enable_atom.dirty = true;
        si_all_descriptors_begin_new_cs(ctx);
+
+       ctx->b.initial_gfx_cs_size = ctx->b.rings.gfx.cs->cdw;
 }
 
 #if SI_TRACE_CS