diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 19a6314c480..95882c0de21 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -2056,6 +2056,23 @@ anv_trtt_batch_bo_free(struct anv_device *device, void anv_queue_trace(struct anv_queue *queue, const char *label, bool frame, bool begin); +static inline VkResult +anv_queue_post_submit(struct anv_queue *queue, VkResult submit_result) +{ + if (submit_result != VK_SUCCESS) + return submit_result; + + VkResult result = VK_SUCCESS; + if (queue->sync) { + result = vk_sync_wait(&queue->device->vk, queue->sync, 0, + VK_SYNC_WAIT_COMPLETE, UINT64_MAX); + if (result != VK_SUCCESS) + result = vk_queue_set_lost(&queue->vk, "sync wait failed"); + } + + return result; +} + void * anv_gem_mmap(struct anv_device *device, struct anv_bo *bo, uint64_t offset, uint64_t size); diff --git a/src/intel/vulkan/i915/anv_batch_chain.c b/src/intel/vulkan/i915/anv_batch_chain.c index 1f44990f090..743a6b765eb 100644 --- a/src/intel/vulkan/i915/anv_batch_chain.c +++ b/src/intel/vulkan/i915/anv_batch_chain.c @@ -918,12 +918,7 @@ i915_queue_exec_locked(struct anv_queue *queue, waits); } - if (result == VK_SUCCESS && queue->sync) { - result = vk_sync_wait(&device->vk, queue->sync, 0, - VK_SYNC_WAIT_COMPLETE, UINT64_MAX); - if (result != VK_SUCCESS) - result = vk_queue_set_lost(&queue->vk, "sync wait failed"); - } + result = anv_queue_post_submit(queue, result); error: anv_execbuf_finish(&execbuf); diff --git a/src/intel/vulkan/xe/anv_batch_chain.c b/src/intel/vulkan/xe/anv_batch_chain.c index 438607e0b36..02843f5877e 100644 --- a/src/intel/vulkan/xe/anv_batch_chain.c +++ b/src/intel/vulkan/xe/anv_batch_chain.c @@ -411,12 +411,7 @@ xe_queue_exec_locked(struct anv_queue *queue, wait_count, waits); } - if (result == VK_SUCCESS && queue->sync) { - result = vk_sync_wait(&device->vk, queue->sync, 0, - VK_SYNC_WAIT_COMPLETE, UINT64_MAX); - if (result != VK_SUCCESS) - result = vk_queue_set_lost(&queue->vk, "sync wait failed"); - } + result = anv_queue_post_submit(queue, result); if (result == VK_SUCCESS && utrace_submit) result = xe_queue_exec_utrace_locked(queue, utrace_submit);