diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index 35fb2182d42..51f78f71d12 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -175,6 +175,25 @@ anv_reloc_list_grow_deps(struct anv_reloc_list *list, #define READ_ONCE(x) (*(volatile __typeof__(x) *)&(x)) +VkResult +anv_reloc_list_add_bo(struct anv_reloc_list *list, + const VkAllocationCallbacks *alloc, + struct anv_bo *target_bo) +{ + assert(!target_bo->is_wrapper); + assert(target_bo->flags & EXEC_OBJECT_PINNED); + + uint32_t idx = target_bo->gem_handle; + VkResult result = anv_reloc_list_grow_deps(list, alloc, + (idx / BITSET_WORDBITS) + 1); + if (unlikely(result != VK_SUCCESS)) + return result; + + BITSET_SET(list->deps, idx); + + return VK_SUCCESS; +} + VkResult anv_reloc_list_add(struct anv_reloc_list *list, const VkAllocationCallbacks *alloc, @@ -192,17 +211,8 @@ anv_reloc_list_add(struct anv_reloc_list *list, assert(unwrapped_target_bo->gem_handle > 0); assert(unwrapped_target_bo->refcount > 0); - if (unwrapped_target_bo->flags & EXEC_OBJECT_PINNED) { - assert(!target_bo->is_wrapper); - uint32_t idx = unwrapped_target_bo->gem_handle; - VkResult result = anv_reloc_list_grow_deps(list, alloc, - (idx / BITSET_WORDBITS) + 1); - if (unlikely(result != VK_SUCCESS)) - return result; - - BITSET_SET(list->deps, unwrapped_target_bo->gem_handle); - return VK_SUCCESS; - } + if (unwrapped_target_bo->flags & EXEC_OBJECT_PINNED) + return anv_reloc_list_add_bo(list, alloc, unwrapped_target_bo); VkResult result = anv_reloc_list_grow(list, alloc, 1); if (result != VK_SUCCESS) diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 0a955b09eae..0086a80afe4 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1523,6 +1523,10 @@ VkResult anv_reloc_list_add(struct anv_reloc_list *list, uint32_t offset, struct anv_bo *target_bo, uint32_t delta, uint64_t *address_u64_out); +VkResult anv_reloc_list_add_bo(struct anv_reloc_list *list, + const VkAllocationCallbacks *alloc, + struct anv_bo *target_bo); + struct anv_batch_bo { /* Link in the anv_cmd_buffer.owned_batch_bos list */ struct list_head link;