anv/trtt: don't wait/signal syncobjs using the CPU anymore

Pass them as part of the TR-TT batch. This is what a lot of the
previous commits were building up to.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25512>
This commit is contained in:
Paulo Zanoni 2023-10-24 12:45:36 -07:00 committed by Marge Bot
parent f2206a0eb1
commit 18bd00c024
3 changed files with 34 additions and 32 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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) {