[Mesa-dev] [PATCH 11/18] anv/allocator: Get rid of the ability to free blocks
Juan A. Suarez Romero
jasuarez at igalia.com
Thu Apr 27 16:29:31 UTC 2017
Reviewed-by: Juan A. Suarez Romero <jasuarez at igalia.com>
On Wed, 2017-04-26 at 07:35 -0700, Jason Ekstrand wrote:
> Now that everything is going through the state pools, the block pool no
> longer needs to be able to handle re-use.
> ---
> src/intel/vulkan/anv_allocator.c | 33 ++-------------------------------
> src/intel/vulkan/anv_private.h | 3 ---
> 2 files changed, 2 insertions(+), 34 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
> index 835bcfa..55da3bb 100644
> --- a/src/intel/vulkan/anv_allocator.c
> +++ b/src/intel/vulkan/anv_allocator.c
> @@ -256,8 +256,6 @@ anv_block_pool_init(struct anv_block_pool *pool,
>
> pool->device = device;
> anv_bo_init(&pool->bo, 0, 0);
> - pool->free_list = ANV_FREE_LIST_EMPTY;
> - pool->back_free_list = ANV_FREE_LIST_EMPTY;
>
> pool->fd = memfd_create("block pool", MFD_CLOEXEC);
> if (pool->fd == -1)
> @@ -576,15 +574,6 @@ int32_t
> anv_block_pool_alloc(struct anv_block_pool *pool,
> uint32_t block_size)
> {
> - int32_t offset;
> -
> - /* Try free list first. */
> - if (anv_free_list_pop(&pool->free_list, &pool->map, &offset)) {
> - assert(offset >= 0);
> - assert(pool->map);
> - return offset;
> - }
> -
> return anv_block_pool_alloc_new(pool, &pool->state, block_size);
> }
>
> @@ -601,16 +590,8 @@ int32_t
> anv_block_pool_alloc_back(struct anv_block_pool *pool,
> uint32_t block_size)
> {
> - int32_t offset;
> -
> - /* Try free list first. */
> - if (anv_free_list_pop(&pool->back_free_list, &pool->map, &offset)) {
> - assert(offset < 0);
> - assert(pool->map);
> - return offset;
> - }
> -
> - offset = anv_block_pool_alloc_new(pool, &pool->back_state, block_size);
> + int32_t offset = anv_block_pool_alloc_new(pool, &pool->back_state,
> + block_size);
>
> /* The offset we get out of anv_block_pool_alloc_new() is actually the
> * number of bytes downwards from the middle to the end of the block.
> @@ -622,16 +603,6 @@ anv_block_pool_alloc_back(struct anv_block_pool *pool,
> }
>
> void
> -anv_block_pool_free(struct anv_block_pool *pool, int32_t offset)
> -{
> - if (offset < 0) {
> - anv_free_list_push(&pool->back_free_list, pool->map, offset);
> - } else {
> - anv_free_list_push(&pool->free_list, pool->map, offset);
> - }
> -}
> -
> -void
> anv_state_pool_init(struct anv_state_pool *pool,
> struct anv_block_pool *block_pool,
> uint32_t block_size)
> diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
> index 76dc08a..91a43d1 100644
> --- a/src/intel/vulkan/anv_private.h
> +++ b/src/intel/vulkan/anv_private.h
> @@ -461,10 +461,8 @@ struct anv_block_pool {
> */
> struct u_vector mmap_cleanups;
>
> - union anv_free_list free_list;
> struct anv_block_state state;
>
> - union anv_free_list back_free_list;
> struct anv_block_state back_state;
> };
>
> @@ -567,7 +565,6 @@ int32_t anv_block_pool_alloc(struct anv_block_pool *pool,
> uint32_t block_size);
> int32_t anv_block_pool_alloc_back(struct anv_block_pool *pool,
> uint32_t block_size);
> -void anv_block_pool_free(struct anv_block_pool *pool, int32_t offset);
> void anv_state_pool_init(struct anv_state_pool *pool,
> struct anv_block_pool *block_pool,
> uint32_t block_size);
More information about the mesa-dev
mailing list