anv/sparse: move waiting/signaling syncobjs to the backends
Move waiting/signaling to the backends so we can fix each backend separately. As I write this patch the vm_bind backend is back to using synchronous vm_binds so we can't pass syncobjs to the synchronous vm_bind ioctl anymore. We'll need more discussions and possibly some rework before we go back to asynchronous vm_binds. This commit should allow us to fix the TR-TT backend in the next commit and leave vm_bind for later. 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:
@@ -1444,16 +1444,6 @@ anv_queue_submit_sparse_bind_locked(struct anv_queue *queue,
|
||||
.signals = submit->signals,
|
||||
};
|
||||
|
||||
/* 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, submit->wait_count, submit->waits,
|
||||
VK_SYNC_WAIT_COMPLETE, INT64_MAX);
|
||||
if (result != VK_SUCCESS)
|
||||
return vk_queue_set_lost(&queue->vk, "vk_sync_wait failed");
|
||||
|
||||
for (uint32_t i = 0; i < submit->buffer_bind_count; i++) {
|
||||
VkSparseBufferMemoryBindInfo *bind_info = &submit->buffer_binds[i];
|
||||
ANV_FROM_HANDLE(anv_buffer, buffer, bind_info->buffer);
|
||||
@@ -1506,17 +1496,6 @@ anv_queue_submit_sparse_bind_locked(struct anv_queue *queue,
|
||||
}
|
||||
|
||||
result = anv_sparse_bind(device, &sparse_submit);
|
||||
if (result != VK_SUCCESS)
|
||||
goto out_free_submit;
|
||||
|
||||
for (uint32_t i = 0; i < submit->signal_count; i++) {
|
||||
struct vk_sync_signal *s = &submit->signals[i];
|
||||
result = vk_sync_signal(&device->vk, s->sync, s->signal_value);
|
||||
if (result != VK_SUCCESS) {
|
||||
result = vk_queue_set_lost(&queue->vk, "vk_sync_signal failed");
|
||||
goto out_free_submit;
|
||||
}
|
||||
}
|
||||
|
||||
out_free_submit:
|
||||
vk_free(&device->vk.alloc, sparse_submit.binds);
|
||||
|
||||
@@ -581,8 +581,35 @@ anv_sparse_bind_trtt(struct anv_device *device,
|
||||
sparse_submit->binds_len, trtt_submit.l3l2_binds_len,
|
||||
trtt_submit.l1_binds_len);
|
||||
|
||||
if (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) {
|
||||
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);
|
||||
@@ -595,6 +622,22 @@ static VkResult
|
||||
anv_sparse_bind_vm_bind(struct anv_device *device,
|
||||
struct anv_sparse_submission *submit)
|
||||
{
|
||||
struct anv_queue *queue = submit->queue;
|
||||
VkResult result;
|
||||
|
||||
if (!queue)
|
||||
assert(submit->wait_count == 0 && submit->signal_count == 0);
|
||||
|
||||
/* 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, submit->wait_count, submit->waits,
|
||||
VK_SYNC_WAIT_COMPLETE, INT64_MAX);
|
||||
if (result != VK_SUCCESS)
|
||||
return vk_queue_set_lost(&queue->vk, "vk_sync_wait failed");
|
||||
|
||||
/* FIXME: here we were supposed to issue a single vm_bind ioctl by calling
|
||||
* vm_bind(device, num_binds, binds), but for an unknown reason some
|
||||
* shader-related tests fail when we do that, so work around it for now.
|
||||
@@ -613,6 +656,14 @@ anv_sparse_bind_vm_bind(struct anv_device *device,
|
||||
if (rc)
|
||||
return vk_error(device, VK_ERROR_OUT_OF_DEVICE_MEMORY);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < submit->signal_count; i++) {
|
||||
struct vk_sync_signal *s = &submit->signals[i];
|
||||
result = vk_sync_signal(&device->vk, s->sync, s->signal_value);
|
||||
if (result != VK_SUCCESS)
|
||||
return vk_queue_set_lost(&queue->vk, "vk_sync_signal failed");
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user