diff options
author | Jason Ekstrand <[email protected]> | 2017-05-03 09:43:58 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-05-04 19:07:54 -0700 |
commit | 98cd5120896c3c1229d1ed63ab7d189a1486597f (patch) | |
tree | c391707c43af8b12b66cc2f9aa9da00900ed8bf5 /src/intel/vulkan | |
parent | 24827fdf505e68234f6099785c659fa84bb33e04 (diff) |
anv/allocator: Improve block pool growing asserts
Reviewed-by: Juan A. Suarez Romero <[email protected]>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r-- | src/intel/vulkan/anv_allocator.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c index a05aaf8fabd..e2f2dea5699 100644 --- a/src/intel/vulkan/anv_allocator.c +++ b/src/intel/vulkan/anv_allocator.c @@ -340,6 +340,11 @@ anv_block_pool_expand_range(struct anv_block_pool *pool, assert(center_bo_offset >= pool->back_state.end); assert(size - center_bo_offset >= pool->state.end); + /* Assert that we don't go outside the bounds of the memfd */ + assert(center_bo_offset <= BLOCK_POOL_MEMFD_CENTER); + assert(size - center_bo_offset <= + BLOCK_POOL_MEMFD_SIZE - BLOCK_POOL_MEMFD_CENTER); + cleanup = u_vector_add(&pool->mmap_cleanups); if (!cleanup) return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); @@ -495,12 +500,6 @@ anv_block_pool_grow(struct anv_block_pool *pool, struct anv_block_state *state) assert(size > pool->bo.size); - /* We can't have a block pool bigger than 1GB because we use signed - * 32-bit offsets in the free list and we don't want overflow. We - * should never need a block pool bigger than 1GB anyway. - */ - assert(size <= (1u << 31)); - /* We compute a new center_bo_offset such that, when we double the size * of the pool, we maintain the ratio of how much is used by each side. * This way things should remain more-or-less balanced. |