[Mesa-dev] [PATCH 1/2] radeon: reset query buffers for PIPE_QUERY_TIMESTAMP

Nicolai Hähnle nhaehnle at gmail.com
Fri Nov 20 08:38:47 PST 2015


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
---
 src/gallium/drivers/radeon/r600_query.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
index ecf4084..4726b78 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))
-- 
2.5.0



More information about the mesa-dev mailing list