summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
14 hoursAnd here we are, this is rustjmondi/c-abiJacopo Mondi
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
14 hoursHACK: play with C ABIJacopo Mondi
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
8 daysipa: rkisp1: algorithms: agc: Fix whitespaceLaurent Pinchart
Drop trailing whitespace introduced by mistake. Fixes: 0e0e32b1890c ("ipa: rkisp1: algorithms: agc: Check for correct stats type") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
9 daysipa: rpi: Fix incorrect cast for ExposureTime ControlInfoNaushir Patuck
controls::ExposureTime is of type ControlTypeInteger32, but the default ControlInfoMap casts a value to int64_t causing incorrect initialisation of the associated ControlInfo. Fix this by casting correctly to int32_t. Fixes: bea2db5e6190 ("ipa: rpi: Apply default ControlInfo values for sensor controls") Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 dayslibipa: Drop Vector classStefan Klug
The Vector class from libipa is not used anymore. Drop it. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 daysipa: Use Vector class from libcameraStefan Klug
Now that there is a Vector class in libcamera, use that one. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
10 dayslibcamera: Adapt Vector class to new locationStefan Klug
Change the namespace of the Vector class from libipa to libcamera and add it to the build. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 dayslibcamera: Copy Vector class files from libipaStefan Klug
Prepare the move of the Vector class from libipa to libcamera by copying the relevant files into the corresponding libcamera directories. The files are copied without modification. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 daysipa: rpi: Apply default ControlInfo values for sensor controlsNaushir Patuck
The existing IPA initialisation code did not set default values for some sensor related controls. This caused a crash using libcamerify when the it was trying to access the default value for controls::FrameDurationLimits as part of a recent change. Ensure controls::FrameDurationLimits, controls::AnalogueGain and controls::ExposureTime advertise default values along with the existing min/max values. The default is set to the defaults defined in the IPA set during initialisation. Bug: https://bugs.libcamera.org/show_bug.cgi?id=253 Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 daysipa: rkisp1: agc: Fix build on debian 11 (gcc-9)Stefan Klug
In the CI on debian 11 (gcc 9.3.0 and gcc 10.2.1) compilation fails because the compiler incorrectly selects the explicit ControlInfo(std::set<bool> values, bool def) version of the ControlInfo constructor. This behavior was not reproducible using gcc 9.5.0 and 10.5.0. So it seems newer versions of gcc already contain a fix. Fix the CI build by explicitly passing a ControlValue as second argument to the constructor. Fixes: ee918b370a08 ("ipa: rkisp1: agc: Initialize enum controls with a list of values") Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
11 daysipa: rkisp1: agc: Initialize enum controls with a list of valuesStefan Klug
The controls ExposureTimeMode and AnalogueGainMode are shown in camshark as normal int entries instead of enum popups. The reason is that ControlInfos for these controls are constructed using min/max instead of a list of valid ControlValues. Camshark (and cam) uses the values() vector to deduce if the control is an enum or not. It might be debatable if this is the correct check, but all other ControlInfos for enum controls in libcamera are initialized using a list. Modify the construction of the ControlInfos to use the Span based constructor to fix that issue. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2025-02-06libcamera: log: Match whole category in LIBCAMERA_LOG_LEVELSStefan Klug
A LIBCAMERA_LOG_LEVELS value of "RkISP1:0" also applies to RkISP1Ccm and RkISP1Awb. This behavior is unexpected as it automatically enables all algorithm log categories when the intent is only to increase the log level of the upper category. Fix that replacing the manual matching code with fnmatch. This has the side effect that more wildcards ("?" and "[...]") are supported which is acceptable but won't be advertised. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-02-04libcamera: matrix: Add read-only accessor to internal dataLaurent Pinchart
Add a data() function to the Matrix class to access the internal data. This is useful for code that needs to use the matrix contents as a linear array, as shown by the RkISP1::Ccm::process() function that needs to copy the matrix data to a local variable. Simplify that function by using the new accessor. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
2025-02-04libcamera: pipeline: virtual: Set `FrameError` on errorBarnabás Pőcze
Do not cancel, simply set the buffer's status to `FrameError` to notify the user about the error condition. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2025-02-04libcamera: pipeline: virtual: Fill buffer's metadataBarnabás Pőcze
Fill the `FrameMetadata` object of the `FrameBuffer`s because it should not be left uninitialized as users expect to be able to access it and find reasonable data there. Bug: https://bugs.libcamera.org/show_bug.cgi?id=245 Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2025-02-04libcamera: pipeline: virtual: Simplify error returnBarnabás Pőcze
Just return an `std::unique_ptr` constructed from an empty initializer instead of doing a `reset()` on the existing `config` variable and returning that. This is simpler. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2025-02-04libcamera: base: object,thread: Disable copy/moveBarnabás Pőcze
Objects of type `Object` and `Thread` have address identities, so they should not be just moved/copied. And the special member functions generated by the compiler do not do the right thing. So delete them. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-02-04Documentation: guides: application-developer: Fix variable shadowingBarnabás Pőcze
The mentioned commit mistakenly introduced a new variable for storing the camera instead of just assigining to the global variable defined earlier in the tutorial. Fix that by making it an assignment. Bug: https://bugs.libcamera.org/show_bug.cgi?id=252 Fixes: e77a2751100e38 ("treewide: Query list of cameras just once") Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-02-01libcamera: software_isp: Handle signals in the proper threadMilan Zamazal
inputBufferReady ready signal in the simple pipeline is handled in the pipeline handler thread. outputBufferReady and ispStatsReady signals should be handled there too. Rather than relying on the user of the SoftwareIsp instance, let SoftwareIsp inherits Object. SoftwareIsp serves as a signal proxy, the signals above are emitted from signal handlers. This means that if SoftwareIsp inherits Object then the slots are invoked in SoftwareIsp thread. Which is the camera manager thread because the SoftwareIsp instance is created there. 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>
2025-01-27apps: ppm_writer: Return EIO on I/O errorsMilan Zamazal
EINVAL should be returned only when the requested format is unsupported. On errors when writing the data, let's return EIO, which is the closest description of the situation when we don't inspect it more. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-27apps: ppm_writer: Add a missing includeMilan Zamazal
<errno.h> should be included in the ppm writer, as the source of the error code constants used there. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-27libcamera: software_isp: Move a non-loop condition out of the loopMilan Zamazal
The check for the number of outputs is done in a loop over the outputs. It should be moved out of the loop as it's not loop specific and is just repeated there. This is a cosmetic change not changing any functionality. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-24libcamera: pipeline: Move tuning file override handling to IPAProxyLaurent Pinchart
The rkisp1 and rpi pipeline handlers duplicate code to handle the LIBCAMERA_RKISP1_TUNING_FILE and LIBCAMERA_RPI_TUNING_FILE environment variables that override tuning file selection. Move the common code to IPAProxy::configurationFile() to avoid the duplication, and make the feature available to all pipeline handlers with the same behaviour. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2025-01-24ipa: libipa: lux: Fix indentationLaurent Pinchart
Indentation in a doxygen comment is wrong, fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2025-01-20ipa: raspberry: Report new AeEnable control as availablePaul Elder
Even though the new AeEnable control internally switches on and off the sub-controls (ExposureTimeMode and AnalogueGainMode), it still needs to be declared as available. Report this control as available in the rpi IPA. Support for the control does not need to be added as it is handled by the Camera class. It does not need to be handled in metadata either as the new version of AeEnable is not returned in metadata. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20ipa: rkisp1: agc: Report new AeEnable control as availablePaul Elder
Even though the new AeEnable control internally switches on and off the sub-controls (ExposureTimeMode and AnalogueGainMode), it still needs to be declared as available. Report this control as available in the rkisp1 IPA. Support for the control does not need to be added as it is handled by the Camera class. It does not need to be handled in metadata either as the new version of AeEnable is not returned in metadata. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20libcamera: camera: Pre-process AeEnable controlPaul Elder
Handle the AeEnable under the hood in the Camera class, such that AeEnable activates ExposureTimeMode and AnalogueGain together. This allows applications the convenience of setting auto/manual mode of all of the AE-related controls, as well as protecting applications against a nasty behavior change if an aperture control is added in the future. This also moves common handling code out of the IPA. While we also want to inject AeEnable in Camera::controls() so that IPAs don't have to report it, it is technically difficult at the moment as ControlInfoMaps are not easily modifiable. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20controls: Redefine AeEnablePaul Elder
In the redesign of the AE-related controls, the AeEnable control was intended to be removed in favor of more specific sub-controls for analogue gain and exposure time. However this will cause problems if aperture sub-controls are introduced, and an application from a pre-aperture era uses a camera that supports aperture. If there is no AeEnable control, then a pre-aperture era application might set analogue gain and exposure time to manual, while aperture silently stays auto since that's the default mode. Thus aperture would be uncontrollable by the application. With an AeEnable control, then a pre-aperture era application can set AeEnable to manual, and under the hood all three of analogue gain and exposure time and aperture will be set to manual. The application won't be able to set the manual aperture, however. Although the above scenario is expected to be rare, the scenario with an AeEnable control seems less detrimental. With an AeEnable control at least the aperture would be static at a reasonably usable value, whereas without an AeEnable the aperture would be more-or-less uncontrolable and could go to extreme values as the AEGC algorithm tries to compensate for the manual analogue gain and exposure time values. Thus we redefine the AeEnable control, available only as a control and not in metadata. It will be preprocessed by the Camera class so that the relevant sub-controls are set. No pipline handler nor IPA shall act on the AeEnable control. The IPA still has to report the control as available, however. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20controls: Remove AeLockedJacopo Mondi
Now that the codebase has been ported to use the new AEGC controls remove the definition of AeLocked. AeEnable is not be removed as it will be redefined. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20gstreamer: Generate the new AEGC controlsPaul Elder
Since AeEnable will be replaced with ExposureTimeMode and AnalogueGainMode so that the two can be set between auto/manual independently, update the gstreamer control ids generation to conform with this. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Nicolas Nicolas <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20ipa: rkisp1: Port to the new AEGC controlsPaul Elder
The newly introduced controls to drive the AEGC algorithm allow controlling the computation of the exposure time and analogue gain separately. Augument the RkISP1 AEGC implementation to handle the exposure and gain controls separately using the new controls. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20ipa: raspberry: Port to the new AEGC controlsJacopo Mondi
The newly introduced controls to drive the AEGC algorithm allow to control the computation of the exposure time and analogue gain separately. The RPi AEGC implementation already computes the shutter and gain values separately but does not expose separate functions to control them. Augment the AgcAlgorithm interface to allow pausing/resuming the shutter and gain automatic computations separately and plumb them to the newly introduced controls. Add safety checks to ignore ExposureTime and AnalogueGain values if the algorithms are not paused, and report the correct AeState value by checking if both algorithms have been paused or if they have converged. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Acked-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20test: ipa_data_serialization: Use DebugMetadataEnableJacopo Mondi
Replace the deprecated AeEnable control with DebugMetadataEnable in ipa_data_serialization test. We use DebugMetadataEnable instead of one of the controls replacing AeEnable as they are not boolean controls. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20libcamera: uvcvideo: Register ExposureTimeMode controlJacopo Mondi
Port the UVC pipeline handler to use the new ExposureTimeMode control when processing Camera controls in place of the AeEnable control. The V4L2_CID_EXPOSURE_AUTO control allows 4 possible values, which map to ExposureTimeModeAuto and ExposureTimeModeManual. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20Documentation: design: ae: Document the design for AE controlsPaul Elder
Document the design and rationale for the AE-related controls. Also add documentation for the controls. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20controls: Introduce AEGC-related controlsPaul Elder
Introduce the AeState, ExposureTimeMode and AnalogueGainMode controls to model the AEGC algorithm block. The three controls allow applications to select the exposure time and analogue gain computation calculation mode (auto vs manual) independently from one another, while the AeState control reports the global state for the AEGC algorithm. The new controls are meant to replace the existing AeEnable and AeLocked controls, which are momentarily kept not to break compilation of platforms making use of them. Bug: https://bugs.libcamera.org/show_bug.cgi?id=42 Bug: https://bugs.libcamera.org/show_bug.cgi?id=43 Bug: https://bugs.libcamera.org/show_bug.cgi?id=47 Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-20libcamera: v4l2_subdevice: Work around false positive warningLaurent Pinchart
gcc 13.3.0, as provided by buildroot 2024.11.1, chokes when compiling v4l2_subdevice.cpp with ASan enabled, due to the usage of the C++ standard library regex header: In file included from /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/functional:59, from ../../include/libcamera/base/utils.h:12, from ../../include/libcamera/base/log.h:15, from ../../include/libcamera/internal/v4l2_subdevice.h:20, from ../../src/libcamera/v4l2_subdevice.cpp:8: In constructor ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’, inlined from ‘std::__detail::_State<_Char_type>::_State(std::__detail::_State<_Char_type>&&) [with _Char_type = char]’ at /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/regex_automaton.h:149:4, inlined from ‘std::__detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_begin() [with _TraitsT = std::__cxx11::regex_traits<char>]’ at /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/regex_automaton.h:281:24: /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/std_function.h:405:42: error: ‘*(std::function<bool(char)>*)((char*)&__tmp + offsetof(std::__detail::_StateT, std::__detail::_State<char>::<unnamed>.std::__detail::_State_base::<unnamed>)).std::function<bool(char)>::_M_invoker’ may be used uninitialized [-Werror=maybe-uninitialized] 405 | : _Function_base(), _M_invoker(__x._M_invoker) | ~~~~^~~~~~~~~~ In file included from /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/regex:65, from ../../src/libcamera/v4l2_subdevice.cpp:11: /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/regex_automaton.h: In member function ‘std::__detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_begin() [with _TraitsT = std::__cxx11::regex_traits<char>]’: /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/regex_automaton.h:279:17: note: ‘__tmp’ declared here 279 | _StateT __tmp(_S_opcode_subexpr_begin); | ^~~~~ In member function ‘bool std::_Function_base::_M_empty() const’, inlined from ‘std::function<_Res(_ArgTypes ...)>::operator bool() const [with _Res = bool; _ArgTypes = {char}]’ at /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/std_function.h:574:25, inlined from ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = bool; _ArgTypes = {char}]’ at /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/std_function.h:407:6, inlined from ‘std::__detail::_State<_Char_type>::_State(std::__detail::_State<_Char_type>&&) [with _Char_type = char]’ at /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/regex_automaton.h:149:4, inlined from ‘std::__detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_begin() [with _TraitsT = std::__cxx11::regex_traits<char>]’ at /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/regex_automaton.h:281:24: /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/std_function.h:247:37: error: ‘*(const std::_Function_base*)((char*)&__tmp + offsetof(std::__detail::_StateT, std::__detail::_State<char>::<unnamed>.std::__detail::_State_base::<unnamed>)).std::_Function_base::_M_manager’ may be used uninitialized [-Werror=maybe-uninitialized] 247 | bool _M_empty() const { return !_M_manager; } | ^~~~~~~~~~ /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/regex_automaton.h: In member function ‘std::__detail::_StateIdT std::__detail::_NFA<_TraitsT>::_M_insert_subexpr_begin() [with _TraitsT = std::__cxx11: /host/aarch64-buildroot-linux-gnu/include/c++/13.3.0/bits/regex_automaton.h:279:17: note: ‘__tmp’ declared here 279 | _StateT __tmp(_S_opcode_subexpr_begin); | ^~~~~ This is a false positive that previously occurred with gcc 12.1.0 and was fixed in 12.2 (see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105562), and it seems to have now reappeared. The bug report indicates that the probability of such false positives increase when using sanitizers. As this isn't caught by CI, which compiles libcamera with gcc 13.3.0, the chance that such compilation failures will appear in environments without a clear pattern is relatively high. Work around the problem by disabling the warning around the inclusiong of the regex header. If the regex header needs to be included in other source files, creating a wrapped in libcamera-base may be a cleaner alternative. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2025-01-14DmaBufAllocator: Avoid syncing with an invalid file descriptorHarvey Yang
As DmaSyncer disables the copy c'tor, the move c'tor will be used instead. This leaves some DmaSyncers with invalid SharedFDs. They should avoid syncing with invalid file descriptors in the d'tor. Fixes: 545046a41e17 ("DmaBufAllocator: Make DmaSyncer non-copyable") Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Tested-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-14libcamera: virtual: Install configuration fileBarnabás Pőcze
Install the example configuration file of the virtual pipeline handler as it serves documentation purposes, and to make the virtual pipeline handler easily usable in CI. Nonetheless, the file is installed with the ".example" suffix so that it will not be used by default, to avoid cluttering the camera lists of users whose distributions decide to enable the virtual pipeline handler. The file is installed in the proper location for convenience: (1) is is easier to use it in the CI; (2) users need not browse documentation to determine where they should place the file. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-14libcamera: pipeline: virtual: Demote config file error message to debugLaurent Pinchart
The virtual pipeline handler prints an error message when its configuration file can't be opened. Not providing a configuration file is the default method to disable virtual cameras, so this error is confusing for users. Replace it with a debug message when the configuration file is not found, and keep an error message when it exists but can't be opened. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-14libcamera: pipeline_handler: Enable silent configuration file lookupLaurent Pinchart
The PipelineHandler::configurationFile() function prints an error message when no configuration file is found. It can be useful for pipeline handlers to silence the lookup operation and handle errors themselves. Add a silent parameter to the function to enable this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-10meson: Don't override pipeline list when `auto` is selectedBarnabás Pőcze
Consider `pipelines=auto,virtual`. Previously that would select everything that `auto` would, but not actually enable the `virtual` pipeline handler because the `pipelines` list was reset. Bug: https://bugs.libcamera.org/show_bug.cgi?id=247 Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-10meson: Convert `v4l2` into a feature optionBarnabás Pőcze
The v4l2 compatibility layer does not have external dependencies, the usual benefits of a feature option do not apply. The main motivation behind this change is making use of the `auto_features` meson option that can change all feature options set to "auto" by default to the desired value. This can be useful for two reasons: (1) using auto_features=disabled and then building up the list of features that are desired in the particular build; (2) using auto_features=enabled to achieve (usually) more testing and compilation coverage. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-10gstreamer: allocator: gst_libcamera_allocator_new(): Fix memory leakBarnabás Pőcze
If `FrameBufferAllocator::allocate()` causes the construction to be aborted, the allocated `GstLibcameraAllocator` will not be deallocated properly. Use `g_autoptr()` to address this. `g_steal_pointer()` could only be used in glib 2.68 or later because earlier it evaluates to a pointer-to-void in C++, which would necessitate a `static_cast`. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2025-01-10gstreamer: allocator: gst_libcamera_allocator_new(): Recognize errorsBarnabás Pőcze
`FrameBufferAllocator::allocate()` might return a negative error code, but currently this is handled the same way as success. So instead of continuing, abort the construction of the allocator object. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2025-01-09Thread: Fix setThreadAffinity race condition in startHarvey Yang
Previously we call Thread::setThreadAffinityInternal in Thread::startThread. The purpose was to avoid the main workload being run on incorrect CPUs. This leads to a race condition of setting `Thread::thread_` in `Thread::start()` and accessing `Thread::setThreadAffinityInternal` though. This patch moves the call after the construction of std::thread to avoid the race condition. The downside is that the first tasks, if any, upon starting a thread might be run on incorrect CPUs. Fixes: 4d9db06d6690 ("libcamera: add method to set thread affinity") Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-09utils: codegen: controls.py: Fix missing direction error messagePaul Elder
The error message for missing direction field prints the direction value (usually 'None') instead of the name of the field 'direction'. Fix this. Fixes: 39fe4ad96803 ("utils: codegen: controls.py: Parse direction information") Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-09libcamera: include: Include missing stdint.h headerLaurent Pinchart
Many libcamera headers that use standard C integer types do not include stdint.h. Fix the omission. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-09libcamera: Add missing <stdint.h> include to dma_buf_allocator.hSergei Trofimovich
Without the change the build fails on upcoming `gcc-15` as: In file included from ../src/libcamera/dma_buf_allocator.cpp:9: ../include/libcamera/internal/dma_buf_allocator.h:66:19: error: 'uint64_t' has not been declared 66 | void sync(uint64_t step); | ^~~~~~~~ Signed-off-by: Sergei Trofimovich <slyich@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-01-08libcamera: base: Remove custom __nodiscard attributeMattijs Korpershoek
__nodiscard was introduced for compatibility with C++14. In C++17, there is an official attribute: [[nodiscard]]. Moreover, some libc implementations (like bionic) already define the __nodiscard macro [1]. Since: - libcamera builds with cpp_std=c++17 - [[nodiscard]] is already used in the android HAL (exif) We should replace all usage __nodiscard of by [[nodiscard]] for consistency. Do the replacement and remove the no longer used compiler.h. [1] https://android-review.googlesource.com/c/platform/bionic/+/3254860 Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.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>