libv4l2-minimal: update to v4l-utils 1.26.1 base

to match the version in meta-oe, with the same tegra-specific
patches we apply to that build.

Signed-off-by: Matt Madison <matt@madison.systems>
This commit is contained in:
Matt Madison
2024-01-20 06:07:50 -08:00
committed by Matt Madison
parent 7833745672
commit b86c2aebe2
5 changed files with 128 additions and 57 deletions

View File

@@ -1,31 +1,62 @@
From 09acccbb24c551c4b05b8fd1be0d6c2ba22c68ef Mon Sep 17 00:00:00 2001 From b1712342d5cd00c2c27211b9b37e6215f705b07d Mon Sep 17 00:00:00 2001
From: Matt Madison <matt@madison.systems> From: Matt Madison <matt@madison.systems>
Date: Mon, 16 Mar 2020 12:21:55 -0700 Date: Mon, 16 Mar 2020 12:21:55 -0700
Subject: [PATCH] Make plugin directory relative to $ORIGIN Subject: [PATCH 1/3] Make plugin directory relative to $ORIGIN
Use RTLD_DI_ORIGIN only when libc supports it.
Upstream-Status: Inappropriate [tegra platform-specific]
Signed-off-by: Matt Madison <matt@madison.systems>
--- ---
lib/libv4l2/v4l2-plugin.c | 39 ++++++++++++++++++++++++++++++++++++++- lib/libv4l2/v4l2-plugin.c | 66 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-) 1 file changed, 65 insertions(+), 1 deletion(-)
diff --git a/lib/libv4l2/v4l2-plugin.c b/lib/libv4l2/v4l2-plugin.c diff --git a/lib/libv4l2/v4l2-plugin.c b/lib/libv4l2/v4l2-plugin.c
index fbf92d8..6bca645 100644 index e2356cb6..95bdd112 100644
--- a/lib/libv4l2/v4l2-plugin.c --- a/lib/libv4l2/v4l2-plugin.c
+++ b/lib/libv4l2/v4l2-plugin.c +++ b/lib/libv4l2/v4l2-plugin.c
@@ -21,6 +21,8 @@ @@ -20,6 +20,11 @@
#include <dlfcn.h> #include <dlfcn.h>
#include <fcntl.h> #include <fcntl.h>
#include <glob.h> #include <glob.h>
+#include <libgen.h>
+#include <link.h>
+#include <limits.h> +#include <limits.h>
+#include <string.h> +#include <string.h>
+#include <sys/param.h> /* for MAXPATHLEN */
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/mman.h> #include <sys/mman.h>
#include "libv4l2.h" #include "libv4l2.h"
@@ -47,6 +49,39 @@ @@ -46,6 +51,63 @@
*/ */
#define PLUGINS_PATTERN LIBV4L2_PLUGIN_DIR "/*.so" #define PLUGINS_PATTERN LIBV4L2_PLUGIN_DIR "/*.so"
+static char *plugins_pattern; +static char *plugins_pattern;
+ +
+static int get_lib_dir(void *lib_handle, char dir[MAXPATHLEN])
+{
+ int res;
+#ifndef HAVE_RTLD_DI_ORIGIN
+ struct link_map *lm;
+ char l_name[MAXPATHLEN];
+#endif
+
+#ifdef HAVE_RTLD_DI_ORIGIN
+ res = dlinfo(lib_handle, RTLD_DI_ORIGIN, dir);
+#else
+ /*
+ * musl libc doesn't support RTLD_DI_ORIGIN
+ */
+ res = dlinfo(lib_handle, RTLD_DI_LINKMAP, &lm);
+ if (res == 0) {
+ snprintf(l_name, sizeof(l_name), "%s", lm->l_name);
+ snprintf(dir, MAXPATHLEN, "%s", dirname(l_name));
+ }
+#endif
+
+ return res;
+}
+
+static void init_plugins_pattern(void) +static void init_plugins_pattern(void)
+{ +{
+ void *handle; + void *handle;
@@ -35,7 +66,7 @@ index fbf92d8..6bca645 100644
+ return; + return;
+ handle = dlopen("libv4l2.so.0", RTLD_NOLOAD|RTLD_NOW); + handle = dlopen("libv4l2.so.0", RTLD_NOLOAD|RTLD_NOW);
+ if (handle) { + if (handle) {
+ if (dlinfo(handle, RTLD_DI_ORIGIN, buf) < 0) + if (get_lib_dir(handle, buf) < 0)
+ V4L2_LOG_ERR("cannot identify $ORIGIN for plugins: %s\n", dlerror()); + V4L2_LOG_ERR("cannot identify $ORIGIN for plugins: %s\n", dlerror());
+ else { + else {
+ char *cp; + char *cp;
@@ -60,7 +91,7 @@ index fbf92d8..6bca645 100644
void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret, void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret,
const struct libv4l_dev_ops **dev_ops_ret) const struct libv4l_dev_ops **dev_ops_ret)
@@ -61,7 +96,9 @@ void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret, @@ -60,7 +122,9 @@ void v4l2_plugin_init(int fd, void **plugin_lib_ret, void **plugin_priv_ret,
*plugin_lib_ret = NULL; *plugin_lib_ret = NULL;
*plugin_priv_ret = NULL; *plugin_priv_ret = NULL;
@@ -71,3 +102,6 @@ index fbf92d8..6bca645 100644
if (glob_ret == GLOB_NOSPACE) if (glob_ret == GLOB_NOSPACE)
return; return;
--
2.34.1

View File

@@ -1,20 +1,23 @@
From 523d2b060f9d7cf340baa0615443e3fae7f25555 Mon Sep 17 00:00:00 2001 From 3c9366b04a0c1767ab40aef4abcf63208d146506 Mon Sep 17 00:00:00 2001
From: Matt Madison <matt@madison.systems> From: Matt Madison <matt@madison.systems>
Date: Sun, 11 Apr 2021 06:48:54 -0700 Date: Sun, 11 Apr 2021 06:48:54 -0700
Subject: [PATCH] Replace stat/fstat calls with __xstat/__fxstat Subject: [PATCH 2/3] Replace stat/fstat calls with __xstat/__fxstat
The stat-family syscalls were reworked in The stat-family syscalls were reworked in
glibc 2.33, so make the libv4lconvert plugin glibc 2.33, so make the libv4lconvert plugin
compatible with the older glibc used in L4T compatible with the older glibc used in L4T
containers. containers.
Upstream-Status: Inappropriate [tegra platform-specific]
Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Matt Madison <matt@madison.systems>
--- ---
lib/libv4lconvert/control/libv4lcontrol.c | 4 ++-- lib/libv4lconvert/control/libv4lcontrol.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-) utils/media-ctl/libmediactl.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/libv4lconvert/control/libv4lcontrol.c b/lib/libv4lconvert/control/libv4lcontrol.c diff --git a/lib/libv4lconvert/control/libv4lcontrol.c b/lib/libv4lconvert/control/libv4lcontrol.c
index 0b0a346..5643dbe 100644 index 67671937..9de715b1 100644
--- a/lib/libv4lconvert/control/libv4lcontrol.c --- a/lib/libv4lconvert/control/libv4lcontrol.c
+++ b/lib/libv4lconvert/control/libv4lcontrol.c +++ b/lib/libv4lconvert/control/libv4lcontrol.c
@@ -370,10 +370,10 @@ static int v4lcontrol_get_usb_info(struct v4lcontrol_data *data, @@ -370,10 +370,10 @@ static int v4lcontrol_get_usb_info(struct v4lcontrol_data *data,
@@ -30,3 +33,19 @@ index 0b0a346..5643dbe 100644
return 0; /* Should never happen */ return 0; /* Should never happen */
/* <Sigh> find ourselve in sysfs */ /* <Sigh> find ourselve in sysfs */
diff --git a/utils/media-ctl/libmediactl.c b/utils/media-ctl/libmediactl.c
index 64ac8cf1..c702da98 100644
--- a/utils/media-ctl/libmediactl.c
+++ b/utils/media-ctl/libmediactl.c
@@ -484,7 +484,7 @@ static int media_get_devname_sysfs(struct media_entity *entity)
} else {
sprintf(devname, "/dev/%s", p + 1);
}
- ret = stat(devname, &devstat);
+ ret = __xstat(0, devname, &devstat);
if (ret < 0)
return -errno;
--
2.34.1

View File

@@ -1,7 +1,9 @@
From 364f6905b83ea967e8ddbadd1824b5d2e1ddca22 Mon Sep 17 00:00:00 2001 From 0293069e85dfb6e2a511fc2d8a703d6bbb906b46 Mon Sep 17 00:00:00 2001
From: Matt Madison <matt@madison.systems> From: Matt Madison <matt@madison.systems>
Date: Thu, 26 Aug 2021 13:30:45 -0700 Date: Thu, 26 Aug 2021 13:30:45 -0700
Subject: [PATCH] Update conversion defaults to match NVIDIA sources Subject: [PATCH 3/3] Update conversion defaults to match NVIDIA sources
Upstream-Status: Inappropriate [tegra platform-specific]
Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Matt Madison <matt@madison.systems>
--- ---
@@ -9,10 +11,10 @@ Signed-off-by: Matt Madison <matt@madison.systems>
1 file changed, 4 insertions(+), 4 deletions(-) 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c diff --git a/lib/libv4lconvert/libv4lconvert.c b/lib/libv4lconvert/libv4lconvert.c
index 5945be4..f2efbc0 100644 index 80f39dc4..fa19d9ca 100644
--- a/lib/libv4lconvert/libv4lconvert.c --- a/lib/libv4lconvert/libv4lconvert.c
+++ b/lib/libv4lconvert/libv4lconvert.c +++ b/lib/libv4lconvert/libv4lconvert.c
@@ -151,10 +151,10 @@ static const struct v4lconvert_pixfmt supported_src_pixfmts[] = { @@ -146,10 +146,10 @@ static const struct v4lconvert_pixfmt supported_src_pixfmts[] = {
{ V4L2_PIX_FMT_OV518, 0, 7, 7, 1 }, { V4L2_PIX_FMT_OV518, 0, 7, 7, 1 },
#endif #endif
/* uncompressed bayer */ /* uncompressed bayer */
@@ -27,3 +29,6 @@ index 5945be4..f2efbc0 100644
{ V4L2_PIX_FMT_STV0680, 8, 8, 8, 1 }, { V4L2_PIX_FMT_STV0680, 8, 8, 8, 1 },
{ V4L2_PIX_FMT_SBGGR10P, 10, 8, 8, 1 }, { V4L2_PIX_FMT_SBGGR10P, 10, 8, 8, 1 },
{ V4L2_PIX_FMT_SGBRG10P, 10, 8, 8, 1 }, { V4L2_PIX_FMT_SGBRG10P, 10, 8, 8, 1 },
--
2.34.1

View File

@@ -1,40 +0,0 @@
SUMMARY = "libv4l2 from v4l-utils, minimally built"
LICENSE = "LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://COPYING.libv4l;md5=d749e86a105281d7a44c2328acebc4b0"
PROVIDES = "libv4l v4l-utils"
COMPATIBLE_MACHINE = "(tegra)"
DEPENDS = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'virtual/libx11', '', d)}"
SRC_URI = "http://linuxtv.org/downloads/v4l-utils/v4l-utils-${PV}.tar.bz2 \
file://0001-Make-plugin-directory-relative-to-ORIGIN.patch \
file://0002-Replace-stat-fstat-calls-with-__xstat-__fxstat.patch \
file://0003-Update-conversion-defaults-to-match-NVIDIA-sources.patch \
"
SRC_URI[md5sum] = "18996bd5e9d83d47055c05de376708cd"
SRC_URI[sha256sum] = "6cb60d822eeed20486a03cc23e0fc65956fbc1e85e0c1a7477f68bbd9802880d"
S = "${WORKDIR}/v4l-utils-${PV}"
inherit autotools gettext pkgconfig features_check
REQUIRED_DISTRO_FEATURES = "opengl"
EXTRA_OECONF = "--disable-libdvbv5 --disable-v4l-utils --disable-qv4l2 \
--enable-shared --disable-qvidcap --disable-gconv --disable-bpf \
--with-udevdir=${nonarch_base_libdir}/udev"
do_install:append:tegra() {
rm -rf ${D}${libdir}/libv4l/plugins
}
PACKAGES =+ "libv4l libv4l-dev"
RPROVIDES:${PN}-dbg += "libv4l-dbg"
FILES:libv4l += "${libdir}/libv4l*${SOLIBS} ${libdir}/libv4l/*.so ${libdir}/libv4l/plugins/*.so \
${libdir}/libv4l/*-decomp"
FILES:libv4l-dev += "${includedir} ${libdir}/pkgconfig \
${libdir}/libv4l*${SOLIBSDEV} ${libdir}/*.la \
${libdir}/v4l*${SOLIBSDEV} ${libdir}/libv4l/*.la ${libdir}/libv4l/plugins/*.la"
RRECOMMENDS:libv4l = "tegra-libraries-multimedia-v4l"
PACKAGE_ARCH = "${TEGRA_PKGARCH}"

View File

@@ -0,0 +1,53 @@
SUMMARY = "libv4l2 from v4l-utils, minimally built"
LICENSE = "LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://COPYING.libv4l;md5=d749e86a105281d7a44c2328acebc4b0"
PROVIDES = "libv4l v4l-utils"
COMPATIBLE_MACHINE = "(tegra)"
DEPENDS = "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'virtual/libx11', '', d)}"
LDFLAGS:append = " -pthread"
# v4l2 explicitly sets _FILE_OFFSET_BITS=32 to get access to
# both 32 and 64 bit file APIs. But it does not handle the time side?
# Needs further investigation
GLIBC_64BIT_TIME_FLAGS = ""
SRC_URI ="git://git.linuxtv.org/v4l-utils.git;protocol=https;branch=stable-1.26 \
file://0001-Make-plugin-directory-relative-to-ORIGIN.patch \
file://0002-Replace-stat-fstat-calls-with-__xstat-__fxstat.patch \
file://0003-Update-conversion-defaults-to-match-NVIDIA-sources.patch \
"
SRCREV = "4aee01a027923cab1e40969f56f8ba58d3e6c0d1"
PV .= "+git${SRCPV}"
S = "${WORKDIR}/git"
inherit meson gettext pkgconfig features_check
REQUIRED_DISTRO_FEATURES = "opengl"
EXTRA_OEMESON = "-Dlibdvbv5=disabled -Dv4l-utils=false -Dqv4l2=disabled -Dqvidcap=disabled -Dgconv=disabled -Djpeg=disabled \
-Dudevdir=${base_libdir}/udev -Dv4l2-compliance-32=false -Dv4l2-ctl-32=false"
CFLAGS:append:libc-glibc = " -DHAVE_RTLD_DI_ORIGIN"
# XXX - Top-level meson.build file uses a variable that
# doesn't get defined if v4l-utils false
do_patch[postfuncs] += "workaround_missing_variable"
workaround_missing_variable() {
sed -i -e'/ir_bpf_enabled/d' ${S}/meson.build
}
do_install:append() {
rm -rf ${D}${libdir}/libv4l/plugins
}
PACKAGES =+ "libv4l libv4l-dev"
RPROVIDES:${PN}-dbg += "libv4l-dbg"
FILES:libv4l += "${libdir}/libv4l*${SOLIBS} ${libdir}/libv4l/*.so ${libdir}/libv4l/plugins/*.so \
${libdir}/libv4l/*-decomp"
FILES:libv4l-dev += "${includedir} ${libdir}/pkgconfig \
${libdir}/libv4l*${SOLIBSDEV} ${libdir}/*.la \
${libdir}/v4l*${SOLIBSDEV} ${libdir}/libv4l/*.la ${libdir}/libv4l/plugins/*.la"
RRECOMMENDS:libv4l = "tegra-libraries-multimedia-v4l"
PACKAGE_ARCH = "${TEGRA_PKGARCH}"