diff --git a/src/intel/vulkan/anv_sparse.c b/src/intel/vulkan/anv_sparse.c index 60012b3efc9..a3fe2c1ecae 100644 --- a/src/intel/vulkan/anv_sparse.c +++ b/src/intel/vulkan/anv_sparse.c @@ -581,35 +581,8 @@ anv_sparse_bind_trtt(struct anv_device *device, sparse_submit->binds_len, trtt_submit.l3l2_binds_len, trtt_submit.l1_binds_len); - /* TODO: make both the syncs and signals be passed as part of the vm_bind - * ioctl so they can be waited asynchronously. For now this doesn't matter - * as we're doing synchronous vm_bind, but later when we make it async this - * will make a difference. - */ - result = vk_sync_wait_many(&device->vk, sparse_submit->wait_count, - sparse_submit->waits, VK_SYNC_WAIT_COMPLETE, - INT64_MAX); - if (result != VK_SUCCESS) { - result = vk_queue_set_lost(&sparse_submit->queue->vk, - "vk_sync_wait failed"); - goto out; - } - - if (trtt_submit.l3l2_binds_len || trtt_submit.l1_binds_len) { + if (trtt_submit.l3l2_binds_len || trtt_submit.l1_binds_len) result = anv_genX(device->info, write_trtt_entries)(&trtt_submit); - if (result != VK_SUCCESS) - goto out; - } - - for (uint32_t i = 0; i < sparse_submit->signal_count; i++) { - struct vk_sync_signal *s = &sparse_submit->signals[i]; - result = vk_sync_signal(&device->vk, s->sync, s->signal_value); - if (result != VK_SUCCESS) { - result = vk_queue_set_lost(&sparse_submit->queue->vk, - "vk_sync_signal failed"); - goto out; - } - } out: pthread_mutex_unlock(&trtt->mutex); diff --git a/src/intel/vulkan/i915/anv_batch_chain.c b/src/intel/vulkan/i915/anv_batch_chain.c index caf2d1b1de0..7b0e161f93f 100644 --- a/src/intel/vulkan/i915/anv_batch_chain.c +++ b/src/intel/vulkan/i915/anv_batch_chain.c @@ -992,6 +992,22 @@ i915_execute_trtt_batch(struct anv_sparse_submission *submit, }; VkResult result; + for (uint32_t i = 0; i < submit->wait_count; i++) { + result = anv_execbuf_add_sync(device, &execbuf, submit->waits[i].sync, + false /* is_signal */, + submit->waits[i].wait_value); + if (result != VK_SUCCESS) + goto out; + } + + for (uint32_t i = 0; i < submit->signal_count; i++) { + result = anv_execbuf_add_sync(device, &execbuf, submit->signals[i].sync, + true /* is_signal */, + submit->signals[i].signal_value); + if (result != VK_SUCCESS) + goto out; + } + result = anv_execbuf_add_bo(device, &execbuf, device->workaround_bo, NULL, 0); if (result != VK_SUCCESS) @@ -1024,6 +1040,7 @@ i915_execute_trtt_batch(struct anv_sparse_submission *submit, .rsvd1 = context_id, .rsvd2 = 0, }; + setup_execbuf_fence_params(&execbuf); int ret = queue->device->info->no_hw ? 0 : anv_gem_execbuffer(device, &execbuf.execbuf); diff --git a/src/intel/vulkan/xe/anv_batch_chain.c b/src/intel/vulkan/xe/anv_batch_chain.c index 0643258632b..ad71f8acf9a 100644 --- a/src/intel/vulkan/xe/anv_batch_chain.c +++ b/src/intel/vulkan/xe/anv_batch_chain.c @@ -195,16 +195,28 @@ xe_execute_trtt_batch(struct anv_sparse_submission *submit, if (drmSyncobjCreate(device->fd, 0, &syncobj_handle)) return vk_errorf(device, VK_ERROR_UNKNOWN, "Unable to create sync obj"); - struct drm_xe_sync sync = { + struct drm_xe_sync extra_sync = { .flags = DRM_XE_SYNC_SYNCOBJ | DRM_XE_SYNC_SIGNAL, .handle = syncobj_handle, }; + + struct drm_xe_sync *xe_syncs = NULL; + uint32_t xe_syncs_count = 0; + result = xe_exec_process_syncs(queue, submit->wait_count, submit->waits, + submit->signal_count, submit->signals, + 1, &extra_sync, + NULL, /* utrace_submit */ + false, /* is_companion_rcs_queue */ + &xe_syncs, &xe_syncs_count); + if (result != VK_SUCCESS) + goto exec_error; + struct drm_xe_exec exec = { .exec_queue_id = queue->exec_queue_id, - .num_batch_buffer = 1, + .num_syncs = xe_syncs_count, + .syncs = (uintptr_t)xe_syncs, .address = batch_bo->offset, - .num_syncs = 1, - .syncs = (uintptr_t)&sync, + .num_batch_buffer = 1, }; if (!device->info->no_hw) {