From 39a1f5389001157243dbdbea67a1c1cc5c4e17e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tapani=20P=C3=A4lli?= Date: Tue, 3 Sep 2024 14:25:35 +0300 Subject: [PATCH] anv: initialize pixel struct to zero when setting clear color MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise we can end up with uninitialized values, this fixes following valgrind warning: ==31283== Uninitialised byte(s) found during client check request ==31283== at 0x503E4DE: anv_batch_bo_finish (anv_batch_chain.c:345) ==31283== by 0x504220A: anv_cmd_buffer_end_batch_buffer (anv_batch_chain.c:1103) ==31283== by 0x55A0E4F: end_command_buffer (genX_cmd_buffer.c:3455) ==31283== by 0x55A0E82: gfx11_EndCommandBuffer (genX_cmd_buffer.c:3466) ==31283== by 0x11233A: ??? (in /usr/bin/vkcube) ==31283== by 0x10BDEE: ??? (in /usr/bin/vkcube) ==31283== by 0x49B5149: (below main) (in /usr/lib64/libc.so.6) ==31283== Address 0xc10c4d8 is 1,240 bytes inside a block of size 8,192 client-defined ==31283== at 0x5036EF6: anv_bo_pool_alloc (anv_allocator.c:1284) ==31283== by 0x503E0E1: anv_batch_bo_create (anv_batch_chain.c:262) ==31283== by 0x5040D3F: anv_cmd_buffer_init_batch_bo_chain (anv_batch_chain.c:868) ==31283== by 0x504F9C1: anv_create_cmd_buffer (anv_cmd_buffer.c:147) ==31283== by 0x6B718C4: vk_common_AllocateCommandBuffers (vk_command_pool.c:206) ==31283== by 0x4FB06B2: vkAllocateCommandBuffers (trampoline.c:1996) ==31283== by 0x111E6B: ??? (in /usr/bin/vkcube) ==31283== by 0x10BDEE: ??? (in /usr/bin/vkcube) ==31283== by 0x49B5149: (below main) (in /usr/lib64/libc.so.6) Signed-off-by: Tapani Pälli Reviewed-by: Rohan Garg Part-of: --- src/intel/vulkan/genX_cmd_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 77f06e18108..84797522d25 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -963,7 +963,7 @@ genX(set_fast_clear_state)(struct anv_cmd_buffer *cmd_buffer, const enum isl_format format, union isl_color_value clear_color) { - uint32_t pixel[4]; + uint32_t pixel[4] = {}; isl_color_value_pack(&clear_color, format, pixel); set_image_clear_color(cmd_buffer, image, VK_IMAGE_ASPECT_COLOR_BIT, pixel);