If we have an allocation that's exactly the block size, we end up
computing a new block size to allocate that's exactly the block size,
add in the header, and then assert fail. When computing the block size,
we need to account for the header.
Fixes: 955127db937 "anv/allocator: Add support for large stream..."
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4336>
uint32_t offset = align_u32(stream->next, alignment);
if (offset + size > stream->block.alloc_size) {
+ uint32_t min_block_size = size + sizeof(struct anv_state_stream_block);
uint32_t block_size = stream->block_size;
- if (block_size < size)
- block_size = round_to_power_of_two(size);
+ if (block_size < min_block_size)
+ block_size = round_to_power_of_two(min_block_size);
stream->block = anv_state_pool_alloc_no_vg(stream->state_pool,
block_size, PAGE_SIZE);