[Mesa-dev] [PATCH 12/12] r600g: improve the mechanism for recognizing an empty CS

Marek Olšák maraeo at gmail.com
Sun Jun 30 18:53:53 PDT 2013


---
 src/gallium/drivers/r600/r600_hw_context.c | 5 ++---
 src/gallium/drivers/r600/r600_pipe.c       | 5 +++++
 src/gallium/drivers/r600/r600_pipe.h       | 1 +
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index e2444cc..652329b 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -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)
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 8b67e85..a4e88ce 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -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,
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index d5f54c4..3fad311 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -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;
-- 
1.8.1.2



More information about the mesa-dev mailing list