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 <michel.daenzer@amd.com>
This commit is contained in:
Marek Olšák 2013-08-31 00:13:43 +02:00
parent 2b0a54d6ec
commit 9eb3b9dc2b
5 changed files with 15 additions and 5 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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 */

View File

@ -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;
}