Mesa (master): r600g : fix incorrect size computation in r600_query_result
Alex Deucher
agd5f at kemper.freedesktop.org
Tue Jun 7 21:44:35 UTC 2011
Module: Mesa
Branch: master
Commit: bdf2e112856659816d000699fce606adc4ee9926
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bdf2e112856659816d000699fce606adc4ee9926
Author: Pierre-Eric Pelloux-Prayer <pelloux at gmail.com>
Date: Tue Jun 7 17:40:37 2011 -0400
r600g : fix incorrect size computation in r600_query_result
query->num_results already has the size in dwords of the query
buffer. There no need to multiply again. We were reading past
the end of the buffer, resulting in reading garbage.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=37028
agd5f: clarify the comment.
Signed-off-by: Alex Deucher <alexdeucher at gmail.com>
---
src/gallium/winsys/r600/drm/r600_hw_context.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c
index 2159d41..6b62d16 100644
--- a/src/gallium/winsys/r600/drm/r600_hw_context.c
+++ b/src/gallium/winsys/r600/drm/r600_hw_context.c
@@ -1629,7 +1629,8 @@ static boolean r600_query_result(struct r600_context *ctx, struct r600_query *qu
if (!results)
return FALSE;
- size = query->num_results * (query->type == PIPE_QUERY_OCCLUSION_COUNTER ? ctx->max_db : 1);
+ /* query->num_results contains how many dwords were used for the query */
+ size = query->num_results;
for (i = 0; i < size; i += 4) {
start = (u64)results[i] | (u64)results[i + 1] << 32;
end = (u64)results[i + 2] | (u64)results[i + 3] << 32;
More information about the mesa-commit
mailing list