From 78523eea2fa0f649179338ee2b5d89a66a8ed7fb Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sat, 11 Jun 2022 06:05:17 +0000 Subject: [PATCH] vulkan/wsi: treat EBADF as missing DMA_BUF_IOCTL_{EXPORT,IMPORT}_SYNC_FILE FreeBSD supports DMA-BUF but not DMA_BUF_IOCTL_SYNC and similar yet. As it returns EBADF instead of ENOTTY all consumers fail due to VK_ERROR_OUT_OF_HOST_MEMORY. Fixes: 30b57f10b36d ("vulkan/wsi: Signal semaphores and fences from the dma-buf") Reviewed-by: Jason Ekstrand Part-of: --- src/vulkan/wsi/wsi_common_drm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vulkan/wsi/wsi_common_drm.c b/src/vulkan/wsi/wsi_common_drm.c index ed600606912..1e4fc51798e 100644 --- a/src/vulkan/wsi/wsi_common_drm.c +++ b/src/vulkan/wsi/wsi_common_drm.c @@ -68,7 +68,7 @@ wsi_dma_buf_export_sync_file(int dma_buf_fd, int *sync_file_fd) }; int ret = drmIoctl(dma_buf_fd, DMA_BUF_IOCTL_EXPORT_SYNC_FILE_WSI, &export); if (ret) { - if (errno == ENOTTY) { + if (errno == ENOTTY || errno == EBADF) { no_dma_buf_sync_file = true; return VK_ERROR_FEATURE_NOT_PRESENT; } else { @@ -95,7 +95,7 @@ wsi_dma_buf_import_sync_file(int dma_buf_fd, int sync_file_fd) }; int ret = drmIoctl(dma_buf_fd, DMA_BUF_IOCTL_IMPORT_SYNC_FILE_WSI, &import); if (ret) { - if (errno == ENOTTY) { + if (errno == ENOTTY || errno == EBADF) { no_dma_buf_sync_file = true; return VK_ERROR_FEATURE_NOT_PRESENT; } else {