summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pelloux@gmail.com>2011-06-07 17:40:37 -0400
committerAlex Deucher <alexdeucher@gmail.com>2011-06-07 17:40:37 -0400
commitbdf2e112856659816d000699fce606adc4ee9926 (patch)
tree0bffb396feb054fc27b4cc403b854a7b3ac00609
parent5d4c4798223c3463dbf67c47b9563f82c9057e7f (diff)
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@gmail.com>
-rw-r--r--src/gallium/winsys/r600/drm/r600_hw_context.c3
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 2159d410f7e..6b62d163860 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;