}
pthread_mutex_unlock(&cache->mutex);
-
- /* From the Vulkan spec:
- *
- * "Importing memory 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);
-
*bo_out = &bo->bo;
return VK_SUCCESS;
&mem->bo);
if (result != VK_SUCCESS)
goto fail;
+
+ /* From the Vulkan spec:
+ *
+ * "Importing memory 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_info->fd);
} else {
result = anv_bo_cache_alloc(device, &device->bo_cache,
pAllocateInfo->allocationSize,
if (result != VK_SUCCESS)
goto fail;
+ close(pCreateInfo->fd);
+
image = anv_image_from_handle(image_h);
result = anv_bo_cache_import(device, &device->bo_cache,
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;
*/
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: