From 87b19c68d8bc33dfc2c61550e50fb6890b47656c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Wed, 10 Aug 2022 12:02:31 -0700 Subject: [PATCH] anv: Do not copy garbage to batch_bo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit batch_size is the aligned value so it is >= than the actual number of bytes in anv_batch. Reviewed-by: Lionel Landwerlin Signed-off-by: José Roberto de Souza Part-of: --- src/intel/vulkan/anv_batch_chain.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_batch_chain.c b/src/intel/vulkan/anv_batch_chain.c index e81df2f2086..c65c0f33fa7 100644 --- a/src/intel/vulkan/anv_batch_chain.c +++ b/src/intel/vulkan/anv_batch_chain.c @@ -2425,10 +2425,11 @@ anv_queue_submit_simple_batch(struct anv_queue *queue, */ assert(vk_queue_is_empty(&queue->vk)); - uint32_t batch_size = align_u32(batch->next - batch->start, 8); + const uint32_t batch_size = batch->next - batch->start; + const uint32_t batch_bo_size = align_u32(batch_size, 8); struct anv_bo *batch_bo = NULL; - result = anv_bo_pool_alloc(&device->batch_bo_pool, batch_size, &batch_bo); + result = anv_bo_pool_alloc(&device->batch_bo_pool, batch_bo_size, &batch_bo); if (result != VK_SUCCESS) return result;