mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-12 02:40:35 +02:00
radv: Free syncobj with multiple imports.
Otherwise we can leak the old syncobj. Fixes:eaa56eab6d"radv: initial support for shared semaphores (v2)" Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> (cherry picked from commit917d3b43f2)
This commit is contained in:
parent
179acf6579
commit
75efb540e2
1 changed files with 8 additions and 2 deletions
|
|
@ -3623,6 +3623,7 @@ VkResult radv_ImportSemaphoreFdKHR(VkDevice _device,
|
|||
RADV_FROM_HANDLE(radv_device, device, _device);
|
||||
RADV_FROM_HANDLE(radv_semaphore, sem, pImportSemaphoreFdInfo->semaphore);
|
||||
uint32_t syncobj_handle = 0;
|
||||
uint32_t *syncobj_dst = NULL;
|
||||
assert(pImportSemaphoreFdInfo->handleType == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR);
|
||||
|
||||
int ret = device->ws->import_syncobj(device->ws, pImportSemaphoreFdInfo->fd, &syncobj_handle);
|
||||
|
|
@ -3630,10 +3631,15 @@ VkResult radv_ImportSemaphoreFdKHR(VkDevice _device,
|
|||
return VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR;
|
||||
|
||||
if (pImportSemaphoreFdInfo->flags & VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR) {
|
||||
sem->temp_syncobj = syncobj_handle;
|
||||
syncobj_dst = &sem->temp_syncobj;
|
||||
} else {
|
||||
sem->syncobj = syncobj_handle;
|
||||
syncobj_dst = &sem->syncobj;
|
||||
}
|
||||
|
||||
if (*syncobj_dst)
|
||||
device->ws->destroy_syncobj(device->ws, *syncobj_dst);
|
||||
|
||||
*syncobj_dst = syncobj_handle;
|
||||
close(pImportSemaphoreFdInfo->fd);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue