diff options
author | Marek Olšák <[email protected]> | 2011-11-10 15:00:11 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-11-10 18:09:10 +0100 |
commit | cb7c6c30d02ab46efc4ed711b2a632de50157347 (patch) | |
tree | 274505a0fbfb745db05656ace972f49765423205 /src | |
parent | 1d09831253b82374774daee772e90a83de17517a (diff) |
r600g: properly reserve CS space for queries_suspend
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/r600/evergreen_hw_context.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600.h | 4 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_hw_context.c | 30 |
3 files changed, 18 insertions, 21 deletions
diff --git a/src/gallium/drivers/r600/evergreen_hw_context.c b/src/gallium/drivers/r600/evergreen_hw_context.c index 73739caa4ee..3af5bfacd83 100644 --- a/src/gallium/drivers/r600/evergreen_hw_context.c +++ b/src/gallium/drivers/r600/evergreen_hw_context.c @@ -1145,8 +1145,9 @@ void evergreen_context_draw(struct r600_context *ctx, const struct r600_draw *dr /* when increasing ndwords, bump the max limit too */ assert(ndwords <= R600_MAX_DRAW_CS_DWORDS); - /* queries need some special values */ - if (ctx->num_query_running) { + /* queries need some special values + * (this is non-zero if any query is active) */ + if (ctx->num_cs_dw_queries_suspend) { r600_context_reg(ctx, R_028004_DB_COUNT_CONTROL, S_028004_PERFECT_ZPASS_COUNTS(1), diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 715501d91d3..f41828b5ab3 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -178,6 +178,8 @@ struct r600_query { * data blocks for current query are stored sequentially from * results_start to results_end, with wrapping on the buffer end */ struct r600_resource *buffer; + /* The number of dwords for begin_query or end_query. */ + unsigned num_cs_dw; /* linked list of queries */ struct list_head list; }; @@ -210,8 +212,8 @@ struct r600_context { /* The list of active queries. Only one query of each type can be active. */ struct list_head active_query_list; + unsigned num_cs_dw_queries_suspend; - unsigned num_query_running; unsigned backend_mask; unsigned max_db; /* for OQ */ unsigned num_dest_buffers; diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c index b22bc6b1c53..87435147e38 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -943,6 +943,9 @@ void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw, num_dw += R600_MAX_DRAW_CS_DWORDS; } + /* Count in queries_suspend. */ + num_dw += ctx->num_cs_dw_queries_suspend; + /* Flush if there's not enough space. */ if (num_dw > ctx->pm4_ndwords) { r600_context_flush(ctx, RADEON_FLUSH_ASYNC); @@ -1433,8 +1436,9 @@ void r600_context_draw(struct r600_context *ctx, const struct r600_draw *draw) /* when increasing ndwords, bump the max limit too */ assert(ndwords <= R600_MAX_DRAW_CS_DWORDS); - /* queries need some special values */ - if (ctx->num_query_running) { + /* queries need some special values + * (this is non-zero if any query is active) */ + if (ctx->num_cs_dw_queries_suspend) { if (ctx->screen->family >= CHIP_RV770) { r600_context_reg(ctx, R_028D0C_DB_RENDER_CONTROL, @@ -1631,21 +1635,9 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu void r600_query_begin(struct r600_context *ctx, struct r600_query *query) { - unsigned required_space, new_results_end; - - switch (query->type) { - case PIPE_QUERY_OCCLUSION_COUNTER: - required_space = 12; /* 6 for begin, 6 for end */ - break; - case PIPE_QUERY_TIME_ELAPSED: - required_space = 16; /* 8 for begin, 8 for end */ - break; - default: - assert(0); - return; - } + unsigned new_results_end; - r600_need_cs_space(ctx, required_space, TRUE); + r600_need_cs_space(ctx, query->num_cs_dw * 2, TRUE); new_results_end = (query->results_end + query->result_size) % query->buffer->b.b.b.width0; @@ -1696,7 +1688,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query) ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_NOP, 0, 0); ctx->pm4[ctx->pm4_cdwords++] = r600_context_bo_reloc(ctx, query->buffer, RADEON_USAGE_WRITE); - ctx->num_query_running++; + ctx->num_cs_dw_queries_suspend += query->num_cs_dw; } void r600_query_end(struct r600_context *ctx, struct r600_query *query) @@ -1724,7 +1716,7 @@ void r600_query_end(struct r600_context *ctx, struct r600_query *query) ctx->pm4[ctx->pm4_cdwords++] = r600_context_bo_reloc(ctx, query->buffer, RADEON_USAGE_WRITE); query->results_end = (query->results_end + query->result_size) % query->buffer->b.b.b.width0; - ctx->num_query_running--; + ctx->num_cs_dw_queries_suspend -= query->num_cs_dw; } void r600_query_predication(struct r600_context *ctx, struct r600_query *query, int operation, @@ -1780,9 +1772,11 @@ struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned switch (query_type) { case PIPE_QUERY_OCCLUSION_COUNTER: query->result_size = 16 * ctx->max_db; + query->num_cs_dw = 6; break; case PIPE_QUERY_TIME_ELAPSED: query->result_size = 16; + query->num_cs_dw = 8; break; default: assert(0); |