From 81b69f8e8b8b0ff8ab7222a053323c7c3754fa1d Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Mon, 10 Jul 2023 14:58:58 -0700 Subject: [PATCH] venus: use tracked queue_family_index from the cmd pool Signed-off-by: Yiwei Zhang Part-of: --- 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 10ef28d..93942ae 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 a257da5..e568d8e 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; -- 2.7.4