mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-20 04:30:22 +01:00
pvr: reset all command buffer state in pvr_cmd_buffer_reset()
Command buffers were only being partially reset. Fix this by factoring out the common parts of pvr_cmd_buffer_reset() and pvr_cmd_buffer_reset() into a common function, so there's now only a single place to free command buffer state, and zeroing out parts of the command buffer that were missed. Signed-off-by: Frank Binns <frank.binns@imgtec.com> Reviewed-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18317>
This commit is contained in:
parent
492ec311f7
commit
88bed3babc
1 changed files with 27 additions and 25 deletions
|
|
@ -123,11 +123,8 @@ static void pvr_cmd_buffer_free_sub_cmds(struct pvr_cmd_buffer *cmd_buffer)
|
|||
}
|
||||
}
|
||||
|
||||
static void pvr_cmd_buffer_destroy(struct vk_command_buffer *vk_cmd_buffer)
|
||||
static void pvr_cmd_buffer_free_resources(struct pvr_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
struct pvr_cmd_buffer *cmd_buffer =
|
||||
container_of(vk_cmd_buffer, struct pvr_cmd_buffer, vk);
|
||||
|
||||
vk_free(&cmd_buffer->vk.pool->alloc,
|
||||
cmd_buffer->state.render_pass_info.attachments);
|
||||
vk_free(&cmd_buffer->vk.pool->alloc,
|
||||
|
|
@ -142,7 +139,33 @@ static void pvr_cmd_buffer_destroy(struct vk_command_buffer *vk_cmd_buffer)
|
|||
|
||||
util_dynarray_fini(&cmd_buffer->scissor_array);
|
||||
util_dynarray_fini(&cmd_buffer->depth_bias_array);
|
||||
}
|
||||
|
||||
static void pvr_cmd_buffer_reset(struct pvr_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
if (cmd_buffer->status != PVR_CMD_BUFFER_STATUS_INITIAL) {
|
||||
/* FIXME: For now we always free all resources as if
|
||||
* VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT was set.
|
||||
*/
|
||||
pvr_cmd_buffer_free_resources(cmd_buffer);
|
||||
|
||||
vk_command_buffer_reset(&cmd_buffer->vk);
|
||||
|
||||
memset(&cmd_buffer->state, 0, sizeof(cmd_buffer->state));
|
||||
memset(cmd_buffer->scissor_words, 0, sizeof(cmd_buffer->scissor_words));
|
||||
|
||||
cmd_buffer->usage_flags = 0;
|
||||
cmd_buffer->state.status = VK_SUCCESS;
|
||||
cmd_buffer->status = PVR_CMD_BUFFER_STATUS_INITIAL;
|
||||
}
|
||||
}
|
||||
|
||||
static void pvr_cmd_buffer_destroy(struct vk_command_buffer *vk_cmd_buffer)
|
||||
{
|
||||
struct pvr_cmd_buffer *cmd_buffer =
|
||||
container_of(vk_cmd_buffer, struct pvr_cmd_buffer, vk);
|
||||
|
||||
pvr_cmd_buffer_free_resources(cmd_buffer);
|
||||
vk_command_buffer_finish(&cmd_buffer->vk);
|
||||
vk_free(&cmd_buffer->vk.pool->alloc, cmd_buffer);
|
||||
}
|
||||
|
|
@ -2481,27 +2504,6 @@ void pvr_CmdBeginRenderPass2(VkCommandBuffer commandBuffer,
|
|||
}
|
||||
}
|
||||
|
||||
static void pvr_cmd_buffer_reset(struct pvr_cmd_buffer *cmd_buffer)
|
||||
{
|
||||
if (cmd_buffer->status != PVR_CMD_BUFFER_STATUS_INITIAL) {
|
||||
/* FIXME: For now we always free all resources as if
|
||||
* VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT was set.
|
||||
*/
|
||||
pvr_cmd_buffer_free_sub_cmds(cmd_buffer);
|
||||
|
||||
list_for_each_entry_safe (struct pvr_bo, bo, &cmd_buffer->bo_list, link) {
|
||||
list_del(&bo->link);
|
||||
pvr_bo_free(cmd_buffer->device, bo);
|
||||
}
|
||||
|
||||
util_dynarray_clear(&cmd_buffer->scissor_array);
|
||||
util_dynarray_clear(&cmd_buffer->depth_bias_array);
|
||||
|
||||
cmd_buffer->state.status = VK_SUCCESS;
|
||||
cmd_buffer->status = PVR_CMD_BUFFER_STATUS_INITIAL;
|
||||
}
|
||||
}
|
||||
|
||||
VkResult pvr_BeginCommandBuffer(VkCommandBuffer commandBuffer,
|
||||
const VkCommandBufferBeginInfo *pBeginInfo)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue