msdk: Fix libdrm dependency detection and usage
authorNirbheek Chauhan <nirbheek@centricular.com>
Mon, 27 May 2024 22:44:15 +0000 (04:14 +0530)
committerBackport Bot <gitlab-backport-bot@gstreamer-foundation.org>
Sun, 27 Oct 2024 12:29:08 +0000 (12:29 +0000)
drm_fourcc.h should be picked up via the pkgconfig include, not the
system includedir directly.

Also consolidate the libdrm usage in va and msdk.

All this allows it to be picked up consistently (via the subproject,
for example).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7760>

subprojects/gst-plugins-bad/gst-libs/gst/va/meson.build
subprojects/gst-plugins-bad/meson.build
subprojects/gst-plugins-bad/sys/msdk/gstmsdkallocator_libva.c
subprojects/gst-plugins-bad/sys/msdk/gstmsdkcaps.c
subprojects/gst-plugins-bad/sys/msdk/gstmsdkdec.c
subprojects/gst-plugins-bad/sys/msdk/gstmsdkenc.c
subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpp.c
subprojects/gst-plugins-bad/sys/msdk/gstmsdkvpputil.c
subprojects/gst-plugins-bad/sys/msdk/meson.build

index b9a8ae7066c6d3871ad9f33831144c066af226c7..d83b9e3f3fecb5c28fcf79f307f72c6ddc747bb8 100644 (file)
@@ -81,10 +81,8 @@ if host_system == 'linux'
   endif
   platform_deps += [libva_drm_dep]
 
-  libdrm_dep = dependency('libdrm', version: '>=2.4', required: get_option('drm'))
   if libdrm_dep.found()
     platform_deps += [libdrm_dep]
-    extra_args += ['-DHAVE_LIBDRM']
   endif
 
   va_sources += va_linux_sources
index eeb7a29722bcdee2bdcdb4e3a878baa67d17bd2d..9c431f1224df5dd50b4a847fd337a7b42aa17bd9 100644 (file)
@@ -398,6 +398,17 @@ if x11_dep.found()
   cdata.set('HAVE_X11', 1)
 endif
 
+# Optional dep of msdk and va
+if host_system not in ['darwin', 'ios', 'android', 'windows']
+  libdrm_dep = dependency('libdrm', version : '>=2.4.50',
+    required : get_option('drm').enabled() or get_option('msdk').enabled(),
+  )
+  cdata.set('HAVE_LIBDRM', libdrm_dep.found())
+else
+  libdrm_dep = dependency('', required: false)
+endif
+
+
 #
 # Solaris and Illumos distros split a lot of networking-related code
 # into '-lsocket -lnsl'.  Anything that calls socketpair(), getifaddr(),
index eab8001602df0ea70174165ee51d1a314a464c06..d9b99542ce992b31c9afd1478723be0ee02ddeac 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <va/va.h>
 #include <va/va_drmcommon.h>
-#include <libdrm/drm_fourcc.h>
+#include <drm_fourcc.h>
 #include <unistd.h>
 #include "gstmsdkallocator.h"
 #include "gstmsdkallocator_libva.h"
index 590cbba6121af90507db74e74757e3a595185268..ad5119cf475c479163d2dd954a4636244f9e5fa5 100644 (file)
@@ -32,7 +32,7 @@
 #include "gstmsdkcaps.h"
 
 #ifndef _WIN32
-#include <libdrm/drm_fourcc.h>
+#include <drm_fourcc.h>
 #include <gst/video/video-info-dma.h>
 #include "gstmsdkallocator_libva.h"
 #include <gst/va/gstvavideoformat.h>
index 4932ad93349ad68b9935476b83e4414f64de8d5f..c20b73bd3b310aa06962c9a2a441005c057a168e 100644 (file)
@@ -41,7 +41,7 @@
 #include "gstmsdkcaps.h"
 
 #ifndef _WIN32
-#include <libdrm/drm_fourcc.h>
+#include <drm_fourcc.h>
 #include <gst/va/gstvaallocator.h>
 #include <gst/va/gstvavideoformat.h>
 #else
index 1f4be287c0cffac67b52fde21b3aa971a12b4c61..ac9c7335f0547f70a33b26b73482dad7dac176fc 100644 (file)
@@ -51,7 +51,7 @@
 #include "gstmsdkcaps.h"
 
 #ifndef _WIN32
-#include <libdrm/drm_fourcc.h>
+#include <drm_fourcc.h>
 #include "gstmsdkallocator_libva.h"
 #include <gst/va/gstvaallocator.h>
 #else
index be97f07ced2ce38c9d493cc4c16b26eb0caa63d4..5f23fa2088330d7ca5c5431d14d5483e94e9bbf6 100644 (file)
@@ -60,7 +60,7 @@
 #include "gstmsdkallocator.h"
 
 #ifndef _WIN32
-#include <libdrm/drm_fourcc.h>
+#include <drm_fourcc.h>
 #include "gstmsdkallocator_libva.h"
 #include <gst/va/gstvaallocator.h>
 #include <gst/va/gstvavideoformat.h>
index b4667438a8fec5668c9c36f67ae2cb62c8a4d216..ced67e6362eed04910a41d6939edd228a9bddddb 100644 (file)
@@ -30,7 +30,7 @@
 #include "gstmsdkcaps.h"
 
 #ifndef _WIN32
-#include <libdrm/drm_fourcc.h>
+#include <drm_fourcc.h>
 #include <gst/va/gstvavideoformat.h>
 #else
 #include <gst/d3d11/gstd3d11.h>
index 51bf953a0e55aee80908d10554dd4f2d49c85a6d..b73370cda12917d790660170d83637d8ad5dd9b4 100644 (file)
@@ -184,7 +184,6 @@ if host_machine.system() == 'windows'
 else
   libdl_dep = cc.find_library('dl', required: get_option('msdk'))
   libgudev_dep = dependency('gudev-1.0', required: get_option('msdk'), allow_fallback: true)
-  libdrm_dep = dependency('libdrm', required: get_option('msdk'))
   msdk_deps = declare_dependency(dependencies: [gstva_dep, libdl_dep, libgudev_dep, libdrm_dep])
   msdk_deps_found = gstva_dep.found() and libdl_dep.found() and libgudev_dep.found() and libdrm_dep.found()
 endif