anv: Add a helper to add a BO to the batch list without a reloc
The relocation list currently serves two purposes. One is for relocations on older non-softpin platforms. The second is to keep track of driver-managed BOs which are used by the given command buffer. We going to need a mechanism to add BOs to the command buffer without doing a relocation into the batch. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11236>
This commit is contained in:
parent
7e8c28383c
commit
9802a0d7ca
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue