diff options
author | Marek Olšák <[email protected]> | 2012-02-22 00:25:55 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-02-23 20:29:56 +0100 |
commit | df00dc3c817771ac5034a44dff2b14cd7759b207 (patch) | |
tree | 3527fc4b7daa84a9c87379bf89108101b845c417 /src/gallium/drivers/r600/r600.h | |
parent | 5b84a8c3c3f85cd6b109861c6eebe3ece29d664e (diff) |
r600g: rework queries
We always mapped the query buffer in begin_query, causing stalls
if the buffer was busy.
This commit reworks it such that the query buffer is only mapped
in get_query_result as it's supposed to be.
The query buffer is no longer treated as a ring buffer. Instead, the results
are just appended and when the buffer is full, we create a new one. One query
can have more than one query buffer, though that's a very rare case.
Begin_query releases all query buffers.
Reviewed-by: Jerome Glisse <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600.h')
-rw-r--r-- | src/gallium/drivers/r600/r600.h | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index deba53f6ac8..1db9b283dfa 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -157,25 +157,31 @@ struct r600_range { struct r600_block **blocks; }; -struct r600_query { - union { - uint64_t u64; - boolean b; - struct pipe_query_data_so_statistics so; - } result; - /* The kind of query */ - unsigned type; - /* Offset of the first result for current query */ - unsigned results_start; +struct r600_query_buffer { + /* The buffer where query results are stored. */ + struct r600_resource *buf; /* Offset of the next free result after current query data */ unsigned results_end; + /* If a query buffer is full, a new buffer is created and the old one + * is put in here. When we calculate the result, we sum up the samples + * from all buffers. */ + struct r600_query_buffer *previous; +}; + +union r600_query_result { + uint64_t u64; + boolean b; + struct pipe_query_data_so_statistics so; +}; + +struct r600_query { + /* The query buffer and how many results are in it. */ + struct r600_query_buffer buffer; + /* The type of query */ + unsigned type; /* Size of the result in memory for both begin_query and end_query, * this can be one or two numbers, or it could even be a size of a structure. */ unsigned result_size; - /* 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_resource *buffer; /* The number of dwords for begin_query or end_query. */ unsigned num_cs_dw; /* linked list of queries */ @@ -214,6 +220,7 @@ void r600_context_query_destroy(struct r600_context *ctx, struct r600_query *que boolean r600_context_query_result(struct r600_context *ctx, struct r600_query *query, boolean wait, void *vresult); +struct r600_resource *r600_new_query_buffer(struct r600_context *ctx, unsigned type); void r600_query_begin(struct r600_context *ctx, struct r600_query *query); void r600_query_end(struct r600_context *ctx, struct r600_query *query); void r600_context_queries_suspend(struct r600_context *ctx); |