Mesa (staging/21.3): turnip: Fix operator precedence in address calculation macros for queries

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Dec 12 22:36:42 UTC 2021


Module: Mesa
Branch: staging/21.3
Commit: 13047efb5a3884295e02bb7778560ae049db0f57
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=13047efb5a3884295e02bb7778560ae049db0f57

Author: Danylo Piliaiev <dpiliaiev at igalia.com>
Date:   Fri Dec 10 17:15:39 2021 +0200

turnip: Fix operator precedence in address calculation macros for queries

Fixes crash in Oblivion, Skyrim, Crysis running through DXVK on 32b
systems.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5723
Fixes: 937dd76426b2b372a18be35e1416eed291524af7 "turnip: Implement VK_KHR_performance_query"

Signed-off-by: Danylo Piliaiev <dpiliaiev at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14148>
(cherry picked from commit c82d7e36174198b5dea3811fb11672d33aed4acb)

---

 .pick_status.json               |  2 +-
 src/freedreno/vulkan/tu_query.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index eae93fdd234..5d6f44e0553 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -454,7 +454,7 @@
         "description": "turnip: Fix operator precedence in address calculation macros for queries",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "937dd76426b2b372a18be35e1416eed291524af7"
     },
diff --git a/src/freedreno/vulkan/tu_query.c b/src/freedreno/vulkan/tu_query.c
index 48da4f1ae25..27f5860c79e 100644
--- a/src/freedreno/vulkan/tu_query.c
+++ b/src/freedreno/vulkan/tu_query.c
@@ -117,7 +117,7 @@ struct PACKED perf_query_slot {
    query_iova(struct occlusion_query_slot, pool, query, field)
 
 #define pipeline_stat_query_iova(pool, query, field)                 \
-   pool->bo.iova + pool->stride * query +                            \
+   pool->bo.iova + pool->stride * (query) +                            \
    offsetof(struct pipeline_stat_query_slot, field)
 
 #define primitive_query_iova(pool, query, field, i)                  \
@@ -125,9 +125,9 @@ struct PACKED perf_query_slot {
    offsetof(struct primitive_slot_value, values[i])
 
 #define perf_query_iova(pool, query, field, i)                          \
-   pool->bo.iova + pool->stride * query +                             \
+   pool->bo.iova + pool->stride * (query) +                             \
    sizeof(struct query_slot) +                                   \
-   sizeof(struct perfcntr_query_slot) * i +                          \
+   sizeof(struct perfcntr_query_slot) * (i) +                          \
    offsetof(struct perfcntr_query_slot, field)
 
 #define query_available_iova(pool, query)                            \
@@ -135,11 +135,11 @@ struct PACKED perf_query_slot {
 
 #define query_result_iova(pool, query, type, i)                            \
    pool->bo.iova + pool->stride * (query) +                          \
-   sizeof(struct query_slot) + sizeof(type) * i
+   sizeof(struct query_slot) + sizeof(type) * (i)
 
 #define query_result_addr(pool, query, type, i)                            \
-   pool->bo.map + pool->stride * query +                             \
-   sizeof(struct query_slot) + sizeof(type) * i
+   pool->bo.map + pool->stride * (query) +                             \
+   sizeof(struct query_slot) + sizeof(type) * (i)
 
 #define query_is_available(slot) slot->available
 



More information about the mesa-commit mailing list