diff options
author | Jason Ekstrand <[email protected]> | 2017-04-23 18:36:33 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-05-04 19:07:54 -0700 |
commit | 6d02ef011e0692e3aa86ea2ee5bb3fc3b4112015 (patch) | |
tree | 6e06e85549b06db3ac1631c2294f208b2fef95d9 | |
parent | 367031a5c82b62ec3359dab862387e679093c9b7 (diff) |
anv/allocator: Remove the state_size field from fixed_size_state_pool
Reviewed-by: Juan A. Suarez Romero <[email protected]>
-rw-r--r-- | src/intel/vulkan/anv_allocator.c | 21 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 1 |
2 files changed, 10 insertions, 12 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index 592ab1caa15..45cbf225db1 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -617,13 +617,9 @@ anv_block_pool_free(struct anv_block_pool *pool, int32_t offset) } static void -anv_fixed_size_state_pool_init(struct anv_fixed_size_state_pool *pool, - uint32_t state_size) +anv_fixed_size_state_pool_init(struct anv_fixed_size_state_pool *pool) { /* At least a cache line and must divide the block size. */ - assert(state_size >= 64 && util_is_power_of_two(state_size)); - - pool->state_size = state_size; pool->free_list = ANV_FREE_LIST_EMPTY; pool->block.next = 0; pool->block.end = 0; @@ -631,8 +627,11 @@ anv_fixed_size_state_pool_init(struct anv_fixed_size_state_pool *pool, static uint32_t anv_fixed_size_state_pool_alloc(struct anv_fixed_size_state_pool *pool, - struct anv_block_pool *block_pool) + struct anv_block_pool *block_pool, + uint32_t state_size) { + assert(state_size >= 64 && util_is_power_of_two(state_size)); + int32_t offset; struct anv_block_state block, old, new; @@ -645,13 +644,13 @@ anv_fixed_size_state_pool_alloc(struct anv_fixed_size_state_pool *pool, /* If free list was empty (or somebody raced us and took the items) we * allocate a new item from the end of the block */ restart: - block.u64 = __sync_fetch_and_add(&pool->block.u64, pool->state_size); + block.u64 = __sync_fetch_and_add(&pool->block.u64, state_size); if (block.next < block.end) { return block.next; } else if (block.next == block.end) { offset = anv_block_pool_alloc(block_pool); - new.next = offset + pool->state_size; + new.next = offset + state_size; new.end = offset + block_pool->block_size; old.u64 = __sync_lock_test_and_set(&pool->block.u64, new.u64); if (old.next != block.next) @@ -677,8 +676,7 @@ anv_state_pool_init(struct anv_state_pool *pool, { pool->block_pool = block_pool; for (unsigned i = 0; i < ANV_STATE_BUCKETS; i++) { - uint32_t size = 1 << (ANV_MIN_STATE_SIZE_LOG2 + i); - anv_fixed_size_state_pool_init(&pool->buckets[i], size); + anv_fixed_size_state_pool_init(&pool->buckets[i]); } VG(VALGRIND_CREATE_MEMPOOL(pool, 0, false)); } @@ -702,7 +700,8 @@ anv_state_pool_alloc_no_vg(struct anv_state_pool *pool, struct anv_state state; state.alloc_size = 1 << size_log2; state.offset = anv_fixed_size_state_pool_alloc(&pool->buckets[bucket], - pool->block_pool); + pool->block_pool, + state.alloc_size); state.map = pool->block_pool->map + state.offset; return state; } diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index bab0e6bd984..7db110e5a32 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -493,7 +493,6 @@ struct anv_state { #define ANV_STATE_NULL ((struct anv_state) { .alloc_size = 0 }) struct anv_fixed_size_state_pool { - uint32_t state_size; union anv_free_list free_list; struct anv_block_state block; }; |