From 1f42ab6f3074ffbaf50b7196e36ae4d7cc7127da Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Mon, 30 Jan 2023 20:11:47 -0600 Subject: [PATCH] nvk/copy: Use nvk_buffer_address in CmdCopyBuffer Part-of: --- src/nouveau/vulkan/nvk_cmd_copy.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/src/nouveau/vulkan/nvk_cmd_copy.c b/src/nouveau/vulkan/nvk_cmd_copy.c index ea51dd4..c4a19c5 100644 --- a/src/nouveau/vulkan/nvk_cmd_copy.c +++ b/src/nouveau/vulkan/nvk_cmd_copy.c @@ -17,18 +17,9 @@ #include "push906f.h" static void -nouveau_copy_linear( - struct nouveau_ws_push *push, - struct nouveau_ws_bo *src, uint64_t src_offset, - struct nouveau_ws_bo *dst, uint64_t dst_offset, - uint64_t size) +nouveau_copy_linear(struct nouveau_ws_push *push, + uint64_t src_addr, uint64_t dst_addr, uint64_t size) { - VkDeviceSize src_addr = src->offset + src_offset; - VkDeviceSize dst_addr = dst->offset + dst_offset; - - nouveau_ws_push_ref(push, src, NOUVEAU_WS_BO_RD); - nouveau_ws_push_ref(push, dst, NOUVEAU_WS_BO_WR); - while (size) { unsigned bytes = MIN2(size, 1 << 17); @@ -223,16 +214,17 @@ nvk_CmdCopyBuffer(VkCommandBuffer commandBuffer, VK_FROM_HANDLE(nvk_cmd_buffer, cmd, commandBuffer); VK_FROM_HANDLE(nvk_buffer, src, srcBuffer); VK_FROM_HANDLE(nvk_buffer, dst, dstBuffer); - struct nouveau_ws_push *push = cmd->push; + + nvk_push_buffer_ref(cmd->push, src, NOUVEAU_WS_BO_RD); + nvk_push_buffer_ref(cmd->push, dst, NOUVEAU_WS_BO_WR); for (unsigned r = 0; r < regionCount; r++) { const VkBufferCopy *region = &pRegions[r]; - nouveau_copy_linear( - push, - src->mem->bo, src->offset + region->srcOffset, - dst->mem->bo, dst->offset + region->dstOffset, - region->size); + nouveau_copy_linear(cmd->push, + nvk_buffer_address(src, region->srcOffset), + nvk_buffer_address(dst, region->dstOffset), + region->size); } } -- 2.7.4