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
(cherry picked from commit 4de00e01dd)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39117>
This commit is contained in:
Calder Young 2025-11-27 15:20:12 -08:00 committed by Dylan Baker
parent 9ef2d1f8ed
commit ec7757eafe
2 changed files with 3 additions and 3 deletions

View file

@ -94,7 +94,7 @@
"description": "anv: Fix valgrind errors on batch buffers allocated from bo_pool",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -1293,7 +1293,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;
}
@ -1309,7 +1309,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;