summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2013-08-31 00:13:43 +0200
committerMarek Olšák <[email protected]>2013-09-13 01:04:44 +0200
commit9eb3b9dc2bd459af41a277ba8d4661a6d0b5726d (patch)
treef56aa292a8a60f4a77d778b6785902cbb31be622 /src/gallium/drivers/radeonsi
parent2b0a54d6ecbd31a41679d089c4e4abf8687f2fdc (diff)
radeonsi: initialize the first CS like any other
So that the "init" state is always emitted first and not later in draw_vbo. This fixes streamout where the "init" state, which disables streamout, was emitted in draw_vbo after streamout was enabled. Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi')
-rw-r--r--src/gallium/drivers/radeonsi/r600.h1
-rw-r--r--src/gallium/drivers/radeonsi/r600_hw_context.c11
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_pipe.c5
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_pipe.h2
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_pm4.c1
5 files changed, 15 insertions, 5 deletions
diff --git a/src/gallium/drivers/radeonsi/r600.h b/src/gallium/drivers/radeonsi/r600.h
index a914ce2801c..4b4316971d1 100644
--- a/src/gallium/drivers/radeonsi/r600.h
+++ b/src/gallium/drivers/radeonsi/r600.h
@@ -74,6 +74,7 @@ struct r600_screen;
void si_get_backend_mask(struct r600_context *ctx);
void si_context_flush(struct r600_context *ctx, unsigned flags);
+void si_begin_new_cs(struct r600_context *ctx);
struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned query_type);
void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *query);
diff --git a/src/gallium/drivers/radeonsi/r600_hw_context.c b/src/gallium/drivers/radeonsi/r600_hw_context.c
index 1a2128e89a6..c8fa66c4bb7 100644
--- a/src/gallium/drivers/radeonsi/r600_hw_context.c
+++ b/src/gallium/drivers/radeonsi/r600_hw_context.c
@@ -179,15 +179,15 @@ void si_need_cs_space(struct r600_context *ctx, unsigned num_dw,
void si_context_flush(struct r600_context *ctx, unsigned flags)
{
struct radeon_winsys_cs *cs = ctx->b.rings.gfx.cs;
- bool queries_suspended = false;
if (!cs->cdw)
return;
/* suspend queries */
+ ctx->nontimer_queries_suspended = false;
if (ctx->num_cs_dw_nontimer_queries_suspend) {
r600_context_queries_suspend(ctx);
- queries_suspended = true;
+ ctx->nontimer_queries_suspended = true;
}
ctx->b.streamout.suspended = false;
@@ -245,6 +245,11 @@ void si_context_flush(struct r600_context *ctx, unsigned flags)
}
#endif
+ si_begin_new_cs(ctx);
+}
+
+void si_begin_new_cs(struct r600_context *ctx)
+{
ctx->pm4_dirty_cdwords = 0;
/* Flush read caches at the beginning of CS. */
@@ -267,7 +272,7 @@ void si_context_flush(struct r600_context *ctx, unsigned flags)
}
/* resume queries */
- if (queries_suspended) {
+ if (ctx->nontimer_queries_suspended) {
r600_context_queries_resume(ctx);
}
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.c b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
index 993f30ab818..e219e36a412 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.c
@@ -279,14 +279,15 @@ static struct pipe_context *r600_create_context(struct pipe_screen *screen, void
if (rctx->blitter == NULL)
goto fail;
- si_get_backend_mask(rctx); /* this emits commands and must be last */
-
rctx->dummy_pixel_shader =
util_make_fragment_cloneinput_shader(&rctx->b.b, 0,
TGSI_SEMANTIC_GENERIC,
TGSI_INTERPOLATE_CONSTANT);
rctx->b.b.bind_fs_state(&rctx->b.b, rctx->dummy_pixel_shader);
+ /* these must be last */
+ si_begin_new_cs(rctx);
+ si_get_backend_mask(rctx);
return &rctx->b.b;
fail:
r600_destroy_context(&rctx->b.b);
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pipe.h b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
index ed17f2c6fbc..c5059e82dbd 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pipe.h
+++ b/src/gallium/drivers/radeonsi/radeonsi_pipe.h
@@ -180,6 +180,8 @@ struct r600_context {
/* The list of active queries. Only one query of each type can be active. */
struct list_head active_nontimer_query_list;
unsigned num_cs_dw_nontimer_queries_suspend;
+ /* If queries have been suspended. */
+ bool nontimer_queries_suspended;
unsigned backend_mask;
unsigned max_db; /* for OQ */
diff --git a/src/gallium/drivers/radeonsi/radeonsi_pm4.c b/src/gallium/drivers/radeonsi/radeonsi_pm4.c
index 37a199dc96f..eed0c4756d7 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_pm4.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_pm4.c
@@ -242,6 +242,7 @@ void si_pm4_emit_dirty(struct r600_context *rctx)
if (!state || rctx->emitted.array[i] == state)
continue;
+ assert(state != rctx->queued.named.init);
si_pm4_emit(rctx, state);
rctx->emitted.array[i] = state;
}