ac/surface: fix valgrind warnings in DCC retile tile lookups
authorMarek Olšák <marek.olsak@amd.com>
Tue, 6 Oct 2020 11:06:30 +0000 (07:06 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 9 Oct 2020 23:13:40 +0000 (23:13 +0000)
==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 <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7055>

src/amd/common/ac_surface.c

index 5a073c8..79011c9 100644 (file)
@@ -127,11 +127,14 @@ ac_compute_dcc_retile_tile_indices(struct ac_addrlib *addrlib, const struct rade
                                    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)