aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2020-03-26 12:22:48 -0500
committerMarge Bot <[email protected]>2020-03-31 08:12:07 +0000
commit63bec07e14d1cd8e01bf45bcda341bb364620cfc (patch)
tree21da79e49a38ecf1347e5a13ae82e0a75303137a /src/intel/vulkan
parent6e672074dd1f3c105396a9d7a9bc35ea785569c9 (diff)
anv: Account for the header in anv_state_stream_alloc
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 <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4336>
Diffstat (limited to 'src/intel/vulkan')
-rw-r--r--src/intel/vulkan/anv_allocator.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 4ab5827623e..535657c45d8 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -1226,9 +1226,10 @@ anv_state_stream_alloc(struct anv_state_stream *stream,
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);