From eb34311c2c1f08444d88b2ec8d2b29854c35bb5f Mon Sep 17 00:00:00 2001 From: Alessandro Bono Date: Thu, 15 Feb 2024 10:19:53 +0100 Subject: [PATCH 1/3] meson: Sort alphabetically --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index ca1e77b71c..fbb3d86692 100644 --- a/meson.build +++ b/meson.build @@ -168,16 +168,16 @@ check_headers = [ 'memory.h', 'stdint.h', 'stdlib.h', - 'strings.h', 'string.h', + 'strings.h', 'sys/mman.h', 'sys/param.h', 'sys/stat.h', 'sys/sysinfo.h', + 'sys/sysmacros.h', 'sys/systeminfo.h', 'sys/time.h', 'sys/types.h', - 'sys/sysmacros.h', 'unistd.h', ] From b6767d2eef09cc026bce580410821cf2fbbc21ee Mon Sep 17 00:00:00 2001 From: Alessandro Bono Date: Thu, 15 Feb 2024 17:20:58 +0100 Subject: [PATCH 2/3] meson: Decouple linux/dma-buf.h and libdrm checks Currently dmabuf_dep is found when the following conditions are met: - linux/dma-buf.h is present; - libdrm is found. This is because Linux dmabuf support requires drm_fourcc.h which is part of libdrm. However, dmabuf_dep is used for two purposes: - define HAVE_DMABUF to state dmabuf support; - ensure the presence of drm_fourcc.h for gdk and for the media-gstreamer module. Decouple this, unconditionally check for libdrm and require it on Linux. Then, use libdrm_dep only to state the drm_fourcc.h presence. Given that now we unconditionally require libdrm on Linux, HAVE_DMABUF depends only on the linux/dma-buf.h presence. --- gdk/gdkdmabuffourccprivate.h | 2 +- gdk/meson.build | 2 +- meson.build | 20 +++++++++----------- modules/media/meson.build | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/gdk/gdkdmabuffourccprivate.h b/gdk/gdkdmabuffourccprivate.h index c6492d77aa..900e163eba 100644 --- a/gdk/gdkdmabuffourccprivate.h +++ b/gdk/gdkdmabuffourccprivate.h @@ -1,7 +1,7 @@ #pragma once #include "config.h" -#ifdef HAVE_DMABUF +#ifdef HAVE_DRM_FOURCC_H #include #endif diff --git a/gdk/meson.build b/gdk/meson.build index 75630976ad..9c0a36e19e 100644 --- a/gdk/meson.build +++ b/gdk/meson.build @@ -219,7 +219,7 @@ gdk_deps = [ platform_gio_dep, pangocairo_dep, vulkan_dep, - dmabuf_dep, + libdrm_dep, png_dep, tiff_dep, jpeg_dep, diff --git a/meson.build b/meson.build index fbb3d86692..1bc6a2f117 100644 --- a/meson.build +++ b/meson.build @@ -628,19 +628,17 @@ else vulkan_pkg_found = false endif -if cc.has_header('linux/dma-buf.h') - dmabuf_dep = dependency('libdrm', - required: os_linux) -else - if os_linux - error('OS is Linux, but linux/dma-buf.h not found.') - endif - dmabuf_dep = dependency('', required: false) -endif -cdata.set('HAVE_DMABUF', dmabuf_dep.found()) +libdrm_dep = dependency('libdrm', required: os_linux) # We only care about drm_fourcc.h for all the fourccs, # but not about linking to libdrm -dmabuf_dep = dmabuf_dep.partial_dependency(includes: true, compile_args: true) +libdrm_dep = libdrm_dep.partial_dependency(includes: true, compile_args: true) +cdata.set('HAVE_DRM_FOURCC_H', libdrm_dep.found()) + +has_linux_dma_buf_h = cc.has_header('linux/dma-buf.h') +if os_linux and not has_linux_dma_buf_h + error('OS is Linux, but linux/dma-buf.h not found.') +endif +cdata.set('HAVE_DMABUF', has_linux_dma_buf_h) cloudproviders_dep = dependency('cloudproviders', required: get_option('cloudproviders'), diff --git a/modules/media/meson.build b/modules/media/meson.build index 9e4cd5f083..d18f582cb2 100644 --- a/modules/media/meson.build +++ b/modules/media/meson.build @@ -24,7 +24,7 @@ if gstplayer_dep.found() and gstgl_dep.found() cdata.set('HAVE_GSTREAMER', 1) media_gst_deps = [ libm, libgtk_dep, gstplayer_dep, gstgl_dep ] - if dmabuf_dep.found() and gstdrm_dep.found() + if libdrm_dep.found() and gstdrm_dep.found() cdata.set('HAVE_GSTREAMER_DRM', 1) media_gst_deps += [ gstdrm_dep ] endif From 4054f3322198abbc641bef06f9adca0891b195c1 Mon Sep 17 00:00:00 2001 From: Alessandro Bono Date: Thu, 15 Feb 2024 17:27:54 +0100 Subject: [PATCH 3/3] meson: Don't fail when linux/dma-buf.h is missing We just don't define HAVE_DMABUF in this case. --- meson.build | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 1bc6a2f117..d395aad621 100644 --- a/meson.build +++ b/meson.build @@ -634,11 +634,7 @@ libdrm_dep = dependency('libdrm', required: os_linux) libdrm_dep = libdrm_dep.partial_dependency(includes: true, compile_args: true) cdata.set('HAVE_DRM_FOURCC_H', libdrm_dep.found()) -has_linux_dma_buf_h = cc.has_header('linux/dma-buf.h') -if os_linux and not has_linux_dma_buf_h - error('OS is Linux, but linux/dma-buf.h not found.') -endif -cdata.set('HAVE_DMABUF', has_linux_dma_buf_h) +cdata.set('HAVE_DMABUF', cc.has_header('linux/dma-buf.h')) cloudproviders_dep = dependency('cloudproviders', required: get_option('cloudproviders'),