From b8f93bfd38c31cb5e6debee2e5f4f5efeb342994 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Roberto=20de=20Souza?= Date: Mon, 16 Dec 2024 10:32:11 -0800 Subject: [PATCH] anv: Always create anv_async_submit in init_copy_video_queue_state() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A next patch will emit more instructions in video and copy queues for Gfx 200 and newer but the current code only creates anv_async_submit if device has aux_map. Instead we can always create anv_async_submit and only submit it to hardware if any instruction was emited. Fixes: 86813c60a498 ("mi-builder: add read/write memory fencing support on Gfx20+") Reviewed-by: Lionel Landwerlin Signed-off-by: José Roberto de Souza Part-of: --- src/intel/vulkan/genX_init_state.c | 32 +++++++++++++++++------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/intel/vulkan/genX_init_state.c b/src/intel/vulkan/genX_init_state.c index ab093f202e2..2c1764ee9c0 100644 --- a/src/intel/vulkan/genX_init_state.c +++ b/src/intel/vulkan/genX_init_state.c @@ -802,20 +802,20 @@ init_compute_queue_state(struct anv_queue *queue) static VkResult init_copy_video_queue_state(struct anv_queue *queue) { -#if GFX_VER >= 12 struct anv_device *device = queue->device; - const struct intel_device_info *devinfo = device->info; + UNUSED const struct intel_device_info *devinfo = device->info; + struct anv_async_submit *submit; + VkResult result = anv_async_submit_create(queue, + &device->batch_bo_pool, + false, true, &submit); + if (result != VK_SUCCESS) + return result; + + struct anv_batch *batch = &submit->batch; + +#if GFX_VER >= 12 if (devinfo->has_aux_map) { - struct anv_async_submit *submit; - VkResult result = anv_async_submit_create(queue, - &device->batch_bo_pool, - false, true, &submit); - if (result != VK_SUCCESS) - return result; - - struct anv_batch *batch = &submit->batch; - uint64_t reg = GENX(VD0_AUX_TABLE_BASE_ADDR_num); if (queue->family->engine_class == INTEL_ENGINE_CLASS_COPY) { @@ -835,7 +835,12 @@ init_copy_video_queue_state(struct anv_queue *queue) lri.RegisterOffset = reg + 4; lri.DataDWord = aux_base_addr >> 32; } + } +#else + assert(!queue->device->info->has_aux_map); +#endif + if (batch->start != batch->next) { anv_batch_emit(batch, GENX(MI_BATCH_BUFFER_END), bbe); result = batch->status; @@ -851,10 +856,9 @@ init_copy_video_queue_state(struct anv_queue *queue) } queue->init_submit = submit; + } else { + anv_async_submit_destroy(submit); } -#else - assert(!queue->device->info->has_aux_map); -#endif return VK_SUCCESS; }