From 6f4fe8e76ada4cd04f20d37825d7763fcc2b62ae Mon Sep 17 00:00:00 2001 From: Nicolai Hähnle Date: Fri, 20 Nov 2015 11:46:26 +0100 Subject: radeon: reset query buffers for PIPE_QUERY_TIMESTAMP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since begin_query is not called for this query type, we need to reset the query buffer state in end_query instead. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93015 Reviewed-by: Marek Olšák Tested-by: Andy Furniss Tested-by: Mathias Tillman --- src/gallium/drivers/radeon/r600_query.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/gallium/drivers/radeon/r600_query.c') diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index 2797bcb76b7..526be16aa89 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -654,17 +654,11 @@ static boolean r600_begin_query(struct pipe_context *ctx, return rquery->ops->begin(rctx, rquery); } -boolean r600_query_hw_begin(struct r600_common_context *rctx, - struct r600_query *rquery) +static void r600_query_hw_reset_buffers(struct r600_common_context *rctx, + struct r600_query_hw *query) { - struct r600_query_hw *query = (struct r600_query_hw *)rquery; struct r600_query_buffer *prev = query->buffer.previous; - if (query->flags & R600_QUERY_HW_FLAG_NO_START) { - assert(0); - return false; - } - /* Discard the old query buffers. */ while (prev) { struct r600_query_buffer *qbuf = prev; @@ -682,6 +676,19 @@ boolean r600_query_hw_begin(struct r600_common_context *rctx, query->buffer.results_end = 0; query->buffer.previous = NULL; +} + +boolean r600_query_hw_begin(struct r600_common_context *rctx, + struct r600_query *rquery) +{ + struct r600_query_hw *query = (struct r600_query_hw *)rquery; + + if (query->flags & R600_QUERY_HW_FLAG_NO_START) { + assert(0); + return false; + } + + r600_query_hw_reset_buffers(rctx, query); r600_query_hw_emit_start(rctx, query); @@ -705,6 +712,9 @@ void r600_query_hw_end(struct r600_common_context *rctx, { struct r600_query_hw *query = (struct r600_query_hw *)rquery; + if (query->flags & R600_QUERY_HW_FLAG_NO_START) + r600_query_hw_reset_buffers(rctx, query); + r600_query_hw_emit_stop(rctx, query); if (!(query->flags & R600_QUERY_HW_FLAG_NO_START)) -- cgit v1.2.3