From e1ae66262f2effce4a3b093d686a4c405e69042c Mon Sep 17 00:00:00 2001 From: Frank Binns Date: Thu, 12 Feb 2026 13:46:42 +0000 Subject: [PATCH] pvr: Fix alloc callbacks usage when freeing frame buffers When creating frame buffers the alloc callbacks are used in the host allocations, those same alloc callbacks need to be used when freeing those allocations but are missing in some places causing the CTS to report memory leaks in certain test cases. Fixes: 146364ab9f1 ("pvr: add support for VK_KHR_dynamic_rendering") fix: dEQP-VK.api.object_management.alloc_callback_fail.framebuffer dEQP-VK.api.object_management.single_alloc_callbacks.framebuffer Signed-off-by: Nick Hamilton Reviewed-by: Frank Binns (cherry picked from commit 05ef9f01a7cf411935ba664729ea487f6e0f4d0d) Part-of: --- .pick_status.json | 4 ++-- src/imagination/ci/bxs-4-64-fails.txt | 2 -- src/imagination/vulkan/pvr_arch_cmd_buffer.c | 2 +- src/imagination/vulkan/pvr_arch_device.c | 2 +- src/imagination/vulkan/pvr_arch_framebuffer.c | 2 +- src/imagination/vulkan/pvr_device.c | 5 +++-- src/imagination/vulkan/pvr_framebuffer.h | 1 + 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index f32279334f5..0b63af61164 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2284,7 +2284,7 @@ "description": "pvr: Fix alloc callbacks usage when freeing frame buffers", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "146364ab9f159a5552a1db2f44acae9127bf01ef", "notes": null @@ -2844,7 +2844,7 @@ "description": "pvr/ci: move some timing out tests from fails to skips", "nominated": false, "nomination_type": 0, - "resolution": 1, + "resolution": 4, "main_sha": null, "because_sha": null, "notes": null diff --git a/src/imagination/ci/bxs-4-64-fails.txt b/src/imagination/ci/bxs-4-64-fails.txt index 58c548bca08..2ff9c11c8c4 100644 --- a/src/imagination/ci/bxs-4-64-fails.txt +++ b/src/imagination/ci/bxs-4-64-fails.txt @@ -2,8 +2,6 @@ dEQP-VK.api.info.format_properties.r8g8b8a8_sint,Fail dEQP-VK.api.info.format_properties.r8g8b8a8_snorm,Fail dEQP-VK.api.info.format_properties.r8g8b8a8_uint,Fail dEQP-VK.api.info.format_properties.r8g8b8a8_unorm,Fail -dEQP-VK.api.object_management.alloc_callback_fail.framebuffer,Fail -dEQP-VK.api.object_management.single_alloc_callbacks.framebuffer,Fail dEQP-VK.binding_model.unused_invalid_descriptor.copy.combined_image_sampler,Crash dEQP-VK.binding_model.unused_invalid_descriptor.copy.sampled_image,Crash dEQP-VK.binding_model.unused_invalid_descriptor.copy.storage_buffer,Crash diff --git a/src/imagination/vulkan/pvr_arch_cmd_buffer.c b/src/imagination/vulkan/pvr_arch_cmd_buffer.c index fd5e3dc983b..d02acb850d9 100644 --- a/src/imagination/vulkan/pvr_arch_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_arch_cmd_buffer.c @@ -4875,7 +4875,7 @@ void PVR_PER_ARCH(CmdBeginRendering)(VkCommandBuffer commandBuffer, return; err_cleanup_render_state: - pvr_render_state_cleanup(device, state->render_pass_info.rstate); + pvr_render_state_cleanup(device, &device->vk.alloc, state->render_pass_info.rstate); err_cleanup_tile_buffers: pvr_device_free_tile_buffer_state(device); diff --git a/src/imagination/vulkan/pvr_arch_device.c b/src/imagination/vulkan/pvr_arch_device.c index fa0ce5048e2..bfa50b3d574 100644 --- a/src/imagination/vulkan/pvr_arch_device.c +++ b/src/imagination/vulkan/pvr_arch_device.c @@ -934,7 +934,7 @@ void PVR_PER_ARCH(destroy_device)(struct pvr_device *device, rstate, &device->render_states, link) { - pvr_render_state_cleanup(device, rstate); + pvr_render_state_cleanup(device, pAllocator, rstate); list_del(&rstate->link); vk_free(&device->vk.alloc, rstate); diff --git a/src/imagination/vulkan/pvr_arch_framebuffer.c b/src/imagination/vulkan/pvr_arch_framebuffer.c index 1fe524318c1..a70748fc290 100644 --- a/src/imagination/vulkan/pvr_arch_framebuffer.c +++ b/src/imagination/vulkan/pvr_arch_framebuffer.c @@ -299,7 +299,7 @@ void PVR_PER_ARCH(DestroyFramebuffer)(VkDevice _device, if (!framebuffer) return; - pvr_render_state_cleanup(device, framebuffer->rstate); + pvr_render_state_cleanup(device, pAllocator, framebuffer->rstate); /* the render state is freed with the framebuffer */ vk_object_base_finish(&framebuffer->base); diff --git a/src/imagination/vulkan/pvr_device.c b/src/imagination/vulkan/pvr_device.c index 26bf808797b..fdbdf010e66 100644 --- a/src/imagination/vulkan/pvr_device.c +++ b/src/imagination/vulkan/pvr_device.c @@ -182,7 +182,7 @@ void pvr_rstate_entry_remove(struct pvr_device *device, if (entry != rstate) continue; - pvr_render_state_cleanup(device, rstate); + pvr_render_state_cleanup(device, &device->vk.alloc, rstate); list_del(&entry->link); vk_free(&device->vk.alloc, entry); @@ -931,6 +931,7 @@ void pvr_render_targets_fini(struct pvr_render_target *render_targets, } void pvr_render_state_cleanup(struct pvr_device *device, + const VkAllocationCallbacks *pAllocator, const struct pvr_render_state *rstate) { if (!rstate) @@ -947,7 +948,7 @@ void pvr_render_state_cleanup(struct pvr_device *device, pvr_render_targets_fini(rstate->render_targets, rstate->render_targets_count); pvr_bo_suballoc_free(rstate->ppp_state_bo); - vk_free(&device->vk.alloc, rstate->render_targets); + vk_free2(&device->vk.alloc, pAllocator, rstate->render_targets); } void pvr_GetBufferMemoryRequirements2( diff --git a/src/imagination/vulkan/pvr_framebuffer.h b/src/imagination/vulkan/pvr_framebuffer.h index 4d61021cb2b..48149eb79b0 100644 --- a/src/imagination/vulkan/pvr_framebuffer.h +++ b/src/imagination/vulkan/pvr_framebuffer.h @@ -82,6 +82,7 @@ VkResult PVR_PER_ARCH(render_state_setup)( #endif void pvr_render_state_cleanup(struct pvr_device *device, + const VkAllocationCallbacks *pAllocator, const struct pvr_render_state *rstate); VK_DEFINE_NONDISP_HANDLE_CASTS(pvr_framebuffer,