[Mesa-dev] [PATCH] squash! anv: Move close(fd) from anv_bo_cache_import to its callers
Chad Versace
chadversary at chromium.org
Mon Oct 16 23:18:43 UTC 2017
Add missing close(fd) for case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR,
subcase ANV_SEMAPHORE_TYPE_BO.
---
src/intel/vulkan/anv_queue.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c
index e26254a87e..180c907781 100644
--- a/src/intel/vulkan/anv_queue.c
+++ b/src/intel/vulkan/anv_queue.c
@@ -1020,17 +1020,6 @@ VkResult anv_ImportSemaphoreFdKHR(
new_impl.syncobj = anv_gem_syncobj_fd_to_handle(device, fd);
if (!new_impl.syncobj)
return vk_error(VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR);
-
- /* From the Vulkan spec:
- *
- * "Importing semaphore state from a file descriptor transfers
- * ownership of the file descriptor from the application to the
- * Vulkan implementation. The application must not perform any
- * operations on the file descriptor after a successful import."
- *
- * If the import fails, we leave the file descriptor open.
- */
- close(pImportSemaphoreFdInfo->fd);
} else {
new_impl.type = ANV_SEMAPHORE_TYPE_BO;
@@ -1044,6 +1033,17 @@ VkResult anv_ImportSemaphoreFdKHR(
*/
assert(!(new_impl.bo->flags & EXEC_OBJECT_ASYNC));
}
+
+ /* From the Vulkan spec:
+ *
+ * "Importing semaphore state from a file descriptor transfers
+ * ownership of the file descriptor from the application to the
+ * Vulkan implementation. The application must not perform any
+ * operations on the file descriptor after a successful import."
+ *
+ * If the import fails, we leave the file descriptor open.
+ */
+ close(fd);
break;
case VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR:
--
2.13.0
More information about the mesa-dev
mailing list