anv: Fix valgrind errors on batch buffers allocated from bo_pool

Although a specific size is requested, the entire range of the returned bo up
to bo->size may end up being used by anv_batch_chain, spamming memcheck errors.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38703>
This commit is contained in:
Calder Young
2025-11-27 15:20:12 -08:00
committed by Marge Bot
parent 0d5db86eba
commit 4de00e01dd

View File

@@ -1292,7 +1292,7 @@ anv_bo_pool_alloc(struct anv_bo_pool *pool, uint32_t size,
struct anv_bo *bo =
util_sparse_array_free_list_pop_elem(&pool->free_list[bucket]);
if (bo != NULL) {
VG(VALGRIND_MEMPOOL_ALLOC(pool, bo->map, size));
VG(VALGRIND_MEMPOOL_ALLOC(pool, bo->map, bo->size));
*bo_out = bo;
return VK_SUCCESS;
}
@@ -1308,7 +1308,7 @@ anv_bo_pool_alloc(struct anv_bo_pool *pool, uint32_t size,
/* We want it to look like it came from this pool */
VG(VALGRIND_FREELIKE_BLOCK(bo->map, 0));
VG(VALGRIND_MEMPOOL_ALLOC(pool, bo->map, size));
VG(VALGRIND_MEMPOOL_ALLOC(pool, bo->map, bo->size));
*bo_out = bo;