From 1b375f8413d898a18c989c20d0dc16d3b1be33bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 8 Nov 2011 23:09:33 +0100 Subject: [PATCH] r600g: cosmetic changes in query code Mainly updating comments and removing one use of a magic number. --- src/gallium/drivers/r600/r600.h | 6 ++---- src/gallium/drivers/r600/r600_hw_context.c | 11 +++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h index c38ea1b2a9a..715501d91d3 100644 --- a/src/gallium/drivers/r600/r600.h +++ b/src/gallium/drivers/r600/r600.h @@ -163,9 +163,6 @@ struct r600_range { struct r600_block **blocks; }; -/* - * query - */ struct r600_query { u64 result; /* The kind of query */ @@ -174,7 +171,8 @@ struct r600_query { unsigned results_start; /* Offset of the next free result after current query data */ unsigned results_end; - /* Size of the result */ + /* 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 diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c index 6e3080ddc51..c04af902752 100644 --- a/src/gallium/drivers/r600/r600_hw_context.c +++ b/src/gallium/drivers/r600/r600_hw_context.c @@ -1622,13 +1622,12 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query) { unsigned required_space, new_results_end; - /* query request needs 6/8 dwords for begin + 6/8 dwords for end */ switch (query->type) { case PIPE_QUERY_OCCLUSION_COUNTER: - required_space = 12; + required_space = 12; /* 6 for begin, 6 for end */ break; case PIPE_QUERY_TIME_ELAPSED: - required_space = 16; + required_space = 16; /* 8 for begin, 8 for end */ break; default: assert(0); @@ -1705,7 +1704,7 @@ void r600_query_end(struct r600_context *ctx, struct r600_query *query) case PIPE_QUERY_TIME_ELAPSED: ctx->pm4[ctx->pm4_cdwords++] = PKT3(PKT3_EVENT_WRITE_EOP, 4, 0); ctx->pm4[ctx->pm4_cdwords++] = EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT) | EVENT_INDEX(5); - ctx->pm4[ctx->pm4_cdwords++] = query->results_end + 8; + ctx->pm4[ctx->pm4_cdwords++] = query->results_end + query->result_size/2; ctx->pm4[ctx->pm4_cdwords++] = (3 << 29); ctx->pm4[ctx->pm4_cdwords++] = 0; ctx->pm4[ctx->pm4_cdwords++] = 0; @@ -1774,10 +1773,10 @@ struct r600_query *r600_context_query_create(struct r600_context *ctx, unsigned switch (query_type) { case PIPE_QUERY_OCCLUSION_COUNTER: - query->result_size = 4 * 4 * ctx->max_db; + query->result_size = 16 * ctx->max_db; break; case PIPE_QUERY_TIME_ELAPSED: - query->result_size = 4 * 4; + query->result_size = 16; break; default: assert(0); -- 2.30.2