summaryrefslogtreecommitdiffstats
path: root/meta-multimedia/recipes-multimedia/libcamera
diff options
context:
space:
mode:
Diffstat (limited to 'meta-multimedia/recipes-multimedia/libcamera')
-rw-r--r--meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-rpi-Use-alloca-instead-of-variable-length-arrays.patch43
-rw-r--r--meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-libcamera-Add-missing-stdint.h-include-to-dma_buf_al.patch38
-rw-r--r--meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-options-Replace-use-of-VLAs-in-C.patch128
-rw-r--r--meta-multimedia/recipes-multimedia/libcamera/libcamera_0.4.0.bb (renamed from meta-multimedia/recipes-multimedia/libcamera/libcamera_0.3.0.bb)13
4 files changed, 45 insertions, 177 deletions
diff --git a/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-rpi-Use-alloca-instead-of-variable-length-arrays.patch b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-rpi-Use-alloca-instead-of-variable-length-arrays.patch
deleted file mode 100644
index c336e92548..0000000000
--- a/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-rpi-Use-alloca-instead-of-variable-length-arrays.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1From 11cc6dbd45f0880beea64cdc514f57484b90bc39 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 20 Feb 2024 18:44:23 -0800
4Subject: [PATCH] rpi: Use malloc instead of variable length arrays
5
6Clang-18+ diagnoses this as error
7
8| ../git/src/ipa/rpi/controller/rpi/alsc.cpp:499:10: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] | 499 | int xLo[X], xHi[X];
9| | ^
10
11Upstream-Status: Submitted [https://lists.libcamera.org/pipermail/libcamera-devel/2024-February/040529.html]
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13
14s
15---
16 src/ipa/rpi/controller/rpi/alsc.cpp | 7 +++++--
17 1 file changed, 5 insertions(+), 2 deletions(-)
18
19diff --git a/src/ipa/rpi/controller/rpi/alsc.cpp b/src/ipa/rpi/controller/rpi/alsc.cpp
20index 8a205c60..a7d42614 100644
21--- a/src/ipa/rpi/controller/rpi/alsc.cpp
22+++ b/src/ipa/rpi/controller/rpi/alsc.cpp
23@@ -496,8 +496,8 @@ void resampleCalTable(const Array2D<double> &calTableIn,
24 * Precalculate and cache the x sampling locations and phases to save
25 * recomputing them on every row.
26 */
27- int xLo[X], xHi[X];
28- double xf[X];
29+ int *xLo = (int*)malloc(X), *xHi = (int*)malloc(X);
30+ double *xf = (double*)malloc(X);
31 double scaleX = cameraMode.sensorWidth /
32 (cameraMode.width * cameraMode.scaleX);
33 double xOff = cameraMode.cropX / (double)cameraMode.sensorWidth;
34@@ -539,6 +539,9 @@ void resampleCalTable(const Array2D<double> &calTableIn,
35 *(out++) = above * (1 - yf) + below * yf;
36 }
37 }
38+ free(xf);
39+ free(xHi);
40+ free(xLo);
41 }
42
43 /* Calculate chrominance statistics (R/G and B/G) for each region. */
diff --git a/meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-libcamera-Add-missing-stdint.h-include-to-dma_buf_al.patch b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-libcamera-Add-missing-stdint.h-include-to-dma_buf_al.patch
new file mode 100644
index 0000000000..18ba353de2
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-libcamera-Add-missing-stdint.h-include-to-dma_buf_al.patch
@@ -0,0 +1,38 @@
1From 91de550243121056984e5b9b693b486860655d31 Mon Sep 17 00:00:00 2001
2From: Sergei Trofimovich <slyich@gmail.com>
3Date: Sat, 28 Dec 2024 19:11:19 +0000
4Subject: [PATCH] libcamera: Add missing <stdint.h> include to
5 dma_buf_allocator.h
6
7Without the change the build fails on upcoming `gcc-15` as:
8
9 In file included from ../src/libcamera/dma_buf_allocator.cpp:9:
10 ../include/libcamera/internal/dma_buf_allocator.h:66:19: error: 'uint64_t' has not been declared
11 66 | void sync(uint64_t step);
12 | ^~~~~~~~
13
14Signed-off-by: Sergei Trofimovich <slyich@gmail.com>
15Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
16Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
17Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
18
19Upstream-Status: Backport [https://git.libcamera.org/libcamera/libcamera.git/commit/?id=91de550243121056984e5b9b693b486860655d31]
20---
21 include/libcamera/internal/dma_buf_allocator.h | 1 +
22 1 file changed, 1 insertion(+)
23
24diff --git a/include/libcamera/internal/dma_buf_allocator.h b/include/libcamera/internal/dma_buf_allocator.h
25index d26f8a74..13600915 100644
26--- a/include/libcamera/internal/dma_buf_allocator.h
27+++ b/include/libcamera/internal/dma_buf_allocator.h
28@@ -8,6 +8,7 @@
29 #pragma once
30
31 #include <memory>
32+#include <stdint.h>
33 #include <string>
34 #include <vector>
35
36--
372.34.1
38
diff --git a/meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-options-Replace-use-of-VLAs-in-C.patch b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-options-Replace-use-of-VLAs-in-C.patch
deleted file mode 100644
index 473820653e..0000000000
--- a/meta-multimedia/recipes-multimedia/libcamera/libcamera/0002-options-Replace-use-of-VLAs-in-C.patch
+++ /dev/null
@@ -1,128 +0,0 @@
1From 6e4736180fcaffdb06acf52fd3eb50ba5baa3d2a Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 31 Jan 2024 21:04:28 -0800
4Subject: [PATCH] options: Replace use of VLAs in C++
5
6Clang++ 18 is fussy about this with new warning checks.
7
8 ../git/src/apps/common/options.cpp:882:20: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
9 882 | char shortOptions[optionsMap_.size() * 3 + 2];
10 | ^~~~~~~~~~~~~~~~~~~~~~~~~~
11
12Therefore replace using VLAs with alloca and malloc/free
13
14Upstream-Status: Submitted [https://lists.libcamera.org/pipermail/libcamera-devel/2024-February/040381.html]
15Signed-off-by: Khem Raj <raj.khem@gmail.com>
16---
17 src/apps/common/options.cpp | 12 ++++++++++--
18 src/libcamera/ipc_unixsocket.cpp | 13 +++++++++----
19 2 files changed, 19 insertions(+), 6 deletions(-)
20
21diff --git a/src/apps/common/options.cpp b/src/apps/common/options.cpp
22index 4f7e8691..3656f3c1 100644
23--- a/src/apps/common/options.cpp
24+++ b/src/apps/common/options.cpp
25@@ -879,8 +879,8 @@ OptionsParser::Options OptionsParser::parse(int argc, char **argv)
26 * Allocate short and long options arrays large enough to contain all
27 * options.
28 */
29- char shortOptions[optionsMap_.size() * 3 + 2];
30- struct option longOptions[optionsMap_.size() + 1];
31+ char *shortOptions = (char*)malloc(optionsMap_.size() * 3 + 2);
32+ struct option *longOptions = (struct option*)malloc(sizeof(struct option) * (optionsMap_.size() + 1));
33 unsigned int ids = 0;
34 unsigned int idl = 0;
35
36@@ -935,12 +935,16 @@ OptionsParser::Options OptionsParser::parse(int argc, char **argv)
37 std::cerr << argv[optind - 1] << std::endl;
38
39 usage();
40+ free(shortOptions);
41+ free(longOptions);
42 return options;
43 }
44
45 const Option &option = *optionsMap_[c];
46 if (!parseValue(option, optarg, &options)) {
47 usage();
48+ free(shortOptions);
49+ free(longOptions);
50 return options;
51 }
52 }
53@@ -949,10 +953,14 @@ OptionsParser::Options OptionsParser::parse(int argc, char **argv)
54 std::cerr << "Invalid non-option argument '" << argv[optind]
55 << "'" << std::endl;
56 usage();
57+ free(shortOptions);
58+ free(longOptions);
59 return options;
60 }
61
62 options.valid_ = true;
63+ free(shortOptions);
64+ free(longOptions);
65 return options;
66 }
67
68diff --git a/src/libcamera/ipc_unixsocket.cpp b/src/libcamera/ipc_unixsocket.cpp
69index 1980d374..3bd861cb 100644
70--- a/src/libcamera/ipc_unixsocket.cpp
71+++ b/src/libcamera/ipc_unixsocket.cpp
72@@ -8,6 +8,7 @@
73 #include "libcamera/internal/ipc_unixsocket.h"
74
75 #include <array>
76+#include <cstdint>
77 #include <poll.h>
78 #include <string.h>
79 #include <sys/socket.h>
80@@ -247,8 +248,8 @@ int IPCUnixSocket::sendData(const void *buffer, size_t length,
81 iov[0].iov_base = const_cast<void *>(buffer);
82 iov[0].iov_len = length;
83
84- char buf[CMSG_SPACE(num * sizeof(uint32_t))];
85- memset(buf, 0, sizeof(buf));
86+ char *buf = (char*)malloc(CMSG_SPACE(num * sizeof(uint32_t)));
87+ memset((void*)buf, 0, sizeof(buf));
88
89 struct cmsghdr *cmsg = (struct cmsghdr *)buf;
90 cmsg->cmsg_len = CMSG_LEN(num * sizeof(uint32_t));
91@@ -270,9 +271,11 @@ int IPCUnixSocket::sendData(const void *buffer, size_t length,
92 int ret = -errno;
93 LOG(IPCUnixSocket, Error)
94 << "Failed to sendmsg: " << strerror(-ret);
95+ free(buf);
96 return ret;
97 }
98
99+ free(buf);
100 return 0;
101 }
102
103@@ -283,8 +286,8 @@ int IPCUnixSocket::recvData(void *buffer, size_t length,
104 iov[0].iov_base = buffer;
105 iov[0].iov_len = length;
106
107- char buf[CMSG_SPACE(num * sizeof(uint32_t))];
108- memset(buf, 0, sizeof(buf));
109+ char *buf = (char*)malloc(CMSG_SPACE(num * sizeof(uint32_t)));
110+ memset((void*)buf, 0, sizeof(buf));
111
112 struct cmsghdr *cmsg = (struct cmsghdr *)buf;
113 cmsg->cmsg_len = CMSG_LEN(num * sizeof(uint32_t));
114@@ -305,12 +308,14 @@ int IPCUnixSocket::recvData(void *buffer, size_t length,
115 if (ret != -EAGAIN)
116 LOG(IPCUnixSocket, Error)
117 << "Failed to recvmsg: " << strerror(-ret);
118+ free(buf);
119 return ret;
120 }
121
122 if (fds)
123 memcpy(fds, CMSG_DATA(cmsg), num * sizeof(uint32_t));
124
125+ free(buf);
126 return 0;
127 }
128
diff --git a/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.3.0.bb b/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.4.0.bb
index 93f29c1612..c7fe631a43 100644
--- a/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.3.0.bb
+++ b/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.4.0.bb
@@ -11,23 +11,23 @@ LIC_FILES_CHKSUM = "\
11SRC_URI = " \ 11SRC_URI = " \
12 git://git.libcamera.org/libcamera/libcamera.git;protocol=https;branch=master \ 12 git://git.libcamera.org/libcamera/libcamera.git;protocol=https;branch=master \
13 file://0001-media_device-Add-bool-return-type-to-unlock.patch \ 13 file://0001-media_device-Add-bool-return-type-to-unlock.patch \
14 file://0002-options-Replace-use-of-VLAs-in-C.patch \ 14 file://0002-libcamera-Add-missing-stdint.h-include-to-dma_buf_al.patch \
15 file://0001-rpi-Use-alloca-instead-of-variable-length-arrays.patch \
16" 15"
17 16
18SRCREV = "aee16c06913422a0ac84ee3217f87a9795e3c2d9" 17SRCREV = "35ed4b91291d9f3d08e4b51acfb51163e65df8f8"
19 18
20PE = "1" 19PE = "1"
21 20
22S = "${WORKDIR}/git"
23 21
24DEPENDS = "python3-pyyaml-native python3-jinja2-native python3-ply-native python3-jinja2-native udev gnutls chrpath-native libevent libyaml" 22DEPENDS = "python3-pyyaml-native python3-jinja2-native python3-ply-native python3-jinja2-native udev gnutls chrpath-native libevent libyaml"
25DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'qt', 'qtbase qtbase-native', '', d)}" 23DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'qt', 'qtbase qtbase-native', '', d)}"
26 24
27PACKAGES =+ "${PN}-gst" 25PACKAGES =+ "${PN}-gst ${PN}-pycamera"
28 26
29PACKAGECONFIG ??= "" 27PACKAGECONFIG ??= ""
28PACKAGECONFIG[dng] = ",,tiff"
30PACKAGECONFIG[gst] = "-Dgstreamer=enabled,-Dgstreamer=disabled,gstreamer1.0 gstreamer1.0-plugins-base" 29PACKAGECONFIG[gst] = "-Dgstreamer=enabled,-Dgstreamer=disabled,gstreamer1.0 gstreamer1.0-plugins-base"
30PACKAGECONFIG[pycamera] = "-Dpycamera=enabled,-Dpycamera=disabled,python3 python3-pybind11"
31 31
32LIBCAMERA_PIPELINES ??= "auto" 32LIBCAMERA_PIPELINES ??= "auto"
33 33
@@ -45,7 +45,7 @@ RDEPENDS:${PN} = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland qt', 'qtwayla
45inherit meson pkgconfig python3native 45inherit meson pkgconfig python3native
46 46
47do_configure:prepend() { 47do_configure:prepend() {
48 sed -i -e 's|py_compile=True,||' ${S}/utils/ipc/mojo/public/tools/mojom/mojom/generate/template_expander.py 48 sed -i -e 's|py_compile=True,||' ${S}/utils/codegen/ipc/mojo/public/tools/mojom/mojom/generate/template_expander.py
49} 49}
50 50
51do_install:append() { 51do_install:append() {
@@ -71,6 +71,7 @@ do_package_recalculate_ipa_signatures() {
71 71
72FILES:${PN} += " ${libexecdir}/libcamera/v4l2-compat.so" 72FILES:${PN} += " ${libexecdir}/libcamera/v4l2-compat.so"
73FILES:${PN}-gst = "${libdir}/gstreamer-1.0" 73FILES:${PN}-gst = "${libdir}/gstreamer-1.0"
74FILES:${PN}-pycamera = "${PYTHON_SITEPACKAGES_DIR}/libcamera"
74 75
75# libcamera-v4l2 explicitly sets _FILE_OFFSET_BITS=32 to get access to 76# libcamera-v4l2 explicitly sets _FILE_OFFSET_BITS=32 to get access to
76# both 32 and 64 bit file APIs. 77# both 32 and 64 bit file APIs.