diff options
author | Samuel Pitoiset <[email protected]> | 2020-07-14 22:59:58 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-07-16 21:04:37 +0000 |
commit | dd795ee1df4f5710f8a5ebf3a0cb527cd57fdf44 (patch) | |
tree | 1fe74ce8b71b573b21f55bb34db0e683f46c3568 /src | |
parent | 8aa9d0acb8ce882686eedd7d9b2bf51b035f2614 (diff) |
radv: fix the error code when exporting a semaphore/fence fails
VK_ERROR_INVALID_EXTERNAL_HANDLE is not a valid Vulkan error code
for these functions and it's likely that too many objects are
created instead.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5921>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/vulkan/radv_device.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 09a89b8be74..d69ad9d0b61 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -7138,23 +7138,24 @@ VkResult radv_GetSemaphoreFdKHR(VkDevice _device, switch(pGetFdInfo->handleType) { case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT: ret = device->ws->export_syncobj(device->ws, syncobj_handle, pFd); + if (ret) + return vk_error(device->instance, VK_ERROR_TOO_MANY_OBJECTS); break; case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT: ret = device->ws->export_syncobj_to_sync_file(device->ws, syncobj_handle, pFd); - if (!ret) { - if (sem->temporary.kind != RADV_SEMAPHORE_NONE) { - radv_destroy_semaphore_part(device, &sem->temporary); - } else { - device->ws->reset_syncobj(device->ws, syncobj_handle); - } + if (ret) + return vk_error(device->instance, VK_ERROR_TOO_MANY_OBJECTS); + + if (sem->temporary.kind != RADV_SEMAPHORE_NONE) { + radv_destroy_semaphore_part(device, &sem->temporary); + } else { + device->ws->reset_syncobj(device->ws, syncobj_handle); } break; default: unreachable("Unhandled semaphore handle type"); } - if (ret) - return vk_error(device->instance, VK_ERROR_INVALID_EXTERNAL_HANDLE); return VK_SUCCESS; } @@ -7232,24 +7233,25 @@ VkResult radv_GetFenceFdKHR(VkDevice _device, switch(pGetFdInfo->handleType) { case VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT: ret = device->ws->export_syncobj(device->ws, syncobj_handle, pFd); + if (ret) + return vk_error(device->instance, VK_ERROR_TOO_MANY_OBJECTS); break; case VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT: ret = device->ws->export_syncobj_to_sync_file(device->ws, syncobj_handle, pFd); - if (!ret) { - if (fence->temp_syncobj) { - device->ws->destroy_syncobj(device->ws, fence->temp_syncobj); - fence->temp_syncobj = 0; - } else { - device->ws->reset_syncobj(device->ws, syncobj_handle); - } + if (ret) + return vk_error(device->instance, VK_ERROR_TOO_MANY_OBJECTS); + + if (fence->temp_syncobj) { + device->ws->destroy_syncobj(device->ws, fence->temp_syncobj); + fence->temp_syncobj = 0; + } else { + device->ws->reset_syncobj(device->ws, syncobj_handle); } break; default: unreachable("Unhandled fence handle type"); } - if (ret) - return vk_error(device->instance, VK_ERROR_INVALID_EXTERNAL_HANDLE); return VK_SUCCESS; } |