build: Check for drm/drm_fourcc.h too

It's part of the kernel headers package so I did not check for libdrm.

As a side effect I checked the #define to HAVE_DMABUF.
This commit is contained in:
Benjamin Otte 2023-10-22 17:23:37 +02:00
parent beb9e0c906
commit 32ba1e389c
7 changed files with 17 additions and 14 deletions

View File

@ -1839,7 +1839,7 @@ gdk_display_get_egl_display (GdkDisplay *self)
#endif #endif
} }
#ifdef HAVE_LINUX_DMA_BUF_H #ifdef HAVE_DMABUF
static void static void
gdk_display_add_dmabuf_downloader (GdkDisplay *display, gdk_display_add_dmabuf_downloader (GdkDisplay *display,
const GdkDmabufDownloader *downloader, const GdkDmabufDownloader *downloader,
@ -1877,7 +1877,7 @@ gdk_display_init_dmabuf (GdkDisplay *self)
builder = gdk_dmabuf_formats_builder_new (); builder = gdk_dmabuf_formats_builder_new ();
#ifdef HAVE_LINUX_DMA_BUF_H #ifdef HAVE_DMABUF
if (!GDK_DEBUG_CHECK (DMABUF_DISABLE)) if (!GDK_DEBUG_CHECK (DMABUF_DISABLE))
{ {
gdk_display_prepare_gl (self, NULL); gdk_display_prepare_gl (self, NULL);

View File

@ -24,7 +24,7 @@
#include "gdkdmabuftextureprivate.h" #include "gdkdmabuftextureprivate.h"
#include "gdkmemoryformatprivate.h" #include "gdkmemoryformatprivate.h"
#ifdef HAVE_LINUX_DMA_BUF_H #ifdef HAVE_DMABUF
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <linux/dma-buf.h> #include <linux/dma-buf.h>
@ -550,4 +550,4 @@ gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf)
return FALSE; return FALSE;
} }
#endif /* HAVE_LINUX_DMA_BUF_H */ #endif /* HAVE_DMABUF */

View File

@ -22,7 +22,7 @@
#include "gdkdmabufformatsprivate.h" #include "gdkdmabufformatsprivate.h"
#ifdef HAVE_LINUX_DMA_BUF_H #ifdef HAVE_DMABUF
#include <drm/drm_fourcc.h> #include <drm/drm_fourcc.h>
#endif #endif
@ -121,7 +121,7 @@ gdk_dmabuf_formats_builder_add_format (GdkDmabufFormatsBuilder *self,
guint32 fourcc, guint32 fourcc,
guint64 modifier) guint64 modifier)
{ {
#ifdef HAVE_LINUX_DMA_BUF_H #ifdef HAVE_DMABUF
g_return_if_fail (modifier != DRM_FORMAT_MOD_INVALID); g_return_if_fail (modifier != DRM_FORMAT_MOD_INVALID);
#else #else
g_return_if_reached (); g_return_if_reached ();

View File

@ -39,7 +39,7 @@ struct _GdkDmabufDownloader
gsize stride); gsize stride);
}; };
#ifdef HAVE_LINUX_DMA_BUF_H #ifdef HAVE_DMABUF
const GdkDmabufDownloader * const GdkDmabufDownloader *
gdk_dmabuf_get_direct_downloader (void) G_GNUC_CONST; gdk_dmabuf_get_direct_downloader (void) G_GNUC_CONST;

View File

@ -28,7 +28,7 @@
#include <gdk/gdkgltexturebuilder.h> #include <gdk/gdkgltexturebuilder.h>
#include <gdk/gdktexturedownloader.h> #include <gdk/gdktexturedownloader.h>
#ifdef HAVE_LINUX_DMA_BUF_H #ifdef HAVE_DMABUF
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <linux/dma-buf.h> #include <linux/dma-buf.h>
@ -129,7 +129,7 @@ gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
gpointer data, gpointer data,
GError **error) GError **error)
{ {
#ifdef HAVE_LINUX_DMA_BUF_H #ifdef HAVE_DMABUF
GdkDmabufTexture *self; GdkDmabufTexture *self;
GdkTexture *update_texture; GdkTexture *update_texture;
GdkDisplay *display; GdkDisplay *display;
@ -210,7 +210,7 @@ gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
return GDK_TEXTURE (self); 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, g_set_error_literal (error, GDK_DMABUF_ERROR, GDK_DMABUF_ERROR_NOT_AVAILABLE,
"dmabuf support disabled at compile-time."); "dmabuf support disabled at compile-time.");
return NULL; return NULL;

View File

@ -27,7 +27,7 @@
#include "gdkdmabuftextureprivate.h" #include "gdkdmabuftextureprivate.h"
#include <cairo-gobject.h> #include <cairo-gobject.h>
#ifdef HAVE_LINUX_DMA_BUF_H #ifdef HAVE_DMABUF
#include <drm/drm_fourcc.h> #include <drm/drm_fourcc.h>
#else #else
#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1) #define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)

View File

@ -162,7 +162,6 @@ check_headers = [
'inttypes.h', 'inttypes.h',
'linux/input.h', 'linux/input.h',
'linux/memfd.h', 'linux/memfd.h',
'linux/dma-buf.h',
'locale.h', 'locale.h',
'memory.h', 'memory.h',
'stdint.h', 'stdint.h',
@ -186,8 +185,12 @@ foreach h : check_headers
endif endif
endforeach endforeach
if os_linux and not cc.has_header('linux/dma-buf.h') if cc.has_header('linux/dma-buf.h') and cc.has_header('drm/drm_fourcc.h')
error('OS is Linux, but linux/dma-buf.h not found.') 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 endif
# Maths functions might be implemented in libm # Maths functions might be implemented in libm