r600g: disable render condition at the end of CS, re-enable at the beginning
authorMarek Olšák <maraeo@gmail.com>
Thu, 10 Nov 2011 14:50:06 +0000 (15:50 +0100)
committerMarek Olšák <maraeo@gmail.com>
Thu, 10 Nov 2011 17:09:10 +0000 (18:09 +0100)
src/gallium/drivers/r600/r600_hw_context.c
src/gallium/drivers/r600/r600_pipe.c

index 838af30efd5d94898ec8a02e16f9f78b2ccddbc6..ecb73570829dccdfba58e56d1024d71fd7720144 100644 (file)
@@ -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);
index 42b11d28891b4e10385afa020018b9205d17c15b..dcfcd6624406ad510eaf76dc0bad95e222e3a57c 100644 (file)
@@ -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,