Module: Mesa
Branch: staging/20.2
Commit: 46f8a3ecf9ad5b73a728412095718782f1165ac1
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=46f8a3ecf9ad5b73a728412095718782f1165ac1

Author: Marek Olšák <[email protected]>
Date:   Tue Oct  6 07:06:30 2020 -0400

ac/surface: fix valgrind warnings in DCC retile tile lookups

==12920== Conditional jump or move depends on uninitialised value(s)
==12920==    at 0x8F39391: util_fast_urem32 (fast_urem_by_const.h:71)
==12920==    by 0x8F39391: hash_table_search (hash_table.c:285)
==12920==    by 0x8B06D5D: ac_compute_dcc_retile_tile_indices (ac_surface.c:136)

Fixes: a37aeb128d5f7c "amd/common: Cache intra-tile addresses for retile map."

Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7055>
(cherry picked from commit a4e4644eff4160450b2a6648f3c160aa06256158)

---

 .pick_status.json           |  2 +-
 src/amd/common/ac_surface.c | 15 ++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index c69eb00892a..409c0dd0657 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -5971,7 +5971,7 @@
         "description": "ac/surface: fix valgrind warnings in DCC retile tile 
lookups",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "a37aeb128d5f7cf2fa5b8c61566bbd9f2c224a28"
     },
diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index 5eb79f1b4e5..94c42dc3132 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -128,13 +128,14 @@ ac_compute_dcc_retile_tile_indices(struct ac_addrlib 
*addrlib,
                                    unsigned bpp, unsigned swizzle_mode,
                                    bool rb_aligned, bool pipe_aligned)
 {
-   struct dcc_retile_tile_key key = (struct dcc_retile_tile_key) {
-      .family = info->family,
-      .bpp = bpp,
-      .swizzle_mode = swizzle_mode,
-      .rb_aligned = rb_aligned,
-      .pipe_aligned = pipe_aligned
-   };
+   struct dcc_retile_tile_key key;
+   memset(&key, 0, sizeof(key));
+
+   key.family = info->family;
+   key.bpp = bpp;
+   key.swizzle_mode = swizzle_mode;
+   key.rb_aligned = rb_aligned;
+   key.pipe_aligned = pipe_aligned;
 
    struct hash_entry *entry = 
_mesa_hash_table_search(addrlib->dcc_retile_tile_indices, &key);
    if (entry)

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to