diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index 823f6c8fe4a..2fdc9d6767e 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -863,7 +863,6 @@ anv_state_pool_init(struct anv_state_pool *pool, assert(util_is_power_of_two_or_zero(block_size)); pool->block_size = block_size; - pool->back_alloc_free_list = ANV_FREE_LIST_EMPTY; for (unsigned i = 0; i < ANV_STATE_BUCKETS; i++) { pool->buckets[i].free_list = ANV_FREE_LIST_EMPTY; pool->buckets[i].block.next = 0; @@ -1131,52 +1130,16 @@ anv_state_pool_alloc(struct anv_state_pool *pool, uint32_t size, uint32_t align) return state; } -struct anv_state -anv_state_pool_alloc_back(struct anv_state_pool *pool) -{ - struct anv_state *state; - uint32_t alloc_size = pool->block_size; - - /* This function is only used with pools where start_offset == 0 */ - assert(pool->start_offset == 0); - - state = anv_free_list_pop(&pool->back_alloc_free_list, &pool->table); - if (state) { - assert(state->offset < pool->start_offset); - goto done; - } - - int32_t offset; - offset = anv_block_pool_alloc_back(&pool->block_pool, - pool->block_size); - uint32_t idx; - UNUSED VkResult result = anv_state_table_add(&pool->table, &idx, 1); - assert(result == VK_SUCCESS); - - state = anv_state_table_get(&pool->table, idx); - state->offset = pool->start_offset + offset; - state->alloc_size = alloc_size; - state->map = anv_block_pool_map(&pool->block_pool, offset, alloc_size); - -done: - VG(VALGRIND_MEMPOOL_ALLOC(pool, state->map, state->alloc_size)); - return *state; -} - static void anv_state_pool_free_no_vg(struct anv_state_pool *pool, struct anv_state state) { assert(util_is_power_of_two_or_zero(state.alloc_size)); unsigned bucket = anv_state_pool_get_bucket(state.alloc_size); - if (state.offset < pool->start_offset) { - assert(state.alloc_size == pool->block_size); - anv_free_list_push(&pool->back_alloc_free_list, - &pool->table, state.idx, 1); - } else { - anv_free_list_push(&pool->buckets[bucket].free_list, - &pool->table, state.idx, 1); - } + assert(state.offset >= pool->start_offset); + + anv_free_list_push(&pool->buckets[bucket].free_list, + &pool->table, state.idx, 1); } void diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index aaa556f2165..005e1cb1c76 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -783,9 +783,6 @@ struct anv_state_pool { /* The size of blocks which will be allocated from the block pool */ uint32_t block_size; - /** Free list for "back" allocations */ - union anv_free_list back_alloc_free_list; - struct anv_fixed_size_state_pool buckets[ANV_STATE_BUCKETS]; }; @@ -836,7 +833,6 @@ VkResult anv_state_pool_init(struct anv_state_pool *pool, 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); -struct anv_state anv_state_pool_alloc_back(struct anv_state_pool *pool); void anv_state_pool_free(struct anv_state_pool *pool, struct anv_state state); void anv_state_stream_init(struct anv_state_stream *stream, struct anv_state_pool *state_pool, @@ -1293,11 +1289,10 @@ anv_binding_table_pool(struct anv_device *device) static inline struct anv_state anv_binding_table_pool_alloc(struct anv_device *device) { - if (anv_use_relocations(device->physical)) - return anv_state_pool_alloc_back(&device->surface_state_pool); - else - return anv_state_pool_alloc(&device->binding_table_pool, - device->binding_table_pool.block_size, 0); + assert(!anv_use_relocations(device->physical)); + + return anv_state_pool_alloc(&device->binding_table_pool, + device->binding_table_pool.block_size, 0); } static inline void