venus: stub out renderer sync_fd fencing features

With syncFdFencing feature, venus starts forwarding renderer sync_fd
fencing support. The driver side now can track the renderer sync_fd
fencing features. This change adds the initial stubs.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17975>
This commit is contained in:
Yiwei Zhang 2022-08-12 05:55:34 +00:00 committed by Marge Bot
parent 1498b0877b
commit 64f9fbb9ea
3 changed files with 18 additions and 7 deletions

View file

@ -224,10 +224,12 @@ vn_instance_init_experimental_features(struct vn_instance *instance)
"VkVenusExperimentalFeatures100000MESA is as below:"
"\n\tmemoryResourceAllocationSize = %u"
"\n\tglobalFencing = %u"
"\n\tlargeRing = %u",
"\n\tlargeRing = %u"
"\n\tsyncFdFencing = %u",
instance->experimental.memoryResourceAllocationSize,
instance->experimental.globalFencing,
instance->experimental.largeRing);
instance->experimental.largeRing,
instance->experimental.syncFdFencing);
}
return VK_SUCCESS;

View file

@ -845,8 +845,9 @@ vn_physical_device_init_external_fence_handles(
* vkWaitForFences is translated to repeated vkGetFenceStatus.
*
* External fence is not possible currently. At best, we could cheat by
* translating vkGetFenceFdKHR to vkWaitForFences and returning -1, when
* the handle type is sync file.
* translating vkGetFenceFdKHR to an empty renderer submission for the
* out fence, along with a venus protocol command to fix renderer side
* fence payload.
*
* We would like to create a vn_renderer_sync from a host-side VkFence,
* similar to how a vn_renderer_bo is created from a host-side
@ -856,6 +857,8 @@ vn_physical_device_init_external_fence_handles(
* either of them depending on the occasions, and support external fences
* and idle waiting.
*/
physical_dev->renderer_sync_fd_fence_features = 0;
physical_dev->external_fence_handles = 0;
#ifdef ANDROID
@ -876,9 +879,9 @@ vn_physical_device_init_external_semaphore_handles(
* vkWaitSemaphores is translated to repeated vkGetSemaphoreCounterValue.
*
* External semaphore is not possible currently. We could cheat when the
* semaphore is binary and the handle type is sync file, but that would
* require associating a fence with the semaphore and doing vkWaitForFences
* in vkGetSemaphoreFdKHR.
* semaphore is binary and the handle type is sync file. We could do an
* empty renderer submission for the out fence, along with a venus protocol
* command to fix renderer side semaphore payload.
*
* We would like to create a vn_renderer_sync from a host-side VkSemaphore,
* similar to how a vn_renderer_bo is created from a host-side
@ -888,6 +891,8 @@ vn_physical_device_init_external_semaphore_handles(
* host-side VkSemaphore. That would allow the consumers to wait on the
* host side rather than the guest side.
*/
physical_dev->renderer_sync_fd_semaphore_features = 0;
physical_dev->external_binary_semaphore_handles = 0;
physical_dev->external_timeline_semaphore_handles = 0;

View file

@ -111,6 +111,10 @@ struct vn_physical_device {
VkExternalMemoryHandleTypeFlags supported_handle_types;
} external_memory;
/* syncFdFencing allows driver to query renderer sync_fd features */
VkExternalFenceFeatureFlags renderer_sync_fd_fence_features;
VkExternalSemaphoreFeatureFlags renderer_sync_fd_semaphore_features;
VkExternalFenceHandleTypeFlags external_fence_handles;
VkExternalSemaphoreHandleTypeFlags external_binary_semaphore_handles;
VkExternalSemaphoreHandleTypeFlags external_timeline_semaphore_handles;