msdk: Fix libdrm dependency detection and usage

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/6932>
This commit is contained in:
Nirbheek Chauhan 2024-05-28 04:14:15 +05:30 committed by GStreamer Marge Bot
parent 82b7850c2f
commit 907aca399f
9 changed files with 17 additions and 9 deletions

View 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

View 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(),

View 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"

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

View 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

View 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

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

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

View 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