mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-06-03 19:48:17 +02:00
v3dv: move destroy_update_buffer_cb to a generic helper
Move from v3dv_meta_copy.c to a generic v3dv_cmd_buffer_destroy_bo_cb in the cmd buffer module. This makes it reusable for different callers that want to attach a v3dv_bo to a command buffer's private_objs list. Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41725>
This commit is contained in:
parent
9b131eb86e
commit
ed9fea6045
3 changed files with 18 additions and 11 deletions
|
|
@ -251,6 +251,16 @@ v3dv_cmd_buffer_add_private_obj(struct v3dv_cmd_buffer *cmd_buffer,
|
|||
list_addtail(&pobj->list_link, &cmd_buffer->private_objs);
|
||||
}
|
||||
|
||||
void
|
||||
v3dv_cmd_buffer_destroy_bo_cb(VkDevice _device,
|
||||
uint64_t pobj,
|
||||
VkAllocationCallbacks *alloc)
|
||||
{
|
||||
V3DV_FROM_HANDLE(v3dv_device, device, _device);
|
||||
struct v3dv_bo *bo = (struct v3dv_bo *)((uintptr_t) pobj);
|
||||
v3dv_bo_free(device, bo);
|
||||
}
|
||||
|
||||
static void
|
||||
cmd_buffer_destroy_private_obj(struct v3dv_cmd_buffer *cmd_buffer,
|
||||
struct v3dv_cmd_buffer_private_obj *pobj)
|
||||
|
|
|
|||
|
|
@ -714,6 +714,13 @@ void v3dv_cmd_buffer_add_private_obj(struct v3dv_cmd_buffer *cmd_buffer,
|
|||
uint64_t obj,
|
||||
v3dv_cmd_buffer_private_obj_destroy_cb destroy_cb);
|
||||
|
||||
/* Generic destroy callback for v3dv_bo private objects added via
|
||||
* v3dv_cmd_buffer_add_private_obj.
|
||||
*/
|
||||
void v3dv_cmd_buffer_destroy_bo_cb(VkDevice _device,
|
||||
uint64_t pobj,
|
||||
VkAllocationCallbacks *alloc);
|
||||
|
||||
void v3dv_merge_barrier_state(struct v3dv_barrier_state *dst,
|
||||
struct v3dv_barrier_state *src);
|
||||
|
||||
|
|
|
|||
|
|
@ -1806,16 +1806,6 @@ v3dv_CmdCopyBuffer2(VkCommandBuffer commandBuffer,
|
|||
cmd_buffer->state.is_transfer = false;
|
||||
}
|
||||
|
||||
static void
|
||||
destroy_update_buffer_cb(VkDevice _device,
|
||||
uint64_t pobj,
|
||||
VkAllocationCallbacks *alloc)
|
||||
{
|
||||
V3DV_FROM_HANDLE(v3dv_device, device, _device);
|
||||
struct v3dv_bo *bo = (struct v3dv_bo *)((uintptr_t) pobj);
|
||||
v3dv_bo_free(device, bo);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
v3dv_CmdUpdateBuffer(VkCommandBuffer commandBuffer,
|
||||
VkBuffer dstBuffer,
|
||||
|
|
@ -1856,7 +1846,7 @@ v3dv_CmdUpdateBuffer(VkCommandBuffer commandBuffer,
|
|||
src_bo, 0, ®ion);
|
||||
|
||||
v3dv_cmd_buffer_add_private_obj(
|
||||
cmd_buffer, (uint64_t)(uintptr_t)src_bo, destroy_update_buffer_cb);
|
||||
cmd_buffer, (uint64_t)(uintptr_t)src_bo, v3dv_cmd_buffer_destroy_bo_cb);
|
||||
|
||||
cmd_buffer->state.is_transfer = false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue