mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
anv: always annotate memory returned from anv_gem_mmap
anv_bo_pool_alloc expects that the memory returned by and_gem_mmap
was annotated using VALGRIND_MALLOCLIKE_BLOCK, but anv_gem_mmap_offset
didn't do that. Move annotation from anv_gem_mmap_legacy to common
code.
Fixes: 4abf0837cd ("anv: Add support for new MMAP_OFFSET ioctl.")
Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7381>
This commit is contained in:
parent
990343b70d
commit
b5e2c58ad8
1 changed files with 9 additions and 5 deletions
|
|
@ -105,7 +105,6 @@ anv_gem_mmap_legacy(struct anv_device *device, uint32_t gem_handle,
|
|||
if (ret != 0)
|
||||
return MAP_FAILED;
|
||||
|
||||
VG(VALGRIND_MALLOCLIKE_BLOCK(gem_mmap.addr_ptr, gem_mmap.size, 0, 1));
|
||||
return (void *)(uintptr_t) gem_mmap.addr_ptr;
|
||||
}
|
||||
|
||||
|
|
@ -116,10 +115,16 @@ void*
|
|||
anv_gem_mmap(struct anv_device *device, uint32_t gem_handle,
|
||||
uint64_t offset, uint64_t size, uint32_t flags)
|
||||
{
|
||||
void *map;
|
||||
if (device->physical->has_mmap_offset)
|
||||
return anv_gem_mmap_offset(device, gem_handle, offset, size, flags);
|
||||
map = anv_gem_mmap_offset(device, gem_handle, offset, size, flags);
|
||||
else
|
||||
return anv_gem_mmap_legacy(device, gem_handle, offset, size, flags);
|
||||
map = anv_gem_mmap_legacy(device, gem_handle, offset, size, flags);
|
||||
|
||||
if (map != MAP_FAILED)
|
||||
VG(VALGRIND_MALLOCLIKE_BLOCK(map, size, 0, 1));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/* This is just a wrapper around munmap, but it also notifies valgrind that
|
||||
|
|
@ -128,8 +133,7 @@ anv_gem_mmap(struct anv_device *device, uint32_t gem_handle,
|
|||
void
|
||||
anv_gem_munmap(struct anv_device *device, void *p, uint64_t size)
|
||||
{
|
||||
if (!device->physical->has_mmap_offset)
|
||||
VG(VALGRIND_FREELIKE_BLOCK(p, 0));
|
||||
VG(VALGRIND_FREELIKE_BLOCK(p, 0));
|
||||
munmap(p, size);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue