mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
panvk: Conditionally register an host address when tracking user memory
When PANVK_DEBUG=dump, all internal buffers get dumped, but not the user ones, because they don't have a host address attached to them. Let's register one when mappings dump is enabled. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30736>
This commit is contained in:
parent
b7e0f14959
commit
c257bf5142
2 changed files with 20 additions and 2 deletions
|
|
@ -20,6 +20,8 @@ panvk_AllocateMemory(VkDevice _device,
|
|||
VkDeviceMemory *pMem)
|
||||
{
|
||||
VK_FROM_HANDLE(panvk_device, device, _device);
|
||||
struct panvk_instance *instance =
|
||||
to_panvk_instance(device->vk.physical->instance);
|
||||
struct panvk_device_memory *mem;
|
||||
bool can_be_exported = false;
|
||||
VkResult result;
|
||||
|
|
@ -110,8 +112,15 @@ panvk_AllocateMemory(VkDevice _device,
|
|||
}
|
||||
|
||||
if (device->debug.decode_ctx) {
|
||||
pandecode_inject_mmap(device->debug.decode_ctx, mem->addr.dev, NULL,
|
||||
pan_kmod_bo_size(mem->bo), NULL);
|
||||
if (instance->debug_flags & PANVK_DEBUG_DUMP) {
|
||||
mem->debug.host_mapping =
|
||||
pan_kmod_bo_mmap(mem->bo, 0, pan_kmod_bo_size(mem->bo),
|
||||
PROT_READ | PROT_WRITE, MAP_SHARED, NULL);
|
||||
}
|
||||
|
||||
pandecode_inject_mmap(device->debug.decode_ctx, mem->addr.dev,
|
||||
mem->debug.host_mapping, pan_kmod_bo_size(mem->bo),
|
||||
NULL);
|
||||
}
|
||||
|
||||
*pMem = panvk_device_memory_to_handle(mem);
|
||||
|
|
@ -139,6 +148,9 @@ panvk_FreeMemory(VkDevice _device, VkDeviceMemory _mem,
|
|||
if (device->debug.decode_ctx) {
|
||||
pandecode_inject_free(device->debug.decode_ctx, mem->addr.dev,
|
||||
pan_kmod_bo_size(mem->bo));
|
||||
|
||||
if (mem->debug.host_mapping)
|
||||
os_munmap(mem->debug.host_mapping, pan_kmod_bo_size(mem->bo));
|
||||
}
|
||||
|
||||
struct pan_kmod_vm_op op = {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@ struct panvk_device_memory {
|
|||
uint64_t dev;
|
||||
void *host;
|
||||
} addr;
|
||||
|
||||
struct {
|
||||
/* Don't use this pointer, it's only to have user memory dumped when
|
||||
* PANVK_DEBUG=dump. */
|
||||
void *host_mapping;
|
||||
} debug;
|
||||
};
|
||||
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(panvk_device_memory, vk.base, VkDeviceMemory,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue