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
}
#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);

View File

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

View File

@ -22,7 +22,7 @@
#include "gdkdmabufformatsprivate.h"
#ifdef HAVE_LINUX_DMA_BUF_H
#ifdef HAVE_DMABUF
#include <drm/drm_fourcc.h>
#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 ();

View File

@ -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;

View File

@ -28,7 +28,7 @@
#include <gdk/gdkgltexturebuilder.h>
#include <gdk/gdktexturedownloader.h>
#ifdef HAVE_LINUX_DMA_BUF_H
#ifdef HAVE_DMABUF
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <linux/dma-buf.h>
@ -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;

View File

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

View File

@ -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