Module: Mesa Branch: main Commit: 2ea6f935ce554c5a1666648a284406db8edc3cc7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2ea6f935ce554c5a1666648a284406db8edc3cc7
Author: Juston Li <justo...@google.com> Date: Tue Sep 26 15:24:17 2023 -0700 venus: add helper function to get cmd handle rename previous vn_get_cmd_handle as that was getting cmd handles from the temp storage cmd_handle buffer. Cc: 23.3 <mesa-stable> Signed-off-by: Juston Li <justo...@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25413> --- src/virtio/vulkan/vn_queue.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/virtio/vulkan/vn_queue.c b/src/virtio/vulkan/vn_queue.c index 4848f96b5a7..903a9beb72e 100644 --- a/src/virtio/vulkan/vn_queue.c +++ b/src/virtio/vulkan/vn_queue.c @@ -176,6 +176,21 @@ vn_get_cmd_buffer_ptr(struct vn_queue_submission *submit, .pCommandBufferInfos; } +static inline const VkCommandBuffer +vn_get_cmd_handle(struct vn_queue_submission *submit, + uint32_t batch_index, + uint32_t cmd_index) +{ + assert((submit->batch_type == VK_STRUCTURE_TYPE_SUBMIT_INFO) || + (submit->batch_type == VK_STRUCTURE_TYPE_SUBMIT_INFO_2)); + + return submit->batch_type == VK_STRUCTURE_TYPE_SUBMIT_INFO + ? submit->submit_batches[batch_index].pCommandBuffers[cmd_index] + : submit->submit_batches2[batch_index] + .pCommandBufferInfos[cmd_index] + .commandBuffer; +} + static uint64_t vn_get_signal_semaphore_counter(struct vn_queue_submission *submit, uint32_t batch_index, @@ -454,9 +469,9 @@ struct vn_feedback_cmds { }; static inline VkCommandBuffer * -vn_get_cmd_handle(struct vn_queue_submission *submit, - struct vn_feedback_cmds *feedback_cmds, - uint32_t cmd_index) +vn_get_feedback_cmd_handle(struct vn_queue_submission *submit, + struct vn_feedback_cmds *feedback_cmds, + uint32_t cmd_index) { assert((submit->batch_type == VK_STRUCTURE_TYPE_SUBMIT_INFO) || (submit->batch_type == VK_STRUCTURE_TYPE_SUBMIT_INFO_2)); @@ -525,7 +540,7 @@ vn_queue_submission_add_semaphore_feedback( if (sem->feedback.slot) { VkCommandBuffer *cmd_handle = - vn_get_cmd_handle(submit, feedback_cmds, cmd_index); + vn_get_feedback_cmd_handle(submit, feedback_cmds, cmd_index); uint64_t counter = vn_get_signal_semaphore_counter(submit, batch_index, i);