summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-08-12utils: checkstyle.py: Rework commit message parsingLaurent Pinchart
When parsing commit messages, the Commit class tries to optimize the process by invoking git-show once only, extracting both the commit author, title and modified files in one go. As a result, the derived Amendment class needs to implement the commit parsing separately, as the modified files need to be extracted differently for amendments (and the commit ID also needs to be retrieved differently). Furthermore, because of the list of named files, extracting the trailers needs to invoke git-show separately. Improve the situation by reworking the commit message parsing in three steps. In the first step, use git-show to extract the commit ID, author, title and body. In the second step, invoke git-interpret-trailers to extract the trailers from the body that was previously extracted. The third and final step extracts the list of modified files, using different methods for regular commits and amendments. This allows sharing code for the first two steps between the Commit and Amendment classes, making the code simpler. The Commit class still invokes git three times, while the Amendment class runs it three times instead of four, improving performance slightly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-08-12libcamera: formats: Adding Support for Y12Pwill whang
Add support for a 12-bit Mono format named formats::R12_CSI2P. This format is added to support the IMX585 mono sensor, which uses the MEDIA_BUS_FMT_Y12_1X12 media bus format. Signed-off-by: will whang <will@willwhang.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-08-12libcamera: Fix header groupingLaurent Pinchart
The libcamera coding style groups the C and C++ standard library headers in a single group. Fix the few offenders in the source tree. While at it, add a missing blank line between header groups in a separate location. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-08-12libcamera: Add missing <stdint.h> include to internal/yaml_parser.hSergei Trofimovich
Without the change the build fails on upcoming `gcc-15` as: In file included from ../src/libcamera/yaml_parser.cpp:8: ../include/libcamera/internal/yaml_parser.h:183:41: error: 'uint8_t' was not declared in this scope 183 | std::is_same_v<uint8_t, T> || | ^~~~~~~ Signed-off-by: Sergei Trofimovich <slyich@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-08-12libcamera: Add missing <stdint.h> include to base/file.hSergei Trofimovich
Without the change the build fails on upcoming `gcc-15` as: In file included from ../src/libcamera/base/file.cpp:8: ../include/libcamera/base/file.h:62:33: error: 'uint8_t' was not declared in this scope 62 | ssize_t read(const Span<uint8_t> &data); | ^~~~~~~ Signed-off-by: Sergei Trofimovich <slyich@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-08-08libcamera: udev: Catch udev notification errorsKieran Bingham
The udev_monitor_receive_device() can return NULL on an error as detailed in the man pages for the function. The udevNotify() handler in the DeviceEnumeratorUdev directly uses the return value of udev_monitor_receive_device() in successive calls to process the event without having first checked the udev_device. Ensure we identify, and handle events where the udev_device can not be returned successfully. Bug: https://bugs.libcamera.org/show_bug.cgi?id=230 Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: ipa_manager: Remove singleton requirementLaurent Pinchart
The IPAManager class implements a singleton pattern due to the need of accessing the instance in a static member function. The function now takes a pointer to a PipelineHandler, which we can use to access the CameraManager, and from there, the IPAManager. Add accessors to the internal API to expose the CameraManager from the PipelineHandler, and the IPAManager from the CameraManager. This requires allocating the IPAManager dynamically to avoid a loop in includes. Use those accessors to replace the IPAManager singleton. Update the IPA interface unit test to instantiate a CameraManager instead of an IPAManager and ProcessManager, to reflect the new way that the IPAManager is accessed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07utils: checkstyle.py: Fix trailer parsing for commits with changelogsLaurent Pinchart
Trailers are extracted from commits using the '(trailers:*)' formatting specifier. git ignores dividers when doing so, as if the --no-divider options was passed to git-interpret-trailers. This prevents trailers from being located when the patch contains a local changelog. There is unfortuantely no 'no-no-divider' option to the trailers format specifier. Fix the issue by extracting trailers with git-interpret-trailers, that gives better control of the parsing. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07gstreamer: Fix missing "greater than" symbol in author stringJaslo Ziska
Signed-off-by: Jaslo Ziska <jaslo@ziska.de> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-08-07utils: checkstyle.py: Validate SoB trailer against authorLaurent Pinchart
The TrailersChecker enforces the presence of a Signed-off-by tag in the trailer, but doesn't verify that the tag matches the commit's author. Add that verification, as required by the libcamera contribution process. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07utils: checkstyle.py: Add author property to Commit classLaurent Pinchart
Extend the Commit class with an author property, retrieved from the commit. It will be used to extend checkers. While at it, drop the unneeded .strip() call when retrieving the title for amendment commits. The call got carried over from code that initially needed it to strip the new line character, but that need disappeard with usage of .splitlines(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Don't add libcamera_public_headers to libcamera_public_sourcesLaurent Pinchart
Now that libcamera_internal_sources is separate from libcamera_internal_headers, perform the same split for libcamera_public_sources and libcamera_public_headers to ensure consistency of the build system variables. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Consolidate tracepoint header in libcamera_internal_headersLaurent Pinchart
The libcamera_tracepoint_header variable stores the tracepoints.h header custom target, for the sole purpose of being listed as a source of the libcamera shared library, through the libcamera_internal_sources variable. Add the tracepoints.h header to libcamera_internal_headers instead of libcamera_internal_sources, and list libcamera_internal_headers as a source of the shared library, alongside libcamera_internal_sources. This makes libcamera_internal_sources contain sources only, improving clarity of the build system variables. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Add missing headers to libcamera_internal_headersLaurent Pinchart
The ipa_data_serializer.h and ipc_pipe.h headers are missing from libcamera_internal_headers. Add them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Consolidate all IPA headers in libcamera_ipa_headersLaurent Pinchart
The IPA headers are listed in two different meson variables, one for generated headers, and one for the other headers. There's no real reason for this split, consolidate all of them in the libcamera_ipa_headers variable. While at it, don't add the IPA headers to the libcamera_internal_sources variable, but list libcamera_ipa_headers in the sources for the shared library. This moves the libcamera_internal_sources variable towards holding source files, not header files, to improve clarity of the build system. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Move IPA headers to the libcamera_private dependencyLaurent Pinchart
The IPA headers are listed in the libcamera_public and libcamera_private dependency objects, with the generated headers part of the private dependency object and the non-generated headers part of the public dependency object. As neither set of IPA headers are part of the public API, list them both in the libcamera_private dependency object. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Drop libcamera_generated_ipa_headers from sourcesLaurent Pinchart
The libcamera_generated_ipa_headers variable, containing the list of generated IPA headers, is listed in the sources of IPA modules, as well as IPA tests. This was done to ensure that the modules and tests get rebuilt when the generate IPA headers change. However, the dependency is already handled through the libcamera_private dependency object, specified for all those modules and tests. There's no need to list the IPA generated headers as sources. Drop them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Add version.h to public headersLaurent Pinchart
The generated version.h header is part of the public headers, but is missing from the libcamera_public_headers variable. Add it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Split public and internal source arraysDaniel Scally
Meson array variables hold lists of libcamera's source files. To help facilitate the splitting of Doxygen generated documentation into distinct public and internal versions, split those arrays to separate public and internal variables. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Co-developed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Hide *::Private classes with __DOXYGEN_PUBLIC__Laurent Pinchart
The *::Private classes are part of the internal API, as their name implies. They are defined in internal headers, but implemented in the same source file as their public counterparts. This will cause Doxygen to complain about missing class definition when splitting the public and internal API documents, as the internal headers won't be parsed by Doxygen for the public API documentation. Marking the classes with \internal isn't enough. The directive prevents the documentation block from being included in the output, but this occurs at the generation stage, after the documentation blocks are parsed. Fix this by completely hidding the implementation of the *::Private classes from Doxygen using preprocessor conditional compilation. To do so, introduce a new macro, __DOXYGEN_PUBLIC__, that will be defined for the public API documentation only. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Mark internal parts of public classes with \internalLaurent Pinchart
The libcamera public API exposes classes that have parts considered internal. They inherit the Extensible class, and their internal parts are split into a Private class. Those classes are defined in public API headers, and their Private counterparts are defined in internal headers sharing a common file name (in a different directory). Both headers are documented in the same source file. For instance, include/libcamera/camera.h contains the public API of the Camera class, and include/libcamera/internal/camera.h its internal counterpart. Both are documented in src/libcamera/camera.cpp. As the internal headers are not part of the public API, they need to be hidden from the future public API builds. To prepare for doing so, mark them with the \internal Doxygen directive. Hardcode the Doxygen INTERNAL_DOCS option to YES to include the internal API. This will be changed later for the public API documentation build. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Unify Doxygen file directive prefix for formats.hLaurent Pinchart
libcamera has two formats.h headers, an internal one in include/libcamera/internal/, and a public one generated at build time. The convention is to prefix the internal header name with libcamera/internal/ in the Doxygen file directive, but formats.cpp only uses internal/ as a prefix. Unify it with the rest of the code base. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Make all internal headers visible to DoxygenLaurent Pinchart
Two classes that have both public and internal headers, namely Camera and Request, make only their public header visible to Doxygen through a file directive. Fix them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-07libcamera: Drop path prefix from Doxygen file directiveLaurent Pinchart
The Doxygen directive only requires qualifying header file names with a path to differentiate between multiple header files with the same name. Most file directives that refer to unambiguous files do not have a libcamera/ and/or internal/ path prefix, but a few do, most likely due to copy&paste. Drop the prefix in those few files for consistency. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-05utils: checkstyle.py: Warn when no valid Signed-off-by line is foundLaurent Pinchart
All commits to libcamera must include a Signed-off-by line, and that rule is enforced through git hooks and CI. This however doesn't prevent patches from being submitted without an SoB tag, as noticed multiple times in the past. Extend the checkstyle.py trailer checker to issue a warning when the SoB line is missing to try and improve the situation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-05libcamera: software_isp: Replace malloc() with std::vector<>Laurent Pinchart
libcamera is implemented in C++, use std::vector<> to manage the dynamically allocated line buffers instead of malloc() and free(). This simplifies the code and improves memory safety by ensuring no allocation will be leaked. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Hans de Goede <hdegoede@redhat.com>
2024-08-05ipa: libipa: camera_sensor_helper: Reference blackLevel() in documentationLaurent Pinchart
The documentation for the blackLevel_ member is very terse. Reference the more complete documentation of the sibling blackLevel() member function to provide more information. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-05meson: Drop gcc 8 supportLaurent Pinchart
The libcamera CI has retired gcc 8 testing with the end of life of Debian Buster at the end of June 2024. As gcc 8 isn't tested anymore, we can't guarantee it will keep building libcamera correctly. Drop its support. If anyone still has a compelling use case for gcc 8 support for libcamera, we will investigate how to restore it in CI. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-05libcamera: Remove spaces at end of linesLaurent Pinchart
Spaces at end of lines have cropped up in a few places in libcamera. Remove them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-01Document additional environmental variablesPablo Pita
* LIBCAMERA_IPA_PROXY_PATH: path to access a proxy IPA * LIBCAMERA_RPI_TUNING_FILE: used to pass tuning configuration data for the raspberry pi Signed-off-by: Pablo Pita <pablo.pita@gmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-01libcamera: ipa_proxy: Report a missing configuration as a warningMilan Zamazal
When the configuration file for an IPA module is missing, it is reported as an error in the log, for example: ERROR IPAProxy ipa_proxy.cpp:149 Configuration file 'imx219.yaml' not found for IPA module 'simple' This is misleading because several pipelines use uncalibrated.yaml in such a case and can continue working. And in case of software ISP, there is currently no other configuration file so the error is always reported. On the other hand, in some other cases the presence of the configuration file is required and it is an error if it is missing. Let's introduce a new optional argument to IPAProxy::configurationFile that specifies a fallback file if the requested file is not found. If the primary requested file is not found and a non-empty fallback file is specified then a warning is logged and the fallback file is looked up. If neither the fallback file can be found then only then an error is logged and the method returns an empty string. This change has also the benefit of putting the common fallback file ("uncalibrated.yaml") pattern to a single place. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-01libcamera: ipa_proxy: Unify configurationFile argument nameMilan Zamazal
The argument name is different in the declaration and the definition. Let's use the same one in both, namely `name'. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-01libcamera: simple: Log a missing sensor in a better wayMilan Zamazal
SimplePipelineHandler::match may be called several times for different pipeline configurations. Not all of these calls must succeed. For example, for TI AM69 board with a single camera attached, the following error is reported in the log even when libcamera works fine: ERROR SimplePipeline simple.cpp:1558 No sensor found This is because a sensor is found for /dev/media0 but not for /dev/media1. The error is harmless in such a case and only confuses users who may think no camera is detected at all. Let's change the error to info and add the device node to the message to indicate the error is specific to the given media only. It's up to the callers to report a fatal error condition if libcamera cannot work due to no matching pipeline configuration. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-08-01libcamera: software_isp: Remove file seal TODO itemLaurent Pinchart
The file seal TODO item has been addressed. Remove it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Milan Zamazal <mzamazal@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2024-08-01libcamera: shared_mem_object: Prevent memfd from shrinking or growingLaurent Pinchart
The memfd underlying the SharedMem object must not shrink, or memory corruption will happen. Prevent this by setting the shrink seal on the file. As there's no valid use case for growing the memory either, set the grow seal as well. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Milan Zamazal <mzamazal@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2024-08-01libcamera: base: memfd: Handle uClibc compatibility with function wrapperLaurent Pinchart
uClibc doesn't provide memfd_create(), which led libcamera to open-code the call using syscall(). Sprinkling the code with #ifdef's isn't the most readable option, so improve it by providing a local implementation of memfd_create(), and call the function unconditionally from MemFd::create(). This makes the main code path more readable. Suggested-by: Nicolas Dufresne <nicolas@ndufresne.ca> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Milan Zamazal <mzamazal@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2024-08-01libcamera: base: Add MemFd helper classLaurent Pinchart
libcamera creates memfds in two locations already, duplicating some code. Move the code to a new MemFd helper class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Milan Zamazal <mzamazal@redhat.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2024-07-31meson: Enable simple pipeline handler on all platforms by defaultLaurent Pinchart
The simple pipeline handler is enabled by default on arm platforms only, as it used to support arm SoCs only. Now that support for the IPU6 has been added to the pipeline handler, it should be enabled on x86 platforms as well. Fix it. Fixes: 06e0d8508e5c ("libcamera: pipeline: simple: Enable intel-ipu6 with Soft ISP") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2024-07-31libcamera: Avoid variable-length arraysLaurent Pinchart
Unlike in C where they have been standardized since C99, variable-length arrays in C++ are an extension supported by gcc and clang. Clang started warning about this with -Wall in version 18: src/libcamera/ipc_unixsocket.cpp:250:11: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 250 | char buf[CMSG_SPACE(num * sizeof(uint32_t))]; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ One simple option is to disable the warning. However, usage of VLAs in C++ is discouraged by some, usually due to security reasons, based on the rationale that developers are often unaware of unintentional use of VLAs and how they may affect the security of the code when the array size is not properly validated. This rationale may sound dubious, as the most commonly proposed fix is to replace VLAs with vectors (or just arrays dynamically allocated with new() wrapped in unique pointers), without adding any size validation. This will not produce much better results. However, keeping the VLA warning and converting the code to dynamic allocation may still be slightly better, as it can prompt developers to notice VLAs and check if size validation is required. For these reasons, convert all VLAs to std::vector. Most of the VLAs don't need extra size validation, as the size is bound through different constraints (e.g. image width for line buffers). An arguable exception may be the buffers in IPCUnixSocket::sendData() and IPCUnixSocket::recvData() as the number of fds is not bound-checked locally, but we will run out of file descriptors before we could overflow the buffer size calculation. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-07-30apps: qcam: Disable -Wextra-semiLaurent Pinchart
The Qt 6 qkeysequence.h header has an extra semicolon. This causes a build failure with clang: /usr/include/qt6/QtGui/qkeysequence.h:139:26: error: extra ';' after member function definition [-Werror,-Wextra-semi] 139 | Q_ENUM(SequenceMatch); | ^ We can't fix the issue, so ignore the warning in qcam. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-07-26gstreamer: Fix width and height range handlingHou Qi
This changes is fixing critical error message "gst_value_set_int_range_step: assertion 'start < end' failed" observed when building GStreamer caps from a stream configuration whose size range holds a single size. GStreamer range step definition requires distinct min and max values definitions, otherwise above error message is output. libcamera SizeRange instance may return a single size leading to identical min and max values. Add a conditional check where the min and max of the range are distinct during iterating the supported sizes for each pixelformat. To prevent appending structures that are already expressed with this update, gst_caps_merge_structure() is used in place of gst_caps_append_structure(). Signed-off-by: Hou Qi <qi.hou@nxp.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25libcamera v0.3.1v0.3.1Kieran Bingham
The abi-compliance checker reports 100% binary and source compatibility, so this release does not change the SONAME. Binary compatibility: 100% Source compatibility: 100% Total binary compatibility problems: 0, warnings: 0 Total source compatibility problems: 0, warnings: 0 The following commits in this release relate to either a bug fix or improvement to existing commit. - ipa: rpi: Make monoSensor() accessor const - Fixes: 2031e2f29014 ("ipa: rpi: Add accessor function for monoSensor_") - libcamera: dma_buf_allocator: Create memfd with CLOEXEC - Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf") - libcamera: dma_buf_allocator: Work around lack of memfd_create() in uClibc - Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf") - libcamera: dma_buf_allocator: Work around lack of file seals in uClibc - Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf") - test: ipa: rkisp1: utils: Fix floating and fixed point conversion test - Fixes: 9d152e9c66c1 ("ipa: rkisp1: Add a helper to convert floating-point to fixed-point") - ipa: rkisp1: Fix algorithm controls vanish after configure - Fixes: 4c5152843a2a ("ipa: rkisp1: Derive rkisp1::algorithms::Agc from AgcMeanLuminance") - pipeline: rpi: Don't validate configuration in generateConfiguration() - Bug: https://github.com/raspberrypi/libcamera/issues/138 - ipa: rkisp1: agc: Fix initialization without metering modes - Fixes: 35233938ee5d ("ipa: rkisp1: agc: Read histogram weights from tuning file") - v4l2: v4l2_compat: Fix redirect from `__open(at)64_2()` - Fixes: 1023107b6405 ("v4l2: v4l2_compat: Intercept open64, openat64, and mmap64") - ipa: rkisp1: blc: Drop [[maybe_unused]] attribute - Fixes: 50c28e135100 ("ipa: rkisp1: blc: Query black levels from camera sensor helper") - ipa: rkisp1: ccm: Fix ccm metadata output - Fixes: cbfdfa42cacc ("ipa: rkisp1: algorithms: Add crosstalk algorithm") - gstreamer: pool: Replace GstAtomicQueue with deque and mutex - Bug: https://bugs.libcamera.org/show_bug.cgi?id=201 - gstreamer: allocator: Ensure camera manager stay alive - Bug: https://bugs.libcamera.org/show_bug.cgi?id=211 And the following updates have been made in this release, grouped by category: core: - treewide: Query list of cameras just once - libcamera: yaml_parser: Avoid double lookup in `operator[]` - utils: checkstyle.py: Refactor IncludeChecker - utils: checkstyle.py: Extend IncludeChecker to cover math.h - utils: checkstyle.py: Add a check for hex values - utils: checkstyle.py: Show location of coding style issue within line - update-kernel-headers: Add linux/udmabuf.h to headers to sync - include: linux: Update kernel headers to version v6.10-rc1 - libcamera: v4l2_subdevice: Update to the new kernel routing API - libcamera: Rename DmaHeap class to DmaBufAllocator - libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf - libcamera: dma_buf_allocator: Create memfd with CLOEXEC - libcamera: dma_buf_allocator: Work around lack of memfd_create() in uClibc - libcamera: dma_buf_allocator: Work around lack of file seals in uClibc - libcamera: Add gamma control id - clang-format: Make Qt includes matching case sensitive - meson: Group libipa and libipa_includes in a dependency object - libcamera: controls: Add missing period at end of Gamma description - libcamera: yaml_parser: Make default value templated in `get()` - libcamera: yaml_parser: Drop std::enable_if_t guards for get() function - libcamera: yaml_parser: Delegate YamlObject::get() to helper structure - libcamera: yaml_parser: Add support for float types - libcamera: base: log: Declare log categories when defining them - meson: Enable warnings to flag missing declarations - libcamera: Fix maybe-uninitialized error - converter: converter_v4l2_m2m: Rectify streams sanity check - converter: converter_v4l2_m2m: Rename private Stream class - libcamera: converter: Replace usage of stream index by Stream pointer - libcamera: base: utils: Implement hex() for 8-bit and 16-bit values - libcamera: v4l2_videodevice: Use bufferType_ in [get|try|set]Format() - utils: gen-version: Use posix compliant date ----------------------------------------------------------------------------- ipa: - ipa: rpi: Make monoSensor() accessor const - ipa: rkisp1: Add a helper to convert floating-point to fixed-point - ipa: rpi: Disable StatsOutputEnable control by default - ipa: rkisp1: Fix algorithm controls vanish after configure - ipa: rkisp1: Add GammaOutCorrection algorithm - ipa: libipa: Add Vector class - ipa: libipa: Copy pwl from rpi, and clean it up to match libcamera - ipa: rpi: controller: Use libipa's Pwl class - ipa: rkisp1: goc: Fix typographical issues in documentation. - ipa: rkisp1: goc: Drop incorrect [[maybe_unused]] - ipa: rkisp1: goc: Use copydoc - ipa: rkisp1: goc: Mark default gamma table as static constexpr - ipa: rkisp1: goc: Avoid use of auto for short type - libcamera: libipa: camera_sensor: Define AR0521 helper functions inline - ipa: rkisp1: cproc: Use anonymous namespace to limit symbol visibility - ipa: rkisp1: cproc: Merge identical functions - ipa: rkisp1: cproc: Drop incorrect [[maybe_unused]] - ipa: rkisp1: agc: Read histogram weights from tuning file - ipa: rkisp1: agc: Plumb mode-selection and frame duration controls - ipa: libipa: vector: Specialize YamlObject getter - ipa: libipa: vector: Drop readYaml() function - ipa: libipa: pwl: Suffix \param with direction - ipa: libipa: pwl: Make the empty() function inline - ipa: libipa: pwl: Add a size() function - ipa: libipa: pwl: Add a constructor that moves a Point vector - ipa: libipa: pwl: Specialize YamlObject getter - ipa: libipa: Add Matrix class - ipa: libipa: Add MatrixInterpolator class - ipa: rkisp1: algorithms: Add crosstalk algorithm - ipa: libipa: vector: Add matrix-vector multiplication - ipa: rkisp1: agc: Fix initialization without metering modes - ipa: libipa: agc_mean_luminance: Fix enumerator names - ipa: libipa: agc_mean_luminance: Include missing header - ipa: rkisp1: Document all AGC parameters in IPAActiveState - ipa: rkisp1: Document all AGC parameters in IPAFrameContext - ipa: rkisp1: agc: Make size argument to computeHistogramPredivider const - ipa: rkisp1: agc: Don't update histogram parameters unnecessarily - ipa: rkisp1: agc: Simplify predivider calculation - ipa: rkisp1: agc: Use mode from frame context to calculate new EV - ipa: rkisp1: agc: Rename maxShutterSpeed to maxFrameDuration - ipa: rkisp1: agc: Correctly clamp maximum shutter speed - ipa: rkisp1: agc: Move AeEnable control to the AGC algorithm - ipa: rpi: controller: Replace Pwl::readYaml() with YamlObject::get() - ipa: libipa: pwl: Drop readYaml() function - ipa: rkisp1: agc: Rename frame context update variable to updateMetering - ipa: libipa: matrix: Fix incorrect symbol namespace - ipa: ipa_interface: Declare ipaCreate() in libcamera namespace - ipa: rpi: Define local functions in anonymous namespace - ipa: libipa: Add black levels to camera sensor helper - ipa: rkisp1: Move camHelper into IPAContext - ipa: rkisp1: blc: Query black levels from camera sensor helper - ipa: rkisp1: blc: Report sensor black levels in metadata - ipa: rkisp1: data: Update tuning files for imx219 and imx258 - ipa: rkisp1: Move ov4689 and ov5640 black levels into sensor helpers - ipa: rkisp1: blc: Drop [[maybe_unused]] attribute - ipa: rkisp1: Install all tuning files - libipa: camera_sensor_helper: Add OV5675 black level - ipa: rkisp1: awb: Clamp gains to machine limits - ipa: rkisp1: awb: Unconditionally fill metadata - ipa: rkisp1: ccm: Fix ccm metadata output - ipa: rkisp1: ccm: Ensure metadata contains valid ccm - libcamera: libipa: camera_sensor: Add onsemi AR0144 sensor properties - ipa rkisp1: Remove temperatureK from FrameContext ----------------------------------------------------------------------------- apps: - android: camera_capabilities: Fix GCC 14 warning - v4l2: v4l2_compat: Fix redirect from `__open(at)64_2()` - v4l2: v4l2_compat: Move `open*()` flag check into function - py: libcamera: Move function declarations to common header - v4l2: v4l2_compat: Include missing headers - v4l2: v4l2_compat: Selectively disable -Wmissing-declarations - apps: Define local functions in anonymous namespace - apps: common: dng_writer: Workaround for "Unknown tag 33421" error - apps: common: dng_writer: Support RAW16 formats - apps: common: dng_writer: Rename packing functions - apps: common: dng_writer: Add thumbnail scanline function for Raw - apps: common: dng_writer: Support RAW10 and RAW12 format - apps: common: dng_writer: Fix thumbnail generation on BE machines - apps: common: dng_writer: Fix RAW10 and RAW12 packing on BE machines - qcam: viewfinder_qt: Maintain aspect ratio - apps: qcam: Port to Qt 6 - gstreamer: pool: Replace GstAtomicQueue with deque and mutex - gstreamer: allocator: Ensure camera manager stay alive - v4l2: v4l2_compat: Fix ioctl() prototype with musl C library - gst: Add child proxy support to libcamerasrc - gst: Document libcamerasrc multi stream usage ----------------------------------------------------------------------------- test: - test: ipa: rkisp1-utils: Fix capitalization of hex numbers - test: camera: Increase timeout for vimc capture tests - test: fence: Turn class member variable into local variable - test: fence: Fix race condition - test: fence: Increase timeout for fence test - test: v4l2_videodevice: Increase timeout for vimc capture tests - test: ipa: rkisp1-utils: Fix coding style for template arguments - test: ipa: rkisp1: utils: Fix floating and fixed point conversion test - test: ipc: unixsocket: Define local function in anonymous namespace - test: gstreamer: Include missing sanitizer/asan_interface.h header - test: utils: Extend utils::hex() test to 8-bit and 16-bit values - test: gstreamer: Test memory lifetime ----------------------------------------------------------------------------- pipeline: - libcamera: software_isp: Use a specific integer type for black level - libcamera: software_isp: Honor black level in AWB - libcamera: software_isp: Move color mappings out of debayering - libcamera: software_isp: Remove DebayerParams::kGain10 - libcamera: software_isp: Remove TODO about internal representation - pipeline: vimc: Don't hardcode scaling factor with recent kernels - libcamera: software_isp: Allow using dma-buffers from /dev/udmabuf - libcamera: software_isp: Fix includes ordering in simple.cpp - pipeline: rkisp1: cproc: Fix default value handling - pipeline: rpi: Don't validate configuration in generateConfiguration() - libcamera: debayer_cpu: Add 32bits/aligned output formats - libcamera: software_isp: Drop unnecessary sanity check - libcamera: pipeline: simple: Enable intel-ipu6 with Soft ISP - libcamera: pipeline: simple: Enable Soft ISP for TI CSI-RX ----------------------------------------------------------------------------- tuning: - utils: raspberrypi: ctt: Adapt tuning tool for both VC4 and PiSP - utils: raspberrypi: ctt: Added CAC support to the CTT - utils: raspberrypi: ctt: Changed CTT handling of VC4 and PiSP - utils: raspberrypi: ctt: Update tuning tool for HDR - utils: raspberrypi: ctt: Add option to convert between vc4/pisp targets - utils: raspberrypi: ctt: Add a maximum gain parameter for LSC - utils: libtuning: modules: Add skeletal AGC module - utils: tuning: rkisp1: Add skeletal AGC to the rkisp1 tuning script - utils: libtuning: Correct GBRG Image parsing - libtuning: Backport improvements in MacBeth search reliability - libtuning: Fix reference image - libtuning: Copy files from raspberrypi - libtuning: Copy visualize_macbeth_chart from raspberry pi - utils: tuning: Add requirements file and update readme - libtuning: Fix imports - libtuning: Migrate prints to python logging framework - libtuning: Fix visualize_macbeth_chart() - libtuning: Improve filename parsing - libtuning: Implement a minimal yaml parser - libtuning: Reactivate macbeth locator - libtuning: Be a bit more verbose - libtuning: lsc: rkisp1: Clip lsc values to valid range - libtuning: Use the color member of the Image class - libtuning: Remove need for Cam object from ccm - libtuning: modules: Add initial CCM module - libtuning: Handle cases, where no lsc tuning images are present - libtuning: Only warn if processing returns None - libtuning: Add static module - tuning: rkisp1: Add some static modules - libtuning: lsc: rkisp1: Do not calculate ratios to green - libtuning: lsc: Prevent negative values - libtuning: agc: rkisp1: Increase y-target Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25gst: Document libcamerasrc multi stream usageNicolas Dufresne
This adds documentation and an example using gst-launch-1.0. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25gst: Add child proxy support to libcamerasrcNicolas Dufresne
The child proxy interface is needed in order to allow setting properties on pad using parse launch syntax. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25libcamera: libipa: camera_sensor: Add onsemi AR0144 sensor propertiesLaurent Pinchart
Provide the onsemi AR0144 camera sensor properties and registration with libipa for the gain code helpers. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25v4l2: v4l2_compat: Fix ioctl() prototype with musl C libraryLaurent Pinchart
The musl C library, as well as the POSIX standard, define the ioctl() function's request argument as an int. glibc and uclibc, on the other hand, define it as an unsigned long. This difference between the function prototype and the implementation in the V4L2 adaptation layer causes a compilation error with musl. Fix it by detecting the function prototype and declaring the libcamera ioctl() handler accordingly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25gstreamer: allocator: Ensure camera manager stay aliveNicolas Dufresne
Without the camera manager, it is not possible to cleanly delete the FrameBufferAllocator object. Keep the camera manager alive until all the memory object have been released. A shared_ptr to the CameraManager is introduced which is itself stored as a plain pointer and allocated and released explicitly. When more than one C++ member is required, this can be refactored to use a new C++ class, but the struct _GstLibcameraAllocator is allocated and freed by glib, so it does not have automatic destruction presently. Bug: https://bugs.libcamera.org/show_bug.cgi?id=211 [Kieran: Update test framework to remove expected test fail] Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25test: gstreamer: Test memory lifetimeNicolas Dufresne
Test that everything works fine if a buffer outlives the pipeline. [Kieran: Update test path with comments and clarify test case] Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25utils: gen-version: Use posix compliant dateZach DeCook
The version string of libcamera is presently appended with a date/time argument in the case of a dirty tree to show further detail of when it was built. This string is generated with the iso-8601 parameter to 'date' and produces a date string in the form: "2024-06-17T22:15:30+01:00" Strict posix shells or implementations of 'date' which may be optimised for size such as the one provided by busybox or Alpine Linux may not support the '--iso-8601' flag. To support builds on those platforms, use a direct POSIX-compliant date-format string instead matching as closely as possible to the iso-8601 definition. An exact match is not possible with those restrictions so 'date %Y-%m-%dT%H:%M:%S%Z' is used which produces 2024-06-17T22:15:30BST. The use of the human readable timezone identifier provides a friendlier output for the string than a timezone offset at the expense of being less sortable in the exceptionally low risk and unlikely event of two custom builds being compared at the same time of different timezones. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Zach DeCook <zachdecook@librem.one> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-07-25gstreamer: pool: Replace GstAtomicQueue with deque and mutexNicolas Dufresne
The GstAtomicQueue only supports 2 threads, one pushing, and one popping. We pop and push on error cases and we may have multiple threads downstream returning buffer (using tee), which breaks this assumption. On top of which, the release function, that notifies when the queue goes from empty to not-empty relies on a racy empty check. The downstream thread that does this check is effectively concurrent with our thread calling acquire(). Fix this by replacing the GstAtomicQueue with a std::deque, and protect access to that using the object lock. Bug: https://bugs.libcamera.org/show_bug.cgi?id=201 Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>