vulkan/wsi: fails to build on non-Linux
Regressed by 30b57f10. Given DMA_BUF_IOCTL_{EXPORT,IMPORT}_SYNC_FILE_WSI
doesn't exist on older Linux versions maybe Mesa should copy/bundle <linux/dma-buf.h>
under include/drm-uapi
. CC @jekstrand @manu @unrelentingtech
$ cc --version
FreeBSD clang version 14.0.3 (https://github.com/llvm/llvm-project.git llvmorg-14.0.3-0-g1f9140064dfb)
Target: x86_64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin
$ meson setup _build
$ meson compile -C _build
../src/vulkan/wsi/wsi_common_drm.c:36:10: fatal error: 'linux/dma-buf.h' file not found
#include <linux/dma-buf.h>
^~~~~~~~~~~~~~~~~
Workaround:
--- src/vulkan/wsi/wsi_common_drm.c.orig 22.1-branchpoint-2850-gcbcdcc412c9
+++ src/vulkan/wsi/wsi_common_drm.c
@@ -33,13 +33,20 @@
#include "drm-uapi/drm_fourcc.h"
#include <errno.h>
-#include <linux/dma-buf.h>
-#include <linux/sync_file.h>
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <xf86drm.h>
+
+#if __has_include(<linux/dma-buf.h>)
+#include <linux/dma-buf.h>
+#else
+#define DMA_BUF_SYNC_READ (1 << 0)
+#define DMA_BUF_SYNC_WRITE (2 << 0)
+#define DMA_BUF_SYNC_RW (DMA_BUF_SYNC_READ | DMA_BUF_SYNC_WRITE)
+#define DMA_BUF_BASE 'b'
+#endif
struct dma_buf_export_sync_file_wsi {
__u32 flags;
Edited by Jan Beich