venus: refactor query feedback cmds

The list free_query_feedback_cmds for recycling query feedback cmds was
only used in vn_command_pool when it was a vn_feedback_cmd_pool.

For clarity, refactor and store this list in vn_feedback_cmd_pool
instead and introduce a new struct vn_query_feedback_cmd that references
the feedback cmd and the feedback cmd pool for tracking.

Refactor out the allocation portion of query feedback cmds into its own
function for allocating the new vn_query_feedback_cmd struct.

Fixes: 5b24ab91e4 ("venus: switch to unconditionally deferred query feedback")

Signed-off-by: Juston Li <justonli@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27163>
This commit is contained in:
Juston Li
2024-01-22 11:48:45 -08:00
committed by Marge Bot
parent 7bc5646609
commit c3417c5bb8
5 changed files with 100 additions and 54 deletions
+2 -3
View File
@@ -681,7 +681,6 @@ vn_CreateCommandPool(VkDevice device,
pool->queue_family_index = pCreateInfo->queueFamilyIndex;
list_inithead(&pool->command_buffers);
list_inithead(&pool->free_query_batches);
list_inithead(&pool->free_query_feedback_cmds);
VkCommandPool pool_handle = vn_command_pool_to_handle(pool);
vn_async_vkCreateCommandPool(dev->primary_ring, device, pCreateInfo, NULL,
@@ -698,8 +697,8 @@ static inline void
vn_recycle_query_feedback_cmd(struct vn_command_buffer *cmd)
{
vn_ResetCommandBuffer(
vn_command_buffer_to_handle(cmd->linked_query_feedback_cmd), 0);
list_add(&cmd->linked_query_feedback_cmd->feedback_head,
vn_command_buffer_to_handle(cmd->linked_query_feedback_cmd->cmd), 0);
list_add(&cmd->linked_query_feedback_cmd->head,
&cmd->linked_query_feedback_cmd->pool->free_query_feedback_cmds);
cmd->linked_query_feedback_cmd = NULL;
}