anv/trtt: mark vk_sync_get_value()'s value as defined for Valgrind

Valgrind doesn't seem to know that drmSyncobjQuery() writes to the
variable that we pass as 'last_value'. This gets rid of:

==6275== Conditional jump or move depends on uninitialised value(s)
==6275==    at 0x5308370: anv_sparse_trtt_garbage_collect_batches (anv_sparse.c:540)
==6275==    by 0x53091E2: anv_sparse_bind_trtt (anv_sparse.c:825)
==6275==    by 0x5309771: anv_sparse_bind (anv_sparse.c:953)
==6275==    by 0x5309A3B: anv_free_sparse_bindings (anv_sparse.c:1041)
==6275==    by 0x529FF21: anv_DestroyBuffer (anv_buffer.c:248)
==6275==    by 0x932ADBD: ??? (in /usr/lib/x86_64-linux-gnu/libVkLayer_khronos_validation.so)
==6275==    by 0x127AA2: MyVkBuffer::~MyVkBuffer() (sparse.cpp:364)
==6275==    by 0x12B2D4: MyApp::test1_trivial_sparse() (sparse.cpp:1421)
==6275==    by 0x13E01A: MyApp::run_test(int) (sparse.cpp:6594)
==6275==    by 0x13E3B0: main (sparse.cpp:6656)
==6275==  Uninitialised value was created by a stack allocation
==6275==    at 0x53082D3: anv_sparse_trtt_garbage_collect_batches (anv_sparse.c:525)

An alternative to these Valgrind macros would simply have been to
zero-intialize last_value.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31332>
This commit is contained in:
Paulo Zanoni 2024-08-29 09:31:47 -07:00 committed by Marge Bot
parent ab91106d4f
commit fe59044f47

View file

@ -578,6 +578,11 @@ anv_sparse_trtt_garbage_collect_batches(struct anv_device *device,
vk_sync_get_value(&device->vk, trtt->timeline, &last_value);
if (result != VK_SUCCESS)
return result;
/* Valgrind doesn't know that drmSyncobjQuery writes to 'last_value' on
* success.
*/
VG(VALGRIND_MAKE_MEM_DEFINED(&last_value, sizeof(last_value)));
} else {
last_value = trtt->timeline_val;
}