Mesa (master): r600g: disable render condition at the end of CS, re-enable at the beginning

Marek Olšák mareko at kemper.freedesktop.org
Thu Nov 10 18:02:49 UTC 2011


Module: Mesa
Branch: master
Commit: 578b211be6a1466eea00fc4a8fc5d4efa4bfd62c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=578b211be6a1466eea00fc4a8fc5d4efa4bfd62c

Author: Marek Olšák <maraeo at gmail.com>
Date:   Thu Nov 10 15:50:06 2011 +0100

r600g: disable render condition at the end of CS, re-enable at the beginning

---

 src/gallium/drivers/r600/r600_hw_context.c |    5 +++++
 src/gallium/drivers/r600/r600_pipe.c       |   14 ++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 838af30..ecb7357 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -946,6 +946,11 @@ void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw,
 	/* Count in queries_suspend. */
 	num_dw += ctx->num_cs_dw_queries_suspend;
 
+	/* Count in render_condition(NULL) at the end of CS. */
+	if (ctx->predicate_drawing) {
+		num_dw += 3;
+	}
+
 	/* Flush if there's not enough space. */
 	if (num_dw > ctx->pm4_ndwords) {
 		r600_context_flush(ctx, RADEON_FLUSH_ASYNC);
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index 42b11d2..dcfcd66 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -122,11 +122,25 @@ void r600_flush(struct pipe_context *ctx, struct pipe_fence_handle **fence,
 {
 	struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx;
 	struct r600_fence **rfence = (struct r600_fence**)fence;
+	struct pipe_query *render_cond = NULL;
+	unsigned render_cond_mode = 0;
 
 	if (rfence)
 		*rfence = r600_create_fence(rctx);
 
+	/* Disable render condition. */
+	if (rctx->current_render_cond) {
+		render_cond = rctx->current_render_cond;
+		render_cond_mode = rctx->current_render_cond_mode;
+		ctx->render_condition(ctx, NULL, 0);
+	}
+
 	r600_context_flush(&rctx->ctx, flags);
+
+	/* Re-enable render condition. */
+	if (render_cond) {
+		ctx->render_condition(ctx, render_cond, render_cond_mode);
+	}
 }
 
 static void r600_flush_from_st(struct pipe_context *ctx,




More information about the mesa-commit mailing list