summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/r600/r600_hw_context.c31
-rw-r--r--src/gallium/drivers/r600/r600_pipe.c43
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h4
3 files changed, 33 insertions, 45 deletions
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index 60260eea0c5..6d3f7992708 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -230,11 +230,28 @@ void r600_flush_emit(struct r600_context *rctx)
rctx->b.flags = 0;
}
-void r600_context_flush(struct r600_context *ctx, unsigned flags,
- struct pipe_fence_handle **fence)
+void r600_context_gfx_flush(void *context, unsigned flags,
+ struct pipe_fence_handle **fence)
{
+ struct r600_context *ctx = context;
struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs;
+ if (ctx->b.rings.gfx.cs->cdw == ctx->b.initial_gfx_cs_size)
+ return;
+
+ ctx->b.rings.gfx.flushing = true;
+
+ /* Disable render condition. */
+ ctx->b.saved_render_cond = NULL;
+ ctx->b.saved_render_cond_cond = FALSE;
+ ctx->b.saved_render_cond_mode = 0;
+ if (ctx->b.current_render_cond) {
+ ctx->b.saved_render_cond = ctx->b.current_render_cond;
+ ctx->b.saved_render_cond_cond = ctx->b.current_render_cond_cond;
+ ctx->b.saved_render_cond_mode = ctx->b.current_render_cond_mode;
+ ctx->b.b.render_condition(&ctx->b.b, NULL, FALSE, 0);
+ }
+
ctx->b.nontimer_queries_suspended = false;
ctx->b.streamout.suspended = false;
@@ -272,6 +289,9 @@ void r600_context_flush(struct r600_context *ctx, unsigned flags,
/* Flush the CS. */
ctx->b.ws->cs_flush(cs, flags, fence, ctx->screen->b.cs_count++);
+ ctx->b.rings.gfx.flushing = false;
+
+ r600_begin_new_cs(ctx);
}
void r600_begin_new_cs(struct r600_context *ctx)
@@ -352,6 +372,13 @@ void r600_begin_new_cs(struct r600_context *ctx)
r600_resume_nontimer_queries(&ctx->b);
}
+ /* Re-enable render condition. */
+ if (ctx->b.saved_render_cond) {
+ ctx->b.b.render_condition(&ctx->b.b, ctx->b.saved_render_cond,
+ ctx->b.saved_render_cond_cond,
+ ctx->b.saved_render_cond_mode);
+ }
+
/* Re-emit the draw state. */
ctx->last_primitive_type = -1;
ctx->last_start_instance = -1;
diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
index ef8883d18a7..983c65a26a6 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -66,38 +66,6 @@ static const struct debug_named_value r600_debug_options[] = {
* pipe_context
*/
-static void r600_flush(struct pipe_context *ctx, unsigned flags,
- struct pipe_fence_handle **fence)
-{
- struct r600_context *rctx = (struct r600_context *)ctx;
- struct pipe_query *render_cond = NULL;
- unsigned render_cond_mode = 0;
- boolean render_cond_cond = FALSE;
-
- if (rctx->b.rings.gfx.cs->cdw == rctx->b.initial_gfx_cs_size)
- return;
-
- rctx->b.rings.gfx.flushing = true;
- /* Disable render condition. */
- if (rctx->b.current_render_cond) {
- render_cond = rctx->b.current_render_cond;
- render_cond_cond = rctx->b.current_render_cond_cond;
- render_cond_mode = rctx->b.current_render_cond_mode;
- ctx->render_condition(ctx, NULL, FALSE, 0);
- }
-
- r600_context_flush(rctx, flags, fence);
- rctx->b.rings.gfx.flushing = false;
- r600_begin_new_cs(rctx);
-
- /* Re-enable render condition. */
- if (render_cond) {
- ctx->render_condition(ctx, render_cond, render_cond_cond, render_cond_mode);
- }
-
- rctx->b.initial_gfx_cs_size = rctx->b.rings.gfx.cs->cdw;
-}
-
static void r600_flush_from_st(struct pipe_context *ctx,
struct pipe_fence_handle **fence,
unsigned flags)
@@ -114,12 +82,6 @@ static void r600_flush_from_st(struct pipe_context *ctx,
rctx->b.rings.gfx.flush(rctx, fflags, fence);
}
-static void r600_flush_gfx_ring(void *ctx, unsigned flags,
- struct pipe_fence_handle **fence)
-{
- r600_flush((struct pipe_context*)ctx, flags, fence);
-}
-
static void r600_destroy_context(struct pipe_context *context)
{
struct r600_context *rctx = (struct r600_context *)context;
@@ -233,11 +195,10 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
}
rctx->b.rings.gfx.cs = ws->cs_create(ws, RING_GFX,
- r600_flush_gfx_ring, rctx,
+ r600_context_gfx_flush, rctx,
rscreen->b.trace_bo ?
rscreen->b.trace_bo->cs_buf : NULL);
- rctx->b.rings.gfx.flush = r600_flush_gfx_ring;
- rctx->b.rings.gfx.flushing = false;
+ rctx->b.rings.gfx.flush = r600_context_gfx_flush;
rctx->allocator_fetch_shader = u_suballocator_create(&rctx->b.b, 64 * 1024, 256,
0, PIPE_USAGE_DEFAULT, FALSE);
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index d52de352063..a29bb3b3022 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -582,8 +582,8 @@ boolean r600_is_format_supported(struct pipe_screen *screen,
void r600_update_db_shader_control(struct r600_context * rctx);
/* r600_hw_context.c */
-void r600_context_flush(struct r600_context *ctx, unsigned flags,
- struct pipe_fence_handle **fence);
+void r600_context_gfx_flush(void *context, unsigned flags,
+ struct pipe_fence_handle **fence);
void r600_begin_new_cs(struct r600_context *ctx);
void r600_flush_emit(struct r600_context *ctx);
void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, boolean count_draw_in);