venus: make vn_QueueSubmit async for native submissions

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14657>
This commit is contained in:
Yiwei Zhang 2022-01-21 23:36:33 +00:00 committed by Marge Bot
parent 15e7750446
commit 3f9eb4fdf4
2 changed files with 18 additions and 2 deletions

View File

@ -683,6 +683,12 @@ vn_QueueSignalReleaseImageANDROID(VkQueue queue,
return vn_error(dev->instance, result);
if (dev->instance->experimental.globalFencing == VK_TRUE) {
/* XXX With globalFencing, the external queue fence was not passed in the
* above vn_QueueSubmit to hint it to be synchronous. So we need to wait
* for the ring here before vn_GetFenceFdKHR which is pure kernel ops.
*/
vn_instance_ring_wait(dev->instance);
const VkFenceGetFdInfoKHR fd_info = {
.sType = VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR,
.pNext = NULL,

View File

@ -335,15 +335,17 @@ VkResult
vn_QueueSubmit(VkQueue _queue,
uint32_t submitCount,
const VkSubmitInfo *pSubmits,
VkFence fence)
VkFence _fence)
{
VN_TRACE_FUNC();
struct vn_queue *queue = vn_queue_from_handle(_queue);
struct vn_device *dev = queue->device;
struct vn_fence *fence = vn_fence_from_handle(_fence);
const bool is_fence_external = fence && fence->is_external;
struct vn_queue_submission submit;
VkResult result = vn_queue_submission_prepare_submit(
&submit, _queue, submitCount, pSubmits, fence);
&submit, _queue, submitCount, pSubmits, _fence);
if (result != VK_SUCCESS)
return vn_error(dev->instance, VK_ERROR_OUT_OF_HOST_MEMORY);
@ -357,6 +359,14 @@ vn_QueueSubmit(VkQueue _queue,
}
}
/* TODO defer roundtrip for external fence until the next sync operation */
if (!wsi_mem && !is_fence_external) {
vn_async_vkQueueSubmit(dev->instance, submit.queue, submit.batch_count,
submit.submit_batches, submit.fence);
vn_queue_submission_cleanup(&submit);
return VK_SUCCESS;
}
result =
vn_call_vkQueueSubmit(dev->instance, submit.queue, submit.batch_count,
submit.submit_batches, submit.fence);