summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
4 daysapps: 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>
4 dayslibcamera: 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>
6 dayslibcamera: 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>
6 daysipa: 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>
11 daysipa: 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>
11 daysipa: 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>
11 dayslibcamera: 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>
11 dayscontrols: 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>
11 dayscontrols: 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>
11 daysipa: 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>
11 daysipa: 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>
11 dayslibcamera: 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>
11 dayscontrols: 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>
11 dayslibcamera: 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: 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-08libcamera: camera_sensor: Add support for embedded dataLaurent Pinchart
Some sensors support producing and transmitting embedded data over a stream separate from the image stream. Add support for this feature in the CameraSensor interface, and implement it for the CameraSensorRaw class. The CameraSensorLegacy uses the default stub implementation, as the corresponding kernel drivers don't support embedded data. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-08libcamera: Add CameraSensor implementation for raw V4L2 sensorsLaurent Pinchart
Add a new CameraSensorRaw implementation of the CameraSensor interface tailored to devices that implement the new V4L2 raw camera sensors API. This new class duplicates code from the CameraSensorLegacy class. The two classes will be refactored to share code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-08libcamera: v4l2_videodevice: Update to the new kernel metadata APILaurent Pinchart
With support for metadata in the streams API, the v4l2_meta_format structure has been extended with width, height and bytesperline fields. Support them in the V4L2VideoDevice getFormat() and setFormat() functions is the video device is meta capture device and if the pixel format is one of the generic line-based metadata formats. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-08libcamera: v4l2_subdevice: Add new metadata formatsLaurent Pinchart
Support the newly introduced V4L2 media bus formats for metadata. This includes generic metadata formats, and two sensor-specific embedded data formats. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-08ipa: rpi: Provide the camera helper with the hardware configurationNaushir Patuck
Add a CamHelper::setHwConfig() helper used by the IPA to set the hardware configuration in use by the pipeline. This will be needed by the IMX500 camera helper in a future commit to determine if the metadata buffer is strided. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-08ipa: rpi: Add a HW property to determine if the data buffer is stridedNaushir Patuck
This property (dataBufferStrided) indicates if the CSI-2 hardware writes to the embedded/metadata buffer directly, or if it treats the buffer like an image buffer and strides the metadata lines. Unicam writes this buffer strided, while the PiSP Frontend writes to it directly. This information will be relevant to data parsers in the helpers where the data is structured in lines. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-08ipa: rpi: Add erase()/eraseLocked() to RPiController::MetadataNaushir Patuck
These functions erase a key/value pair from the metadata object. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-08ipa: rpi: Use r-value references in the set()/setLocked() functionsNaushir Patuck
Use an r-value reference in set() and setLocked(), allowing more efficient metadata handling with std::forward and std::move if needed. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-08ipa: rpi: Add vc4 tuning files for imx415Dave Stevenson
Basic tuning done by David Plowman using a Waveshare SKU 28524 "IMX415-98 IR-CUT Camera" module. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-08ipa: rpi: Add cam_helper for imx415Dave Stevenson
As another Starvis sensor, it is near identical to imx290/327. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-08libcamera: camera_sensor_properties: Add delays for imx415Dave Stevenson
Believed correct based on imx290. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-07DmaBufAllocator: Make DmaSyncer non-copyableHarvey Yang
As DmaSyncer does sync start/end in the c'tor/d'tor, copying a DmaSyncer instance would trigger sync end earlier than expected. This patch makes it non-copyable to avoid the issue. Fixes: 39482d59fe71 ("DmaBufAllocator: Add Dma Buffer synchronization function & helper class") Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> 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>
2025-01-06libcamera: virtual: Speed up test pattern animationBarnabás Pőcze
After the initial generation, when a frame is requested, the test pattern generator rotates the image left by 1 column. The current approach has two shortcomings: (1) it allocates a temporary buffer to hold one column; (2) it swaps two columns at a time. The test patterns are simple ARGB images, in row-major order, so doing (2) works against memory prefetching. This can be addressed by doing the rotation one row at a time as that way the image is addressed in a purely linear fashion. Doing so also eliminates the need for a dynamically allocated temporary buffer, as the required buffer now only needs to hold one sample, which is 4 bytes in this case. In an optimized build, this results in about a 2x increase in the number of frames per second as reported by `cam`. In an unoptimized, ASAN and UBSAN intrumented build, the difference is even bigger, which is useful for running lc-compliance in CI in a reasonable time. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-01-06libcamera: virtual: Query number of planes correctlyBarnabás Pőcze
`PixelFormatInfo::planes.size()` always returns 3 since `planes` is an array, but that is not the number of planes of the pixel format. Use the `numPlanes()` getter instead. 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-06libcamera: virtual: Avoid some copiesBarnabás Pőcze
There is no reason make copies, these functions return const lvalue references, access the data through those. 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>
2024-12-23ipa: rkisp1: Add Lux algorithm modulePaul Elder
Add a lux algorithm module to rkisp1 IPA for estimating the lux level of an image. This is reported in metadata, as well as saved in the frame context so that other algorithms (mainly AGC) can use its value. It does not set any controls. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2024-12-23ipa: libipa: Add Lux helperPaul Elder
Add a Lux helper to libipa that does the estimation of the lux level given gain, exposure, and luminance histogram. The helper also handles reading the reference values from the tuning file. These are expected to be common operations of lux algorithm modules in IPAs, and is modeled/copied from Raspberry Pi. 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> Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2024-12-20ipa: rpi: awb: Make it possible to set the colour temperature directlyDavid Plowman
ColourTemperature is now exported as a writable control so that applications can set it directly. The AWB algorithm class now requires a method to be provided to perform this operation. The method should clamp the passed value to the calibrated range known to the algorithm. The default range is set very wide to cover all conceivable future AWB calibrations. It will always be clamped before use. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Tested-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-12-20ipa: rkisp1: awb: Implement ColourTemperature controlStefan Klug
There are many use-cases (tuning-validation, working in static environments) where a manual ColourTemperature control is helpful. Implement that by interpolating and applying the white balance gains from the tuning file according to the requested colour temperature. If colour gains are provided on the same request, they take precedence. Store the colour temperature used for a given frame in the frame context and report that in metadata. Note that in the automatic case, the colour gains are still based on the gray world model and the CT curve from the tuning file get ignored. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20ipa: rkisp1: awb: Load white balance gains from tuning fileStefan Klug
For the implementation of a manual colour temperature setting, it is necessary to read predefined colour gains per colour temperature from the tuning file. Implement this in a backwards compatible way. If no gains are contained in the tuning file, loading just continues as before. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-20libcamera: controls: Update the ColourTemperature control to be writableStefan Klug
For manual control it is helpful to be able to specify a fixed colour temperature. It also provides an easy way to apply the temperature specific CCMs and colour gains that are contained in the tuning files. Document this and update the control dependencies. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-18apps: cam: Print control direction informationPaul Elder
Now that there is support for retrieving the allowed directions of a control, print this information when listing controls. Sample output: $ cam --list-controls -c 2 Using camera Virtual0 as cam0 Control: [inout] draft::FaceDetectMode: - FaceDetectModeOff (0) Control: [inout] libcamera::FrameDurationLimits: [16666..33333] Size: 2 Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-18libcamera: controls: Add support for querying direction informationPaul Elder
Add support to ControlId for querying direction information. This allows applications to query whether a ControlId is meant for being set in controls or to be returned in metadata or both. This also has a side effect of properly encoding this information, as previously it was only mentioned losely and inconsistently in the control id definition. 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> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-12-18utils: codegen: controls.py: Parse direction informationPaul Elder
In preparation for adding support for querying direction information from controls, parse the direction information from control ID definitions. This can later be plugged in directly to the IPA code generators simply by using ctrl.direction. 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> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-12-18libcamera: controls: Populate direction field in control definitionsPaul Elder
In preparation for adding support for querying direction information from controls, populate the corresponding field in the control ID defintions. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-12-17ipa: mali-c55: Add IMX415 tuning data fileDaniel Scally
Add a tuning data file for the IMX415 camera sensor. The black level offset data is drawn from the camera sensor's datasheet. The lens shading tables are generated through the libtuning LSC modules. Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-12-17ipa: mali-c55: Add Lens Shading Correction algorithmDaniel Scally
Add a lens shading correction algorithm to the mali-c55 IPA. This algorithm parses tables from Yaml in a easy to follow format before munging them into Arm's interleaved mesh to be copied to the ISP. A colour temperature estimate from the AGC statistics is used to select the appropriate table to apply; this can be some interpolation of two tables, in which case the colour temperature estimate is also used to derive the coefficient that does the blending. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-12-17ipa: mali-c55: Add AWB AlgorithmDaniel Scally
Add a simple grey-world auto white balance algorithm to the mali-c55 IPA. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Nayden Kanchev <nayden.kanchev@arm.com> Co-developed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>