From 1faa37557373aa29169aa4e3b95c6dcf5aced025 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 30 Jun 2013 18:29:17 +0200 Subject: [PATCH] r600g: improve the mechanism for recognizing an empty CS Reviewed-by: Alex Deucher --- 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 e2444cc5cdc..652329bfa3c 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 8b67e85af19..a4e88ce0d7a 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 d5f54c4482e..3fad311da2e 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; -- 2.30.2