diff --git a/src/intel/vulkan/xe/anv_batch_chain.c b/src/intel/vulkan/xe/anv_batch_chain.c index 22ccaa4763a..5c9fed16ccb 100644 --- a/src/intel/vulkan/xe/anv_batch_chain.c +++ b/src/intel/vulkan/xe/anv_batch_chain.c @@ -114,9 +114,15 @@ xe_exec_process_syncs(struct anv_queue *queue, struct drm_xe_sync **ret, uint32_t *ret_count) { struct anv_device *device = queue->device; - uint32_t num_syncs = wait_count + signal_count + extra_sync_count + - (utrace_submit ? 1 : 0) + - ((queue->sync && !is_companion_rcs_queue) ? 1 : 0); + /* 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. + */ + const bool has_utrace_sync = utrace_submit && + util_dynarray_num_elements(&utrace_submit->batch_bos, struct anv_bo *) == 0; + const uint32_t num_syncs = wait_count + signal_count + extra_sync_count + + (has_utrace_sync ? 1 : 0) + + ((queue->sync && !is_companion_rcs_queue) ? 1 : 0); + if (!num_syncs) return VK_SUCCESS; @@ -128,12 +134,7 @@ xe_exec_process_syncs(struct anv_queue *queue, uint32_t count = 0; - /* 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 && - util_dynarray_num_elements(&utrace_submit->batch_bos, - struct anv_bo *) == 0) { + if (has_utrace_sync) { struct drm_xe_sync *xe_sync = &xe_syncs[count++]; xe_exec_fill_sync(xe_sync, utrace_submit->sync, 0, TYPE_SIGNAL);