Module: Mesa
Branch: staging/23.3
Commit: aab94295eae9896981d5b2871f165521723baa14
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=aab94295eae9896981d5b2871f165521723baa14

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>
(cherry picked from commit 2ea6f935ce554c5a1666648a284406db8edc3cc7)

---

 .pick_status.json            |  2 +-
 src/virtio/vulkan/vn_queue.c | 23 +++++++++++++++++++----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 5d1da6d1c4b..fbb9976f03d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -284,7 +284,7 @@
         "description": "venus: add helper function to get cmd handle",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null,
         "notes": null
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);

Reply via email to