diff options
author | Lionel Landwerlin <[email protected]> | 2017-11-17 17:26:59 +0000 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2017-11-22 22:53:27 +0000 |
commit | 118a8c7587d919b3b85cec7855a16d9e778394e6 (patch) | |
tree | bb667f604089aaf9287767ba23a6056e0271eff3 /src/intel/vulkan/anv_allocator.c | |
parent | 799d35087001aa754304d9409d3d52750430e40b (diff) |
anv: setup BO flags at state_pool/block_pool creation
This will allow to set the flags on any anv_bo created/filled from a
state pool or block pool later.
Signed-off-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_allocator.c')
-rw-r--r-- | src/intel/vulkan/anv_allocator.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index ce37ccb4881..8ed32b3c673 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -241,11 +241,13 @@ anv_block_pool_expand_range(struct anv_block_pool *pool, VkResult anv_block_pool_init(struct anv_block_pool *pool, struct anv_device *device, - uint32_t initial_size) + uint32_t initial_size, + uint64_t bo_flags) { VkResult result; pool->device = device; + pool->bo_flags = bo_flags; anv_bo_init(&pool->bo, 0, 0); pool->fd = memfd_create("block pool", MFD_CLOEXEC); @@ -398,6 +400,7 @@ anv_block_pool_expand_range(struct anv_block_pool *pool, * hard work for us. */ anv_bo_init(&pool->bo, gem_handle, size); + pool->bo.flags = pool->bo_flags; pool->bo.map = map; return VK_SUCCESS; @@ -515,8 +518,7 @@ anv_block_pool_grow(struct anv_block_pool *pool, struct anv_block_state *state) result = anv_block_pool_expand_range(pool, center_bo_offset, size); - if (pool->device->instance->physicalDevice.has_exec_async) - pool->bo.flags |= EXEC_OBJECT_ASYNC; + pool->bo.flags = pool->bo_flags; done: pthread_mutex_unlock(&pool->device->mutex); @@ -606,10 +608,12 @@ anv_block_pool_alloc_back(struct anv_block_pool *pool, VkResult anv_state_pool_init(struct anv_state_pool *pool, struct anv_device *device, - uint32_t block_size) + uint32_t block_size, + uint64_t bo_flags) { VkResult result = anv_block_pool_init(&pool->block_pool, device, - block_size * 16); + block_size * 16, + bo_flags); if (result != VK_SUCCESS) return result; @@ -951,9 +955,11 @@ struct bo_pool_bo_link { }; void -anv_bo_pool_init(struct anv_bo_pool *pool, struct anv_device *device) +anv_bo_pool_init(struct anv_bo_pool *pool, struct anv_device *device, + uint64_t bo_flags) { pool->device = device; + pool->bo_flags = bo_flags; memset(pool->free_list, 0, sizeof(pool->free_list)); VG(VALGRIND_CREATE_MEMPOOL(pool, 0, false)); @@ -1005,11 +1011,7 @@ anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo, uint32_t size) if (result != VK_SUCCESS) return result; - if (pool->device->instance->physicalDevice.supports_48bit_addresses) - new_bo.flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS; - - if (pool->device->instance->physicalDevice.has_exec_async) - new_bo.flags |= EXEC_OBJECT_ASYNC; + new_bo.flags = pool->bo_flags; assert(new_bo.size == pow2_size); |