mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 20:28:04 +02:00
zink: add a util for getting cached fd semaphores
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24962>
This commit is contained in:
parent
5f7333b188
commit
7662ddc426
2 changed files with 30 additions and 0 deletions
|
|
@ -2172,6 +2172,33 @@ zink_screen_init_semaphore(struct zink_screen *screen)
|
|||
return VKSCR(CreateSemaphore)(screen->dev, &sci, NULL, &screen->sem) == VK_SUCCESS;
|
||||
}
|
||||
|
||||
VkSemaphore
|
||||
zink_create_exportable_semaphore(struct zink_screen *screen)
|
||||
{
|
||||
VkExportSemaphoreCreateInfo eci = {
|
||||
VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO,
|
||||
NULL,
|
||||
VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT
|
||||
};
|
||||
VkSemaphoreCreateInfo sci = {
|
||||
VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO,
|
||||
&eci,
|
||||
0
|
||||
};
|
||||
|
||||
VkSemaphore sem = VK_NULL_HANDLE;
|
||||
if (util_dynarray_contains(&screen->fd_semaphores, VkSemaphore)) {
|
||||
simple_mtx_lock(&screen->semaphores_lock);
|
||||
if (util_dynarray_contains(&screen->fd_semaphores, VkSemaphore))
|
||||
sem = util_dynarray_pop(&screen->fd_semaphores, VkSemaphore);
|
||||
simple_mtx_unlock(&screen->semaphores_lock);
|
||||
}
|
||||
if (sem)
|
||||
return sem;
|
||||
VkResult ret = VKSCR(CreateSemaphore)(screen->dev, &sci, NULL, &sem);
|
||||
return ret == VK_SUCCESS ? sem : VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
bool
|
||||
zink_screen_timeline_wait(struct zink_screen *screen, uint64_t batch_id, uint64_t timeout)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -122,6 +122,9 @@ zink_screen_lock_context(struct zink_screen *screen);
|
|||
void
|
||||
zink_screen_unlock_context(struct zink_screen *screen);
|
||||
|
||||
VkSemaphore
|
||||
zink_create_exportable_semaphore(struct zink_screen *screen);
|
||||
|
||||
VkFormat
|
||||
zink_get_format(struct zink_screen *screen, enum pipe_format format);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue