diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index 5a3fe7aae8..3db0dc206a 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -1839,7 +1839,7 @@ gdk_display_get_egl_display (GdkDisplay *self) #endif } -#ifdef HAVE_LINUX_DMA_BUF_H +#ifdef HAVE_DMABUF static void gdk_display_add_dmabuf_downloader (GdkDisplay *display, const GdkDmabufDownloader *downloader, @@ -1877,7 +1877,7 @@ gdk_display_init_dmabuf (GdkDisplay *self) builder = gdk_dmabuf_formats_builder_new (); -#ifdef HAVE_LINUX_DMA_BUF_H +#ifdef HAVE_DMABUF if (!GDK_DEBUG_CHECK (DMABUF_DISABLE)) { gdk_display_prepare_gl (self, NULL); diff --git a/gdk/gdkdmabuf.c b/gdk/gdkdmabuf.c index d2d7757337..4b17fe563f 100644 --- a/gdk/gdkdmabuf.c +++ b/gdk/gdkdmabuf.c @@ -24,7 +24,7 @@ #include "gdkdmabuftextureprivate.h" #include "gdkmemoryformatprivate.h" -#ifdef HAVE_LINUX_DMA_BUF_H +#ifdef HAVE_DMABUF #include #include #include @@ -550,4 +550,4 @@ gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf) return FALSE; } -#endif /* HAVE_LINUX_DMA_BUF_H */ +#endif /* HAVE_DMABUF */ diff --git a/gdk/gdkdmabufformatsbuilder.c b/gdk/gdkdmabufformatsbuilder.c index b9f872873e..223eada0a7 100644 --- a/gdk/gdkdmabufformatsbuilder.c +++ b/gdk/gdkdmabufformatsbuilder.c @@ -22,7 +22,7 @@ #include "gdkdmabufformatsprivate.h" -#ifdef HAVE_LINUX_DMA_BUF_H +#ifdef HAVE_DMABUF #include #endif @@ -121,7 +121,7 @@ gdk_dmabuf_formats_builder_add_format (GdkDmabufFormatsBuilder *self, guint32 fourcc, guint64 modifier) { -#ifdef HAVE_LINUX_DMA_BUF_H +#ifdef HAVE_DMABUF g_return_if_fail (modifier != DRM_FORMAT_MOD_INVALID); #else g_return_if_reached (); diff --git a/gdk/gdkdmabufprivate.h b/gdk/gdkdmabufprivate.h index 67ed9c1d6b..33ff1398c5 100644 --- a/gdk/gdkdmabufprivate.h +++ b/gdk/gdkdmabufprivate.h @@ -39,7 +39,7 @@ struct _GdkDmabufDownloader gsize stride); }; -#ifdef HAVE_LINUX_DMA_BUF_H +#ifdef HAVE_DMABUF const GdkDmabufDownloader * gdk_dmabuf_get_direct_downloader (void) G_GNUC_CONST; diff --git a/gdk/gdkdmabuftexture.c b/gdk/gdkdmabuftexture.c index 5841f42dad..97bb473bd9 100644 --- a/gdk/gdkdmabuftexture.c +++ b/gdk/gdkdmabuftexture.c @@ -28,7 +28,7 @@ #include #include -#ifdef HAVE_LINUX_DMA_BUF_H +#ifdef HAVE_DMABUF #include #include #include @@ -129,7 +129,7 @@ gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder, gpointer data, GError **error) { -#ifdef HAVE_LINUX_DMA_BUF_H +#ifdef HAVE_DMABUF GdkDmabufTexture *self; GdkTexture *update_texture; GdkDisplay *display; @@ -210,7 +210,7 @@ gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder, return GDK_TEXTURE (self); -#else /* !HAVE_LINUX_DMA_BUF_H */ +#else /* !HAVE_DMABUF */ g_set_error_literal (error, GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_NOT_AVAILABLE, "dmabuf support disabled at compile-time."); return NULL; diff --git a/gdk/gdkdmabuftexturebuilder.c b/gdk/gdkdmabuftexturebuilder.c index f05eeb82e6..8301f37308 100644 --- a/gdk/gdkdmabuftexturebuilder.c +++ b/gdk/gdkdmabuftexturebuilder.c @@ -27,7 +27,7 @@ #include "gdkdmabuftextureprivate.h" #include -#ifdef HAVE_LINUX_DMA_BUF_H +#ifdef HAVE_DMABUF #include #else #define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1) diff --git a/meson.build b/meson.build index 60cfb3974a..666332e1a6 100644 --- a/meson.build +++ b/meson.build @@ -162,7 +162,6 @@ check_headers = [ 'inttypes.h', 'linux/input.h', 'linux/memfd.h', - 'linux/dma-buf.h', 'locale.h', 'memory.h', 'stdint.h', @@ -186,8 +185,12 @@ foreach h : check_headers endif endforeach -if os_linux and not cc.has_header('linux/dma-buf.h') - error('OS is Linux, but linux/dma-buf.h not found.') +if cc.has_header('linux/dma-buf.h') and cc.has_header('drm/drm_fourcc.h') + cdata.set('HAVE_DMABUF', 1) +else + if os_linux + error('OS is Linux, but linux/dma-buf.h and drm/drm-fourcc.h not found.') + endif endif # Maths functions might be implemented in libm