summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/intel/vulkan/anv_allocator.c24
-rw-r--r--src/intel/vulkan/anv_device.c18
-rw-r--r--src/intel/vulkan/anv_private.h13
-rw-r--r--src/intel/vulkan/tests/block_pool_no_free.c2
-rw-r--r--src/intel/vulkan/tests/state_pool.c2
-rw-r--r--src/intel/vulkan/tests/state_pool_free_list_only.c2
-rw-r--r--src/intel/vulkan/tests/state_pool_no_free.c2
7 files changed, 41 insertions, 22 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);
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 3aa213e205b..fccf6a63778 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -1211,21 +1211,31 @@ VkResult anv_CreateDevice(
}
pthread_condattr_destroy(&condattr);
- anv_bo_pool_init(&device->batch_bo_pool, device);
+ uint64_t bo_flags =
+ (physical_device->supports_48bit_addresses ? EXEC_OBJECT_SUPPORTS_48B_ADDRESS : 0) |
+ (physical_device->has_exec_async ? EXEC_OBJECT_ASYNC : 0);
+
+ anv_bo_pool_init(&device->batch_bo_pool, device, bo_flags);
result = anv_bo_cache_init(&device->bo_cache);
if (result != VK_SUCCESS)
goto fail_batch_bo_pool;
- result = anv_state_pool_init(&device->dynamic_state_pool, device, 16384);
+ /* For the state pools we explicitly disable 48bit. */
+ bo_flags = physical_device->has_exec_async ? EXEC_OBJECT_ASYNC : 0;
+
+ result = anv_state_pool_init(&device->dynamic_state_pool, device, 16384,
+ bo_flags);
if (result != VK_SUCCESS)
goto fail_bo_cache;
- result = anv_state_pool_init(&device->instruction_state_pool, device, 16384);
+ result = anv_state_pool_init(&device->instruction_state_pool, device, 16384,
+ bo_flags);
if (result != VK_SUCCESS)
goto fail_dynamic_state_pool;
- result = anv_state_pool_init(&device->surface_state_pool, device, 4096);
+ result = anv_state_pool_init(&device->surface_state_pool, device, 4096,
+ bo_flags);
if (result != VK_SUCCESS)
goto fail_instruction_state_pool;
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index e17a52a4a70..f9770788a6d 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -551,6 +551,8 @@ struct anv_block_state {
struct anv_block_pool {
struct anv_device *device;
+ uint64_t bo_flags;
+
struct anv_bo bo;
/* The offset from the start of the bo to the "center" of the block
@@ -649,7 +651,8 @@ struct anv_state_stream {
*/
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);
void anv_block_pool_finish(struct anv_block_pool *pool);
int32_t anv_block_pool_alloc(struct anv_block_pool *pool,
uint32_t block_size);
@@ -658,7 +661,8 @@ int32_t 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);
void anv_state_pool_finish(struct anv_state_pool *pool);
struct anv_state anv_state_pool_alloc(struct anv_state_pool *pool,
uint32_t state_size, uint32_t alignment);
@@ -678,10 +682,13 @@ struct anv_state anv_state_stream_alloc(struct anv_state_stream *stream,
struct anv_bo_pool {
struct anv_device *device;
+ uint64_t bo_flags;
+
void *free_list[16];
};
-void anv_bo_pool_init(struct anv_bo_pool *pool, struct anv_device *device);
+void anv_bo_pool_init(struct anv_bo_pool *pool, struct anv_device *device,
+ uint64_t bo_flags);
void anv_bo_pool_finish(struct anv_bo_pool *pool);
VkResult anv_bo_pool_alloc(struct anv_bo_pool *pool, struct anv_bo *bo,
uint32_t size);
diff --git a/src/intel/vulkan/tests/block_pool_no_free.c b/src/intel/vulkan/tests/block_pool_no_free.c
index 4ddbbb24bbf..0d08526e632 100644
--- a/src/intel/vulkan/tests/block_pool_no_free.c
+++ b/src/intel/vulkan/tests/block_pool_no_free.c
@@ -116,7 +116,7 @@ static void run_test()
struct anv_block_pool pool;
pthread_mutex_init(&device.mutex, NULL);
- anv_block_pool_init(&pool, &device, 4096);
+ anv_block_pool_init(&pool, &device, 4096, 0);
for (unsigned i = 0; i < NUM_THREADS; i++) {
jobs[i].pool = &pool;
diff --git a/src/intel/vulkan/tests/state_pool.c b/src/intel/vulkan/tests/state_pool.c
index 249fe64fe92..99ac7968d88 100644
--- a/src/intel/vulkan/tests/state_pool.c
+++ b/src/intel/vulkan/tests/state_pool.c
@@ -43,7 +43,7 @@ int main(int argc, char **argv)
pthread_mutex_init(&device.mutex, NULL);
for (unsigned i = 0; i < NUM_RUNS; i++) {
- anv_state_pool_init(&state_pool, &device, 256);
+ anv_state_pool_init(&state_pool, &device, 256, 0);
/* Grab one so a zero offset is impossible */
anv_state_pool_alloc(&state_pool, 16, 16);
diff --git a/src/intel/vulkan/tests/state_pool_free_list_only.c b/src/intel/vulkan/tests/state_pool_free_list_only.c
index 6a04d641ce4..9370b8680ac 100644
--- a/src/intel/vulkan/tests/state_pool_free_list_only.c
+++ b/src/intel/vulkan/tests/state_pool_free_list_only.c
@@ -40,7 +40,7 @@ int main(int argc, char **argv)
struct anv_state_pool state_pool;
pthread_mutex_init(&device.mutex, NULL);
- anv_state_pool_init(&state_pool, &device, 4096);
+ anv_state_pool_init(&state_pool, &device, 4096, 0);
/* Grab one so a zero offset is impossible */
anv_state_pool_alloc(&state_pool, 16, 16);
diff --git a/src/intel/vulkan/tests/state_pool_no_free.c b/src/intel/vulkan/tests/state_pool_no_free.c
index 1ba832cf665..021137337f8 100644
--- a/src/intel/vulkan/tests/state_pool_no_free.c
+++ b/src/intel/vulkan/tests/state_pool_no_free.c
@@ -61,7 +61,7 @@ static void run_test()
struct anv_state_pool state_pool;
pthread_mutex_init(&device.mutex, NULL);
- anv_state_pool_init(&state_pool, &device, 64);
+ anv_state_pool_init(&state_pool, &device, 64, 0);
pthread_barrier_init(&barrier, NULL, NUM_THREADS);