diff options
author | Vadim Girlin <[email protected]> | 2011-07-15 07:22:20 +0400 |
---|---|---|
committer | Alex Deucher <[email protected]> | 2011-07-15 15:42:46 -0400 |
commit | ef29bfee031cdab3dbb0f9a79828c4b0d0405991 (patch) | |
tree | ac65f3f819533dc1c1f4e7d7b4321db40d0340ce /src/gallium/drivers | |
parent | cfec000e7514342fd51859906e173ba2d474a55c (diff) |
r600g: fix queries and predication
Use all zpass data for predication instead of the last block only.
Use query buffer as a ring instead of reusing the same area
for each new BeginQuery. All query buffer offsets are in bytes
to simplify offsets math.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/r600/r600.h | 19 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_query.c | 15 |
2 files changed, 23 insertions, 11 deletions
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index 2af4d311f60..61adc7ed988 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -211,14 +211,21 @@ struct r600_reloc { */ struct r600_query { u64 result; - /* The kind of query. Currently only OQ is supported. */ + /* The kind of query */ unsigned type; - /* How many results have been written, in dwords. It's incremented - * after end_query and flush. */ - unsigned num_results; - /* if we've flushed the query */ + /* Offset of the first result for current query */ + unsigned results_start; + /* Offset of the next free result after current query data */ + unsigned results_end; + /* Size of the result */ + unsigned result_size; + /* Count of new queries started in one stream without flushing */ + unsigned queries_emitted; + /* State flags */ unsigned state; - /* The buffer where query results are stored. */ + /* The buffer where query results are stored. It's used as a ring, + * data blocks for current query are stored sequentially from + * results_start to results_end, with wrapping on the buffer end */ struct r600_bo *buffer; unsigned buffer_size; /* linked list of queries */ diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c index 174505c75e9..de1f5d05f4e 100644 --- a/src/gallium/drivers/r600/r600_query.c +++ b/src/gallium/drivers/r600/r600_query.c @@ -43,7 +43,7 @@ static void r600_begin_query(struct pipe_context *ctx, struct pipe_query *query) struct r600_query *rquery = (struct r600_query *)query; rquery->result = 0; - rquery->num_results = 0; + rquery->results_start = rquery->results_end; r600_query_begin(&rctx->ctx, (struct r600_query *)query); } @@ -72,12 +72,18 @@ static void r600_render_condition(struct pipe_context *ctx, struct r600_query *rquery = (struct r600_query *)query; int wait_flag = 0; + /* If we already have nonzero result, render unconditionally */ + if (query != NULL && rquery->result != 0) + return; + rctx->current_render_cond = query; rctx->current_render_cond_mode = mode; - if (!query) { - rctx->ctx.predicate_drawing = false; - r600_query_predication(&rctx->ctx, NULL, PREDICATION_OP_CLEAR, 1); + if (query == NULL) { + if (rctx->ctx.predicate_drawing) { + rctx->ctx.predicate_drawing = false; + r600_query_predication(&rctx->ctx, NULL, PREDICATION_OP_CLEAR, 1); + } return; } @@ -88,7 +94,6 @@ static void r600_render_condition(struct pipe_context *ctx, rctx->ctx.predicate_drawing = true; r600_query_predication(&rctx->ctx, rquery, PREDICATION_OP_ZPASS, wait_flag); - } void r600_init_query_functions(struct r600_pipe_context *rctx) |