From 927f54de68c6241076b18244dbf264b81b09bca0 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 15 Jul 2015 17:10:58 -0700 Subject: [PATCH] vk/cmd_buffer: Move batch buffer padding to anv_batch_bo_finish() --- src/vulkan/anv_cmd_buffer.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index 8ccecd8f63b..0d24d0bda02 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -241,6 +241,10 @@ anv_batch_bo_start(struct anv_batch_bo *bbo, struct anv_batch *batch, static void anv_batch_bo_finish(struct anv_batch_bo *bbo, struct anv_batch *batch) { + /* Round batch up to an even number of dwords. */ + if ((batch->next - batch->start) & 4) + anv_batch_emit(batch, GEN8_MI_NOOP); + assert(batch->start == bbo->bo.map); bbo->length = batch->next - batch->start; VG(VALGRIND_CHECK_MEM_IS_DEFINED(batch->start, bbo->length)); @@ -283,12 +287,6 @@ anv_cmd_buffer_chain_batch(struct anv_batch *batch, void *_data) .BatchBufferStartAddress = { &new_bbo->bo, 0 }, ); - /* Pad out to a 2-dword aligned boundary with zeros */ - if ((uintptr_t)batch->next % 8 != 0) { - *(uint32_t *)batch->next = 0; - batch->next += 4; - } - anv_batch_bo_finish(cmd_buffer->last_batch_bo, batch); new_bbo->prev_batch_bo = old_bbo; @@ -607,10 +605,6 @@ VkResult anv_EndCommandBuffer( anv_batch_emit(batch, GEN8_MI_BATCH_BUFFER_END); - /* Round batch up to an even number of dwords. */ - if ((batch->next - batch->start) & 4) - anv_batch_emit(batch, GEN8_MI_NOOP); - anv_batch_bo_finish(cmd_buffer->last_batch_bo, &cmd_buffer->batch); cmd_buffer->surface_batch_bo->num_relocs = cmd_buffer->surface_relocs.num_relocs - cmd_buffer->surface_batch_bo->first_reloc; -- 2.30.2