r600g: improve the mechanism for recognizing an empty CS 78/7378/1
authorMarek Olšák <maraeo@gmail.com>
Sun, 30 Jun 2013 16:29:17 +0000 (18:29 +0200)
committerMarek Olšák <maraeo@gmail.com>
Mon, 8 Jul 2013 18:25:18 +0000 (20:25 +0200)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/drivers/r600/r600_hw_context.c
src/gallium/drivers/r600/r600_pipe.c
src/gallium/drivers/r600/r600_pipe.h

index e2444cc..652329b 100644 (file)
@@ -302,9 +302,6 @@ void r600_context_flush(struct r600_context *ctx, unsigned flags)
 {
        struct radeon_winsys_cs *cs = ctx->rings.gfx.cs;
 
-       if (cs->cdw == ctx->start_cs_cmd.num_dw)
-               return;
-
        ctx->nontimer_queries_suspended = false;
        ctx->streamout.suspended = false;
 
@@ -418,6 +415,8 @@ void r600_begin_new_cs(struct r600_context *ctx)
        /* Re-emit the draw state. */
        ctx->last_primitive_type = -1;
        ctx->last_start_instance = -1;
+
+       ctx->initial_gfx_cs_size = ctx->rings.gfx.cs->cdw;
 }
 
 void r600_context_emit_fence(struct r600_context *ctx, struct r600_resource *fence_bo, unsigned offset, unsigned value)
index 8b67e85..a4e88ce 100644 (file)
@@ -164,6 +164,9 @@ static void r600_flush(struct pipe_context *ctx, unsigned flags)
        unsigned render_cond_mode = 0;
        boolean render_cond_cond = FALSE;
 
+       if (rctx->rings.gfx.cs->cdw == rctx->initial_gfx_cs_size)
+               return;
+
        rctx->rings.gfx.flushing = true;
        /* Disable render condition. */
        if (rctx->current_render_cond) {
@@ -181,6 +184,8 @@ static void r600_flush(struct pipe_context *ctx, unsigned flags)
        if (render_cond) {
                ctx->render_condition(ctx, render_cond, render_cond_cond, render_cond_mode);
        }
+
+       rctx->initial_gfx_cs_size = rctx->rings.gfx.cs->cdw;
 }
 
 static void r600_flush_from_st(struct pipe_context *ctx,
index d5f54c4..3fad311 100644 (file)
@@ -533,6 +533,7 @@ struct r600_context {
        struct u_suballocator           *allocator_so_filled_size;
        struct u_suballocator           *allocator_fetch_shader;
        struct util_slab_mempool        pool_transfers;
+       unsigned                        initial_gfx_cs_size;
 
        /* Hardware info. */
        enum radeon_family              family;