radv: fix missing unbind report when an image is destroyed

There should be a matching unbound operation with
VK_EXT_device_address_binding_report.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28659>
This commit is contained in:
Samuel Pitoiset 2024-04-10 08:39:08 +02:00 committed by Marge Bot
parent ec55364f9b
commit 50060072a7
2 changed files with 15 additions and 0 deletions

View File

@ -1201,6 +1201,9 @@ radv_image_create_layout(struct radv_device *device, struct radv_image_create_in
static void
radv_destroy_image(struct radv_device *device, const VkAllocationCallbacks *pAllocator, struct radv_image *image)
{
struct radv_physical_device *pdev = radv_device_physical(device);
struct radv_instance *instance = radv_physical_device_instance(pdev);
if ((image->vk.create_flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) && image->bindings[0].bo)
radv_bo_destroy(device, &image->vk.base, image->bindings[0].bo);
@ -1209,6 +1212,14 @@ radv_destroy_image(struct radv_device *device, const VkAllocationCallbacks *pAll
radv_free_memory(device, pAllocator, mem);
}
for (uint32_t i = 0; i < ARRAY_SIZE(image->bindings); i++) {
if (!image->bindings[i].bo_va)
continue;
vk_address_binding_report(&instance->vk, &image->vk.base, image->bindings[i].bo_va + image->bindings[i].offset,
image->bindings[i].bo_size, VK_DEVICE_ADDRESS_BINDING_TYPE_UNBIND_EXT);
}
radv_rmv_log_resource_destroy(device, (uint64_t)radv_image_to_handle(image));
vk_image_finish(&image->vk);
vk_free2(&device->vk.alloc, pAllocator, image);
@ -1666,6 +1677,8 @@ radv_bind_image_memory(struct radv_device *device, struct radv_image *image, uin
image->bindings[bind_idx].bo = bo;
image->bindings[bind_idx].offset = offset;
image->bindings[bind_idx].bo_va = radv_buffer_get_va(bo);
image->bindings[bind_idx].bo_size = bo->size;
radv_rmv_log_image_bind(device, bind_idx, radv_image_to_handle(image));

View File

@ -33,6 +33,8 @@ struct radv_image_binding {
/* Set when bound */
struct radeon_winsys_bo *bo;
VkDeviceSize offset;
uint64_t bo_va;
uint64_t bo_size;
};
struct radv_image {