From a85b84ba1e205f665787ea643aa20912bebaca09 Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Tue, 11 Jul 2023 12:36:15 +0300 Subject: [PATCH] anv: fix utrace signaling with Xe MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit utrace submits can either have a batch or not. When there is a batch, the utrace vk_sync is signaled by the utrace batch (because utrace does a timestamp buffer copy using its own batch). When there is no batch, the utrace vk_sync should be signaled by the application batch (no timestamp copy required, utrace can read the timestamps when the application batch has completed). Signed-off-by: Lionel Landwerlin Fixes: fdea48df5e ("anv: Implement Xe version of anv_queue_exec_locked() and queue_exec_trace()") Reviewed-by: José Roberto de Souza Part-of: --- src/intel/vulkan/xe/anv_batch_chain.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/intel/vulkan/xe/anv_batch_chain.c b/src/intel/vulkan/xe/anv_batch_chain.c index bad00dc..dbcf989 100644 --- a/src/intel/vulkan/xe/anv_batch_chain.c +++ b/src/intel/vulkan/xe/anv_batch_chain.c @@ -119,7 +119,10 @@ xe_exec_process_syncs(struct anv_queue *queue, uint32_t count = 0; - if (utrace_submit) { + /* Signal the utrace sync only if it doesn't have a batch. Otherwise the + * it's the utrace batch that should signal its own sync. + */ + if (utrace_submit && !utrace_submit->batch_bo) { struct drm_xe_sync *xe_sync = &xe_syncs[count++]; xe_exec_fill_sync(xe_sync, utrace_submit->sync, 0, TYPE_SIGNAL); @@ -217,9 +220,6 @@ xe_queue_exec_locked(struct anv_queue *queue, if (result != VK_SUCCESS) return result; - if (utrace_submit && !utrace_submit->batch_bo) - utrace_submit = NULL; - struct drm_xe_sync *xe_syncs = NULL; uint32_t xe_syncs_count = 0; result = xe_exec_process_syncs(queue, wait_count, waits, @@ -229,6 +229,10 @@ xe_queue_exec_locked(struct anv_queue *queue, if (result != VK_SUCCESS) return result; + /* If we have no batch for utrace, just forget about it now. */ + if (utrace_submit && !utrace_submit->batch_bo) + utrace_submit = NULL; + struct drm_xe_exec exec = { .engine_id = queue->engine_id, .num_batch_buffer = 1, -- 2.7.4