mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-12 00:20:43 +01:00
vulkan: external sync for vk_sync_binary
Venus uses vkImportSemaphoreFdKHR() with FD == -1 to signal a binary semaphore and vkGetSemaphoreFdKHR() to wait on a binary semaphore. Both KK and Dzn uses vk_sync_binary so supporting this special case for import/export sync file will enable Venus host support. Reviewed-by: Aitor Camacho <aitor@lunarg.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39067>
This commit is contained in:
parent
07260dc210
commit
5f8a9f0aeb
1 changed files with 26 additions and 1 deletions
|
|
@ -24,6 +24,7 @@
|
|||
#include "vk_sync_binary.h"
|
||||
|
||||
#include "vk_util.h"
|
||||
#include "util/os_time.h"
|
||||
|
||||
static struct vk_sync_binary *
|
||||
to_vk_sync_binary(struct vk_sync *sync)
|
||||
|
|
@ -44,7 +45,6 @@ vk_sync_binary_init(struct vk_device *device,
|
|||
container_of(binary->sync.type, struct vk_sync_binary_type, sync);
|
||||
|
||||
assert(!(sync->flags & VK_SYNC_IS_TIMELINE));
|
||||
assert(!(sync->flags & VK_SYNC_IS_SHAREABLE));
|
||||
|
||||
binary->next_point = (initial_value == 0);
|
||||
|
||||
|
|
@ -114,6 +114,29 @@ vk_sync_binary_wait_many(struct vk_device *device,
|
|||
return result;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
vk_sync_binary_import_sync_file(struct vk_device *device,
|
||||
struct vk_sync *sync,
|
||||
int fd)
|
||||
{
|
||||
/* FD == -1 case handled by vk_sync_import_sync_file() */
|
||||
return VK_ERROR_INVALID_EXTERNAL_HANDLE;
|
||||
}
|
||||
|
||||
static VkResult
|
||||
vk_sync_binary_export_sync_file(struct vk_device *device,
|
||||
struct vk_sync *sync,
|
||||
int *pFd)
|
||||
{
|
||||
VkResult result;
|
||||
struct vk_sync_binary *binary = to_vk_sync_binary(sync);
|
||||
|
||||
result = vk_sync_wait(device, &binary->timeline, binary->next_point, 0,
|
||||
OS_TIMEOUT_INFINITE);
|
||||
*pFd = -1;
|
||||
return result;
|
||||
}
|
||||
|
||||
struct vk_sync_binary_type
|
||||
vk_sync_binary_get_type(const struct vk_sync_type *timeline_type)
|
||||
{
|
||||
|
|
@ -135,6 +158,8 @@ vk_sync_binary_get_type(const struct vk_sync_type *timeline_type)
|
|||
.reset = vk_sync_binary_reset,
|
||||
.signal = vk_sync_binary_signal,
|
||||
.wait_many = vk_sync_binary_wait_many,
|
||||
.import_sync_file = vk_sync_binary_import_sync_file,
|
||||
.export_sync_file = vk_sync_binary_export_sync_file,
|
||||
},
|
||||
.timeline_type = timeline_type,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue