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: 146364ab9f ("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 <nick.hamilton@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
(cherry picked from commit 05ef9f01a7)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40092>
This commit is contained in:
Frank Binns 2026-02-12 13:46:42 +00:00 committed by Eric Engestrom
parent dea37352ba
commit e1ae66262f
7 changed files with 9 additions and 9 deletions

View file

@ -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

View file

@ -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

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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(

View file

@ -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,