From a4e4644eff4160450b2a6648f3c160aa06256158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 6 Oct 2020 07:06:30 -0400 Subject: [PATCH] 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 Reviewed-by: Bas Nieuwenhuizen Part-of: --- src/amd/common/ac_surface.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c index 5a073c8203b..79011c992c6 100644 --- a/src/amd/common/ac_surface.c +++ b/src/amd/common/ac_surface.c @@ -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)