From c2e185e5f807a4c1a578d56102502439e302204a Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 25 Sep 2023 17:12:51 -0500 Subject: [PATCH] nvk: Drop command buffer BO tracking We no longer need to provide this information to the kernel so there's no reason to track it. Part-of: --- src/nouveau/vulkan/nvk_cmd_buffer.c | 12 +----------- src/nouveau/vulkan/nvk_cmd_buffer.h | 19 ------------------- src/nouveau/vulkan/nvk_query_pool.c | 10 ---------- 3 files changed, 1 insertion(+), 40 deletions(-) diff --git a/src/nouveau/vulkan/nvk_cmd_buffer.c b/src/nouveau/vulkan/nvk_cmd_buffer.c index a3dcb6c..f93e6da 100644 --- a/src/nouveau/vulkan/nvk_cmd_buffer.c +++ b/src/nouveau/vulkan/nvk_cmd_buffer.c @@ -36,7 +36,6 @@ nvk_destroy_cmd_buffer(struct vk_command_buffer *vk_cmd_buffer) nvk_cmd_pool_free_bo_list(pool, &cmd->bos); nvk_cmd_pool_free_bo_list(pool, &cmd->gart_bos); util_dynarray_fini(&cmd->pushes); - util_dynarray_fini(&cmd->bo_refs); vk_command_buffer_finish(&cmd->vk); vk_free(&pool->vk.alloc, cmd); } @@ -69,7 +68,6 @@ nvk_create_cmd_buffer(struct vk_command_pool *vk_pool, list_inithead(&cmd->bos); list_inithead(&cmd->gart_bos); util_dynarray_init(&cmd->pushes, NULL); - util_dynarray_init(&cmd->bo_refs, NULL); *cmd_buffer_out = &cmd->vk; @@ -94,7 +92,6 @@ nvk_reset_cmd_buffer(struct vk_command_buffer *vk_cmd_buffer, cmd->push = (struct nv_push) {0}; util_dynarray_clear(&cmd->pushes); - util_dynarray_clear(&cmd->bo_refs); memset(&cmd->state, 0, sizeof(cmd->state)); } @@ -204,8 +201,6 @@ nvk_cmd_buffer_upload_alloc(struct nvk_cmd_buffer *cmd, if (unlikely(result != VK_SUCCESS)) return result; - nvk_cmd_buffer_ref_bo(cmd, bo->bo); - *addr = bo->bo->offset; *ptr = bo->map; @@ -261,8 +256,6 @@ nvk_cmd_buffer_cond_render_alloc(struct nvk_cmd_buffer *cmd, if (unlikely(result != VK_SUCCESS)) return result; - nvk_cmd_buffer_ref_bo(cmd, bo->bo); - *addr = bo->bo->offset; /* Pick whichever of the current upload BO and the new BO will have more @@ -320,7 +313,7 @@ nvk_CmdExecuteCommands(VkCommandBuffer commandBuffer, for (uint32_t i = 0; i < commandBufferCount; i++) { VK_FROM_HANDLE(nvk_cmd_buffer, other, pCommandBuffers[i]); - /* We only need to copy the pushes and BO refs. We do not copy the + /* We only need to copy the pushes. We do not copy the * nvk_cmd_buffer::bos because that tracks ownership. Instead, we * depend on the app to not discard secondaries while they are used by a * primary. The Vulkan 1.3.227 spec for vkFreeCommandBuffers() says: @@ -334,7 +327,6 @@ nvk_CmdExecuteCommands(VkCommandBuffer commandBuffer, * do with it is reset it. vkResetCommandPool() has similar language. */ util_dynarray_append_dynarray(&cmd->pushes, &other->pushes); - util_dynarray_append_dynarray(&cmd->bo_refs, &other->bo_refs); } } @@ -406,8 +398,6 @@ nvk_CmdBindDescriptorSets(VkCommandBuffer commandBuffer, vk_to_nvk_descriptor_set_layout(pipeline_layout->set_layouts[set_idx]); if (desc->sets[set_idx] != set) { - if (set->bo) - nvk_cmd_buffer_ref_bo(cmd, set->bo); desc->root.sets[set_idx] = nvk_descriptor_set_addr(set); desc->sets[set_idx] = set; desc->sets_dirty |= BITFIELD_BIT(set_idx); diff --git a/src/nouveau/vulkan/nvk_cmd_buffer.h b/src/nouveau/vulkan/nvk_cmd_buffer.h index 3a74c16..4fc29c82 100644 --- a/src/nouveau/vulkan/nvk_cmd_buffer.h +++ b/src/nouveau/vulkan/nvk_cmd_buffer.h @@ -118,10 +118,6 @@ struct nvk_cmd_push { bool no_prefetch; }; -struct nvk_cmd_bo_ref { - struct nouveau_ws_bo *bo; -}; - struct nvk_cmd_buffer { struct vk_command_buffer vk; @@ -156,13 +152,6 @@ struct nvk_cmd_buffer { */ struct util_dynarray pushes; - /** Array of struct nvk_cmd_bo_ref - * - * This is for any internal allocations which we want to reference which - * aren't push buffers. - */ - struct util_dynarray bo_refs; - uint64_t tls_space_needed; }; @@ -207,14 +196,6 @@ nvk_cmd_buffer_push_indirect_buffer(struct nvk_cmd_buffer *cmd, uint64_t offset, uint64_t dw_count); -static inline void -nvk_cmd_buffer_ref_bo(struct nvk_cmd_buffer *cmd, - struct nouveau_ws_bo *bo) -{ - struct nvk_cmd_bo_ref ref = { .bo = bo }; - util_dynarray_append(&cmd->bo_refs, struct nvk_cmd_bo_ref, ref); -} - void nvk_cmd_buffer_begin_graphics(struct nvk_cmd_buffer *cmd, const VkCommandBufferBeginInfo *pBeginInfo); void nvk_cmd_buffer_begin_compute(struct nvk_cmd_buffer *cmd, diff --git a/src/nouveau/vulkan/nvk_query_pool.c b/src/nouveau/vulkan/nvk_query_pool.c index feff84e..e8e5908 100644 --- a/src/nouveau/vulkan/nvk_query_pool.c +++ b/src/nouveau/vulkan/nvk_query_pool.c @@ -218,8 +218,6 @@ nvk_CmdResetQueryPool(VkCommandBuffer commandBuffer, VK_FROM_HANDLE(nvk_cmd_buffer, cmd, commandBuffer); VK_FROM_HANDLE(nvk_query_pool, pool, queryPool); - nvk_cmd_buffer_ref_bo(cmd, pool->bo); - for (uint32_t i = 0; i < queryCount; i++) { uint64_t addr = nvk_query_available_addr(pool, firstQuery + i); @@ -266,8 +264,6 @@ nvk_CmdWriteTimestamp2(VkCommandBuffer commandBuffer, VK_FROM_HANDLE(nvk_cmd_buffer, cmd, commandBuffer); VK_FROM_HANDLE(nvk_query_pool, pool, queryPool); - nvk_cmd_buffer_ref_bo(cmd, pool->bo); - struct nv_push *p = nvk_cmd_buffer_push(cmd, 10); uint64_t report_addr = nvk_query_report_addr(pool, query); @@ -511,8 +507,6 @@ nvk_CmdBeginQueryIndexedEXT(VkCommandBuffer commandBuffer, VK_FROM_HANDLE(nvk_cmd_buffer, cmd, commandBuffer); VK_FROM_HANDLE(nvk_query_pool, pool, queryPool); - nvk_cmd_buffer_ref_bo(cmd, pool->bo); - nvk_cmd_begin_end_query(cmd, pool, query, index, false); } @@ -525,8 +519,6 @@ nvk_CmdEndQueryIndexedEXT(VkCommandBuffer commandBuffer, VK_FROM_HANDLE(nvk_cmd_buffer, cmd, commandBuffer); VK_FROM_HANDLE(nvk_query_pool, pool, queryPool); - nvk_cmd_buffer_ref_bo(cmd, pool->bo); - nvk_cmd_begin_end_query(cmd, pool, query, index, true); /* From the Vulkan spec: @@ -1120,8 +1112,6 @@ nvk_CmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VK_FROM_HANDLE(nvk_query_pool, pool, queryPool); VK_FROM_HANDLE(nvk_buffer, dst_buffer, dstBuffer); - nvk_cmd_buffer_ref_bo(cmd, pool->bo); - if (flags & VK_QUERY_RESULT_WAIT_BIT) { for (uint32_t i = 0; i < queryCount; i++) { uint64_t avail_addr = nvk_query_available_addr(pool, firstQuery + i); -- 2.7.4