Mesa (7.11): r600g: fix corner case checks for the queries

Alex Deucher agd5f at kemper.freedesktop.org
Mon Jul 18 13:04:00 UTC 2011


Module: Mesa
Branch: 7.11
Commit: 89ed95ad3dc76068420da0afc9de1335b2d3017f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=89ed95ad3dc76068420da0afc9de1335b2d3017f

Author: Vadim Girlin <vadimgirlin at gmail.com>
Date:   Sat Jul 16 04:58:58 2011 +0400

r600g: fix corner case checks for the queries

---

 src/gallium/winsys/r600/drm/r600_hw_context.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c
index 42b534f..5c2881a 100644
--- a/src/gallium/winsys/r600/drm/r600_hw_context.c
+++ b/src/gallium/winsys/r600/drm/r600_hw_context.c
@@ -1744,9 +1744,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query)
 		r600_context_flush(ctx);
 	}
 
-	/* if it's new OQ (not resume) */
-	if (query->type == PIPE_QUERY_OCCLUSION_COUNTER &&
-		query->results_start == query->results_end) {
+	if (query->type == PIPE_QUERY_OCCLUSION_COUNTER) {
 		/* Count queries emitted without flushes, and flush if more than
 		 * half of buffer used, to avoid overwriting results which may be
 		 * still in use. */
@@ -1759,7 +1757,7 @@ void r600_query_begin(struct r600_context *ctx, struct r600_query *query)
 	}
 
 	new_results_end = query->results_end + query->result_size;
-	if (new_results_end > query->buffer_size)
+	if (new_results_end >= query->buffer_size)
 		new_results_end = 0;
 
 	/* collect current results if query buffer is full */
@@ -1858,7 +1856,7 @@ void r600_query_predication(struct r600_context *ctx, struct r600_query *query,
 
 		/* find count of the query data blocks */
 		count = query->buffer_size + query->results_end - query->results_start;
-		if (count > query->buffer_size) count-=query->buffer_size;
+		if (count >= query->buffer_size) count-=query->buffer_size;
 		count /= query->result_size;
 
 		if (ctx->pm4_cdwords + 5 * count > ctx->pm4_ndwords)




More information about the mesa-commit mailing list