From a13ac83f1b95ba3829f1f39ec932df8ddd8733de Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Thu, 22 Jun 2023 12:20:03 +0300 Subject: [PATCH] anv: fix utrace batch allocation The introduction of a workaround adding lots of MI_NOOPs broke our computation. Signed-off-by: Lionel Landwerlin Fixes: b9aa66d5d0 ("anv: disable preemption for 3DPRIMITIVE during streamout") Reviewed-by: Felix DeGrood Part-of: --- src/intel/vulkan/anv_utrace.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_utrace.c b/src/intel/vulkan/anv_utrace.c index 85ed8d62caa..00957a93862 100644 --- a/src/intel/vulkan/anv_utrace.c +++ b/src/intel/vulkan/anv_utrace.c @@ -151,9 +151,18 @@ anv_device_utrace_flush_cmd_buffers(struct anv_queue *queue, if (result != VK_SUCCESS) goto error_trace_buf; + uint32_t batch_size = 512; /* 128 dwords of setup */ + if (intel_needs_workaround(device->info, 16013994831)) { + /* Enable/Disable preemption at the begin/end */ + batch_size += 2 * (250 /* 250 MI_NOOPs*/ + + 6 /* PIPE_CONTROL */ + + 3 /* MI_LRI */) * 4 /* dwords */; + } + batch_size += 256 * utrace_copies; /* 64 dwords per copy */ + batch_size = align(batch_size + 4, 8); /* MI_BATCH_BUFFER_END */ + result = anv_bo_pool_alloc(&device->utrace_bo_pool, - /* 128 dwords of setup + 64 dwords per copy */ - align(512 + 64 * utrace_copies, 4096), + align(batch_size, 4096), &submit->batch_bo); if (result != VK_SUCCESS) goto error_batch_buf;