From 682d11a6e8110e817a25c2810fecf994d38cda8f Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Mon, 18 May 2015 15:46:42 -0700 Subject: [PATCH] vk/allocator: Assert that block_pool_grow succeeds --- src/vulkan/allocator.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/vulkan/allocator.c b/src/vulkan/allocator.c index 4c293f12b1a..94b7d548bfc 100644 --- a/src/vulkan/allocator.c +++ b/src/vulkan/allocator.c @@ -313,20 +313,25 @@ anv_block_pool_alloc(struct anv_block_pool *pool) uint32_t offset, block, size; /* Try free list first. */ - if (anv_free_list_pop(&pool->free_list, &pool->map, &offset)) + if (anv_free_list_pop(&pool->free_list, &pool->map, &offset)) { + assert(pool->map); return offset; + } restart: size = pool->size; block = __sync_fetch_and_add(&pool->next_block, pool->block_size); if (block < size) { + assert(pool->map); return block; } else if (block == size) { /* We allocated the first block outside the pool, we have to grow it. * pool->next_block acts a mutex: threads who try to allocate now will * get block indexes above the current limit and hit futex_wait * below. */ - anv_block_pool_grow(pool); + int err = anv_block_pool_grow(pool); + assert(err == 0); + (void) err; futex_wake(&pool->size, INT_MAX); } else { futex_wait(&pool->size, size); -- 2.30.2