diff --git a/render/dmabuf_linux.c b/render/dmabuf_linux.c index cf06229c5..53fb909bc 100644 --- a/render/dmabuf_linux.c +++ b/render/dmabuf_linux.c @@ -50,30 +50,6 @@ bool dmabuf_check_sync_file_import_export(void) { return KERNEL_VERSION(major, minor, patch) >= KERNEL_VERSION(5, 20, 0); } -// TODO: drop these definitions once widespread - -#if !defined(DMA_BUF_IOCTL_IMPORT_SYNC_FILE) - -struct dma_buf_import_sync_file { - __u32 flags; - __s32 fd; -}; - -#define DMA_BUF_IOCTL_IMPORT_SYNC_FILE _IOW(DMA_BUF_BASE, 3, struct dma_buf_import_sync_file) - -#endif - -#if !defined(DMA_BUF_IOCTL_EXPORT_SYNC_FILE) - -struct dma_buf_export_sync_file { - __u32 flags; - __s32 fd; -}; - -#define DMA_BUF_IOCTL_EXPORT_SYNC_FILE _IOWR(DMA_BUF_BASE, 2, struct dma_buf_export_sync_file) - -#endif - bool dmabuf_import_sync_file(int dmabuf_fd, uint32_t flags, int sync_file_fd) { struct dma_buf_import_sync_file data = { .flags = flags, diff --git a/render/meson.build b/render/meson.build index 7c1254078..aaaf2ec48 100644 --- a/render/meson.build +++ b/render/meson.build @@ -17,7 +17,11 @@ wlr_files += files( 'wlr_texture.c', ) -if cc.has_header('linux/dma-buf.h') and target_machine.system() == 'linux' +has_dma_buf_import_sync_file = cc.has_header('linux/dma-buf.h') and cc.has_define( + 'DMA_BUF_IOCTL_IMPORT_SYNC_FILE', + prefix: '#include ', +) +if has_dma_buf_import_sync_file and target_machine.system() == 'linux' wlr_files += files('dmabuf_linux.c') else wlr_files += files('dmabuf_fallback.c')