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: a37aeb128d "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>
(cherry picked from commit a4e4644eff)
This commit is contained in:
Marek Olšák 2020-10-06 07:06:30 -04:00 committed by Dylan Baker
parent a83bb83a25
commit f8953b4d81
2 changed files with 9 additions and 8 deletions

View file

@ -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"
},

View file

@ -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)