Module: Mesa
Branch: main
Commit: 81b69f8e8b8b0ff8ab7222a053323c7c3754fa1d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=81b69f8e8b8b0ff8ab7222a053323c7c3754fa1d

Author: Yiwei Zhang <[email protected]>
Date:   Mon Jul 10 14:58:58 2023 -0700

venus: use tracked queue_family_index from the cmd pool

Signed-off-by: Yiwei Zhang <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24103>

---

 src/virtio/vulkan/vn_command_buffer.c | 19 +++++++++----------
 src/virtio/vulkan/vn_command_buffer.h |  1 -
 2 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/virtio/vulkan/vn_command_buffer.c 
b/src/virtio/vulkan/vn_command_buffer.c
index 10ef28d3b83..93942aef2e6 100644
--- a/src/virtio/vulkan/vn_command_buffer.c
+++ b/src/virtio/vulkan/vn_command_buffer.c
@@ -195,9 +195,9 @@ vn_cmd_fix_image_memory_barrier(const struct 
vn_command_buffer *cmd,
          out_barrier->srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
          out_barrier->dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
       } else if (dst_qfi == out_barrier->srcQueueFamilyIndex ||
-                 dst_qfi == cmd->queue_family_index) {
+                 dst_qfi == cmd->pool->queue_family_index) {
          out_barrier->srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
-         out_barrier->dstQueueFamilyIndex = cmd->queue_family_index;
+         out_barrier->dstQueueFamilyIndex = cmd->pool->queue_family_index;
       } else {
          /* The barrier also defines a queue family ownership transfer, and
           * this is the one that gets submitted to the source queue family to
@@ -218,8 +218,8 @@ vn_cmd_fix_image_memory_barrier(const struct 
vn_command_buffer *cmd,
          out_barrier->srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
          out_barrier->dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
       } else if (src_qfi == out_barrier->dstQueueFamilyIndex ||
-                 src_qfi == cmd->queue_family_index) {
-         out_barrier->srcQueueFamilyIndex = cmd->queue_family_index;
+                 src_qfi == cmd->pool->queue_family_index) {
+         out_barrier->srcQueueFamilyIndex = cmd->pool->queue_family_index;
          out_barrier->dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
       } else {
          /* The barrier also defines a queue family ownership transfer, and
@@ -268,9 +268,9 @@ vn_cmd_fix_image_memory_barrier2(const struct 
vn_command_buffer *cmd,
          b->srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
          b->dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
       } else if (b->dstQueueFamilyIndex == b->srcQueueFamilyIndex ||
-                 b->dstQueueFamilyIndex == cmd->queue_family_index) {
+                 b->dstQueueFamilyIndex == cmd->pool->queue_family_index) {
          b->srcQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
-         b->dstQueueFamilyIndex = cmd->queue_family_index;
+         b->dstQueueFamilyIndex = cmd->pool->queue_family_index;
       } else {
          /* The barrier also defines a queue family ownership transfer, and
           * this is the one that gets submitted to the source queue family to
@@ -291,8 +291,8 @@ vn_cmd_fix_image_memory_barrier2(const struct 
vn_command_buffer *cmd,
          b->srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
          b->dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
       } else if (b->srcQueueFamilyIndex == b->dstQueueFamilyIndex ||
-                 b->srcQueueFamilyIndex == cmd->queue_family_index) {
-         b->srcQueueFamilyIndex = cmd->queue_family_index;
+                 b->srcQueueFamilyIndex == cmd->pool->queue_family_index) {
+         b->srcQueueFamilyIndex = cmd->pool->queue_family_index;
          b->dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT;
       } else {
          /* The barrier also defines a queue family ownership transfer, and
@@ -833,7 +833,6 @@ vn_AllocateCommandBuffers(VkDevice device,
                           &dev->base);
       cmd->pool = pool;
       cmd->level = pAllocateInfo->level;
-      cmd->queue_family_index = pool->queue_family_index;
 
       list_addtail(&cmd->head, &pool->command_buffers);
 
@@ -1500,7 +1499,7 @@ vn_transition_prime_layout(struct vn_command_buffer *cmd, 
VkBuffer dst_buffer)
    const VkBufferMemoryBarrier buf_barrier = {
       .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER,
       .srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
-      .srcQueueFamilyIndex = cmd->queue_family_index,
+      .srcQueueFamilyIndex = cmd->pool->queue_family_index,
       .dstQueueFamilyIndex = VK_QUEUE_FAMILY_FOREIGN_EXT,
       .buffer = dst_buffer,
       .size = VK_WHOLE_SIZE,
diff --git a/src/virtio/vulkan/vn_command_buffer.h 
b/src/virtio/vulkan/vn_command_buffer.h
index a257da5c91d..e568d8e8a77 100644
--- a/src/virtio/vulkan/vn_command_buffer.h
+++ b/src/virtio/vulkan/vn_command_buffer.h
@@ -59,7 +59,6 @@ struct vn_command_buffer {
    struct vn_command_pool *pool;
 
    VkCommandBufferLevel level;
-   uint32_t queue_family_index;
 
    struct list_head head;
 

Reply via email to