Commit Graph

5692 Commits

Author SHA1 Message Date
Barnabás Pőcze
43dfbe2541 libcamera: camera_sensor: getFormat(): Use span
The function takes a const std::vector reference, but it does
not actually need an `std::vector`. So use a `libcamera::Span`
instead to avoid forcing the caller to construct a vector.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-08-13 12:48:47 +02:00
Barnabás Pőcze
39d37fce12 libcamera: camera_sensor: getControls(): Use span
The function takes a const std::vector reference, but it does
not actually need an `std::vector`. So use a `libcamera::Span`
instead to avoid forcing the caller to construct a vector.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-08-13 12:48:42 +02:00
Umang Jain
01a9b83f38 pipeline: simple: Improve debug log in validate()
Improve the debug log while adjusting the StreamConfiguration's
pixel format. The log should clearly indicate the requested pixel
format and the adjusted pixel format.

Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-11 18:44:29 +01:00
Barnabás Pőcze
14882b8314 treewide: Remove top-level const from return types
Top-level `const` qualifiers are not useful, so avoid them. This is done
either by simply removing the top-level `const`, or making the function
return a reference to const where that is appropriate.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2025-08-11 12:21:32 +02:00
Barnabás Pőcze
3b72e7d306 Revert "controls: Add boolean constructors for ControlInfo"
This reverts commit 10cdc914da.

The constructors introduced by that commit are not used anywhere,
and they do not match the existing practice for boolean controls.

Specifically, every single boolean control is described by calling
the `ControlInfo(ControlValue, ControlValue, ControlValue)`
constructor. Crucially, that constructor does not set `values_`,
while the two removed constructors do. And whether or not `values_`
has any elements is currently used as an implicit sign to decide
whether or not the control is "enum-like", and those are assumed
to have type `int32_t`.

For example, any boolean control described using any of the two
removed constructors would cause an assertion in failure in
`CameraSession::listControls()` when calling `value.get<int32_t>()`.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2025-08-11 09:32:58 +02:00
Barnabás Pőcze
a7cda79dee libcamera: converter_v4l2_m2m: Add missing <set> include
`std::set` is directly used in the file, but not directly included.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-11 09:32:27 +02:00
Kieran Bingham
aa0a91c48d libcamera v0.5.2
The abi-compliance checker reports 100% compatibility in this release.
As such the SONAME is maintained at 0.5.

 Binary compatibility: 100%
 Source compatibility: 100%
 Total binary compatibility problems: 0, warnings: 0
 Total source compatibility problems: 0, warnings: 0

This release brings 129 commits with some substantial development on gstreamer
for this release which is nice to see.

In core we can see development that cleans up ProcessManager in a drive to
reduce singleton patterns throughout libcamera. There's a new ClockRecovery
class from Raspberry Pi which supports the new Wallclock timestamps
metadata and provides the capablity for synchronising cameras across
devices which will very exciting to see in the future.

Pipelines are now able to limit the number of requests queued into the pipeline
handler which helps prevent issues when applications desire to use a larger
request queue. This is particularly beneficial to pipewire based applications
it seems with longer processing queues.

It's now possible to check if controls exist with new macros defined for
every control to help codebases compile against multiple versions:
 - LIBCAMERA_HAS_$VENDOR_VENDOR_$MODE_$NAME

And for developers we now have a b4-config file to support easily using the
tool to send patche to the mailinglist!

On the apps side, there's lots of development on Gstreamer, including fixing
bayer formats for 10/12/14/16 bit depths. Both cam and gstreamer now report the
camera properties in full with text representations of all the enum/properties.

With the IPA components, Raspberry Pi includes development and updates to
Autofocus and makes the maximum digital gain limits configurable. RKISP1 now
has ExposureValue control implemented using exposure compensation in the
agc_mean_luminance implementation. The ST vd56g3 camera sensor support is added
for both RPi and libipa platforms.

For Pipeline Handlers notable updates include the imx8-isi being fixed for
newer generation chips from NXP adding multi-camera support, and Wallclock
timestamp support added to Rapsberry Pi.

Finally, on the documentation side - a notable change is the update to use
spinhx-doxylink. This should prevent stale links being used in the
documentation pages but adds an extra tool to the dependencies for building the
documentation.

Contributors:

    27  Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
    23  Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    17  Stefan Klug <stefan.klug@ideasonboard.com>
    12  David Plowman <david.plowman@raspberrypi.com>
    10  Naushir Patuck <naush@raspberrypi.com>
     9  Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
     7  Umang Jain <uajain@igalia.com>
     5  Antoine Bouyer <antoine.bouyer@nxp.com>
     5  Benjamin Mugnier <benjamin.mugnier@foss.st.com>
     3  Jaslo Ziska <jaslo@ziska.de>
     2  Daniel Scally <dan.scally@ideasonboard.com>
     2  Kieran Bingham <kieran.bingham@ideasonboard.com>
     1  Christian Rauch <Rauch.Christian@gmx.de>
     1  Han-Lin Chen <hanlinchen@chromium.org>
     1  Harvey Yang <chenghaoyang@chromium.org>
     1  Hou Qi <qi.hou@nxp.com>
     1  Milan Zamazal <mzamazal@redhat.com>
     1  Nícolas F. R. A. Prado <nfraprado@collabora.com>
     1  Paul Elder <paul.elder@ideasonboard.com>

 143 files changed, 6004 insertions(+), 1620 deletions(-)

Integration overview:

The following commits in this release relate to either a bug fix or an
improvement to an existing commit.

 - pipeline: imx8-isi: Cosmetic changes
   - Fixes: 680cde6005 ("libcamera: imx8-isi: Split Bayer/YUV config generation")
 - pipeline: imx8-isi: Fix match returned value in error case
   - Fixes: 0ec982d210 ("libcamera: pipeline: Add IMX8 ISI pipeline")
 - gstreamer: Replace NULL with nullptr
   - Reported-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
 - libcamera: base: Fix log level parsing when multiple categories are listed
   - Fixes: 24c2caa1c1 ("libcamera: base: log: Use `std::string_view` to avoid some copies")
 - libcamera: pipeline: uvcvideo: Silently ignore `AeEnable`
   - Fixes: ffcecda4d5 ("libcamera: pipeline: uvcvideo: Report new AeEnable control as available")
 - ipa: rpi: Defer initialising AF LensPosition ControlInfo and value
   - Bug: https://bugs.libcamera.org/show_bug.cgi?id=258
 - subprojects: libpisp: Update to 1.2.1
   - Bug: https://github.com/raspberrypi/libpisp/pull/43
 - ipa: rpi: Fix bug in AfState reporting
   - Fixes: ea5f451c56 ("ipa: rpi: controller: AutoFocus bidirectional scanning")
 - libcamera: base: bound_method: Move return value
   - Bug: https://bugs.libcamera.org/show_bug.cgi?id=273#c1
 - libcamera: camera: Fix up the AeEnable control during Camera::start()
   - Fixes: 7abd413905 ("libcamera: camera: Pre-process AeEnable control")
 - libcamera: Put buffer back to V4L2BufferCache when VIDIOC_QBUF fails
   - Fixes: cadae67e45 ("libcamera: v4l2_videodevice: Add FrameBuffer interface")
 - utils: codegen: ipc: Check `ipc_` instead of `isolate_`
   - Bug: https://bugs.libcamera.org/show_bug.cgi?id=276
 - libcamera: camera: Do not call `generateConfiguration()` synchronously
   - Bug: https://bugs.libcamera.org/show_bug.cgi?id=273
 - meson: Update subprojects .gitignore
   - Fixes: a29c53f6a6 ("meson: Use libyaml wrap file from wrapdb")

And the following updates have been made in this release, grouped by category:

core:
 - libcamera: base: log: Take `LogCategory` by reference
 - libcamera: base: Fix log level parsing when multiple categories are listed
 - libcamera: process: Use `pid_` member to decide if running
 - libcamera: process: start(): Use span instead of vector
 - libcamera: process: closeAllFdsExcept(): Take vector by value
 - libcamera: process: Move `closeAllFdsExcept()`
 - libcamera: process: Use `close_range()` when available
 - libcamera: process: Remove `ProcessManager` singleton
 - libcamera: process: Disable copy/move
 - libcamera: process: Misc. cleanup around `execv()`
 - libcamera: process: Return error if already running
 - libcamera: process: Ensure that file descriptors are nonnegative
 - libcamera: framebuffer: Add FrameMetadata::Status::FrameStartup
 - libcamera: Add ClockRecovery class to generate wallclock timestamps
 - libcamera: controls: Revert incorrect SPDX removal
 - libcamera: controls: Remove hyphenation in control description text
 - libcamera: controls: Use nanoseconds units for FrameWallClock
 - libcamera: delayed_controls: Inherit from Object class
 - libcamera: pipeline_handler: Move waitingRequests_ into camera class
 - libcamera: pipeline_handler: Allow to limit the number of queued requests
 - libcamera: base: bound_method: Move return value
 - libcamera: controls: Generate macro for each control
 - libcamera: camera: Fix up the AeEnable control during Camera::start()
 - libcamera: Put buffer back to V4L2BufferCache when VIDIOC_QBUF fails
 - libcamera: camera_manager: Log info message to report camera creation
 - libcamera: v4l2_videodevice: Add color space to format string representation
 - libcamera: Drop remaining file names from header comment blocks
 - libcamera: control_serializer: Accept empty `ControlList`
 - libcamera: camera: Do not call `generateConfiguration()` synchronously
 - libcamera: utils: Add scope_exit class
 - libcamera: v4l2_videodevice: Use scope_exit
 - libcamera: camera_sensor_properties: Add vd56g3 camera sensor
 - libcamera: base: bound_method: Forward arguments when possible
 - meson: Use libyaml wrap file from wrapdb
 - meson: Update subprojects .gitignore
 - pipeline: v4l2_subdevice: Add color space to format string representation
 - utils: gen-debug-controls: Remove line number from control description
 - utils: gen-debug-controls: Fix handling of controls that appear multiple times
 - utils: gen-debug-controls: Improve log output
 - utils: codegen: ipc: Check `ipc_` instead of `isolate_`
 - controls: Add FrameWallClock control
 - controls: Add camera synchronisation controls for Raspberry Pi
 - camera_sensor: Expand on computeTransform() documentation
 - subprojects: libpisp: Update to 1.2.1
 - V4L2VideoDevice: Call FrameBuffer::Private::cancel() in streamOff()
 - camera: Fix spell error
 - b4: Add .b4-config
 - package: Drop Gentoo ebuild

apps:
 - android: camera_device: Do not pass `nullptr` to `Request::addBuffer()`
 - apps: common: image: Fix assertion
 - apps: cam: Print enum string for camera properties
 - apps: lc-compliance: Replace manual include guard with pragma once
 - qcam: Silence false positive warnings with Qt 6.9.0 and newer
 - gstreamer: Document improvements when updating minimum GStreamer version
 - gstreamer: Factor out video pool creation
 - gstreamer: Reduce indentation in gst_libcamera_create_video_pool()
 - gstreamer: Rename variable in gst_libcamera_create_video_pool()
 - gstreamer: Fix leak of GstQuery and GstBufferPool in error path
 - gstreamer: Drop incorrect unref on caps
 - gstreamer: Replace NULL with nullptr
 - gstreamer: Fix libcamerasrc responding latency before setting caps
 - gstreamer: Use std::exchange() instead of g_steal_pointer()
 - gstreamer: Make format_map[] const
 - gstreamer: Fix reconfiguration condition check
 - gstreamer: Log and check adjusted camera configuration
 - gstreamer: Enable bayer formats with 10/12/14/16 bits
 - gstreamer: Split value_set_rectangle() GValue helper
 - gstreamer: Move existing GValue helpers to gstreamer-utils
 - gstreamer: Report camera properties as device properties

ipa:
 - ipa: rpi: Replace dropFrameCount in the IPA -> PH interface
 - ipa: rpi: Rename dropFrameCount_ to invalidCount_
 - ipa: rpi: Initialize enum controls with a list of values
 - ipa: rpi: Defer initialising AF LensPosition ControlInfo and value
 - ipa: rpi: controller: Improve findPeak() function in AF algorithm
 - ipa: rpi: controller: AutoFocus weighting tweak
 - ipa: rpi: controller: Autofocus CAF/PDAF stability tweak
 - ipa: rpi: controller: AutoFocus tweak earlyTerminationByPhase()
 - ipa: rpi: controller: Autofocus to use AWB statistics; re-trigger
 - ipa: rpi: controller: AutoFocus bidirectional scanning
 - ipa: rpi: Update IMX708 camera tuning files for AutoFocus changes
 - ipa: rpi: Fix bug in AfState reporting
 - ipa: rpi: agc: Change handling of colour gains less than 1
 - ipa: rpi: agc: Make the maximum digital gain configurable
 - ipa: rpi: agc: Rename "analogue gain" to "gain" where appropriate
 - ipa: rpi: Advance the delay context counter even when IPAs don't run
 - ipa: rpi: agc: Calculate digital gain in process()
 - ipa: rpi: Update digital gain handling in IPA base and derived classes
 - ipa: rpi: agc: Remove digital gain from AgcPrepareStatus
 - ipa: rpi: Fix static initialisation order bug in the Controller
 - ipa: rpi: Add vd56g3 support for rpi
 - ipa: rpi: Add vd56g3 tuning files for rpi
 - ipa: rkisp1: Move Sharpness control creation to Filter algorithm
 - ipa: rkisp1: agc: Implement ExposureValue control
 - libipa: pwl: Improve documentation
 - libipa: pwl: Fix single point Pwl
 - libipa: agc_mean_luminance: Add debug logging
 - libipa: agc_mean_luminance: Add exposure compensation support
 - libcamera: libipa: Add vd56g3 support for libipa

pipeline:
 - pipeline: ipa: rpi: Split RPiCameraData::dropFrameCount_
 - pipeline: rpi: Remove disable_startup_frame_drops config option
 - pipeline: rpi: Remove ispOutputCount_ and ispOutputTotal_
 - pipeline: rpi: Add wallclock timestamp support
 - pipeline: rpi: Fix for enumerating the media graphs
 - libcamera: pipeline: rpi: Do not set timestamps to 0 if unavailable
 - libcamera: pipeline: rpi: Do not clear request metadata anymore
 - pipeline: imx8-isi: Cosmetic changes
 - pipeline: imx8-isi: Fix match returned value in error case
 - pipeline: imx8-isi: Dynamically compute crossbar subdevice's first source.
 - pipeline: imx8-isi: Add constexpr for maximum pipeline and resize if needed
 - pipeline: imx8-isi: Add multicamera support
 - libcamera: pipeline: uvcvideo: Silently ignore `AeEnable`
 - libcamera: pipeline: uvcvideo: Handle controls during startup
 - pipeline: rkisp1: Limit the maximum number of buffers queued in
 - pipeline: rkisp1: Properly handle the bufferCount set in the stream configuration
 - libcamera: pipeline: rkisp1: Don't rely on bufferCount
 - libcamera: software_isp: Remove type casts in statistics computation
 - pipeline: simple: Fix matching with empty media graphs
 - libcamera: mali-c55: Set bytesused appropriately
 - libcamera: mali-c55: Correct expected entity function

test:
 - libcamera: test: Add a failing test for the log level parser
 - test: libtest: CameraTest: Set env var before CameraManager
 - test: ipa: Add basic Pwl test
 - test: ipa: Add failing test for single point Pwl

documentation:
 - Documentation: Make `doxygen-internal` depend on public inputs
 - Documentation: application: Update mediactl URL
 - Documentation: Remove unneeded options from Sphinx configuration
 - Documentation: Drop documentation author names
 - Documentation: Use Sphinx doxylink to generate links to doxygen
 - Documentation: Replace links to Doxygen documentation with doxylink

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-07 14:46:17 +01:00
Barnabás Pőcze
9c86a405b7 libcamera: base: bound_method: Forward arguments when possible
Use `std::{forward,move}` to forward the arguments, this enables the
use of move constructors, likely leading to less code and better runtime.
For example, move constructing a libstdc++ `std::shared_ptr` is noticeably
less code than copy constructing one.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-07 09:56:32 +02:00
Umang Jain
053fedb5ed gstreamer: Report camera properties as device properties
Iterate over all libcamera camera properties and report them as
device properties. Each libcamera ControlType is mapped to the
corresponding gstreamer GType. If the ControlValue is an array of
values (ControlValue::isArray()), GValue with type GST_TYPE_ARRAY
is used to set the value of that ControlValue with the corresponding
GType.

Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-06 19:04:44 +01:00
Umang Jain
0794edcae6 gstreamer: Move existing GValue helpers to gstreamer-utils
Move the existing GValue helpers from gstlibcamera-controls.cpp.in
to gstreamer-utils.cpp. The intention here is to make these helpers
available to other parts of gstreamer source element, for example,
reporting camera properties in GstDeviceProvider.

The function signature has been changed to match with the other
gstreamer-utils utility functions:

value_get_rectangle() =>  gst_libcamera_gvalue_get_rectangle()
value_set_rectangle() =>  gst_libcamera_gvalue_set_rectangle()
value_set_point()     =>  gst_libcamera_gvalue_set_point()
value_set_size()      =>  gst_libcamera_gvalue_set_size()

Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-06 19:04:44 +01:00
Umang Jain
f96c4df423 gstreamer: Split value_set_rectangle() GValue helper
Split the value_set_rectangle() GValue helper into further
helpers pertaining to libcamera::Point and libcamera::Size.
This would help to cover additional cases where helpers
are needed for Point and Size individually (in subsequent commits).

The libcamera::Rectangle's GValue helper can be easily
constructed with the new Point and Size helpers. Hence,
this patch does not introduce any functional changes.

Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-06 19:04:44 +01:00
Benjamin Mugnier
409d1b29da libcamera: libipa: Add vd56g3 support for libipa
Values are sourced initially from the vd56g3 user manual.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.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-08-06 17:49:24 +01:00
Benjamin Mugnier
0c4b789195 ipa: rpi: Add vd56g3 tuning files for rpi
For both vc4 and pisp, vd56g3.json has been generated using ctt with
rpi.dpc algorithm removed as this is already handled in the sensor's
ISP. vd56g3_mono.json has been adapted from vd56g3.json by removing
color correction related algorithms.

Adding Cyril Liotard and Jean Poire as co-developers for providing the
base vd56g3.json tuning files for vc4 and pisp respectively. Thank you.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Co-developed-by: Cyril Liotard <cyril.liotard@st.com>
Signed-off-by: Cyril Liotard <cyril.liotard@st.com>
Co-developed-by: Jean Poire <jean.poire@st.com>
Signed-off-by: Jean Poire <jean.poire@st.com>
Reviewed-by: Naushir Patuck <naush@rasbperrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-06 17:49:19 +01:00
Benjamin Mugnier
c64bf58baa ipa: rpi: Add vd56g3 support for rpi
The cam_helper gain formula and frameIntegrationDiff can be found in the
vd56g3 user manual.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Naushir Patuck <naush@rasbperrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-06 17:48:12 +01:00
Benjamin Mugnier
6f1af6f578 libcamera: camera_sensor_properties: Add vd56g3 camera sensor
Add unit cell size from the 'pixel size' element in the datasheet.
Delays are set to 2 in case a setting is entered at the very end of the
N frame, the N+1 frame will miss it and only the N+2 frame will use this
new setting.

Note that vd56g3 has a diagonal color test pattern, but does not match
any description in specified test patterns and therefore is ignored.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-06 17:48:12 +01:00
Laurent Pinchart
4e567d1981 libcamera: v4l2_videodevice: Use scope_exit
The V4L2VideoDevice::queueBuffer() function performs the same cleanup
action in many error paths. Use scope_exit to simplify it.

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>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-06 15:11:32 +01:00
Laurent Pinchart
6ef2d79a73 libcamera: utils: Add scope_exit class
The scope_exit class is an implementation of the identically named C++
library fundamentals TS v3 class, as documented in [1]. It is a simpler
version of the libcamera-specific ScopeExitActions class and doesn't
require dynamic heap memory allocation, making it more suitable for hot
paths.

The class is not documented as it implements a C++ standard (even if
experimental) API.

[1] https://en.cppreference.com/w/cpp/experimental/scope_exit/scope_exit.html

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-06 15:11:32 +01:00
Barnabás Pőcze
b37e69d434 libcamera: process: Remove ProcessManager singleton
The `ProcessManager` is a singleton class to handle `SIGCHLD` signals
and report the exit status to the particular `Process` instance.

However, having a singleton in a library is not favourable and it is
even less favourable if it installs a signal handler.

Using pidfd it is possible to avoid the need for the signal handler;
and the `Process` objects can watch their pidfd themselves, eliminating
the need for the `ProcessManager` class altogether.

`P_PIDFD` for `waitid()` was introduced in Linux 5.4, so this change
raises the minimum supported kernel version. `clone3()`, `CLONE_PIDFD`,
`pidfd_send_signal()` were all introduced earlier.

Furthermore, the call to the `unshare()` system call can be removed
as those options can be passed to `clone3()` directly.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-08-05 09:28:47 +02:00
Barnabás Pőcze
4db96b6e66 libcamera: process: Use close_range() when available
Use the `close_range()` system call when available as it is simpler
and faster than iterating `/proc/self/fd/`.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-05 09:28:47 +02:00
Barnabás Pőcze
d44ec357d2 libcamera: process: Move closeAllFdsExcept()
Remove `closeAllFdsExcept()` from the `Process` class and have it as a
local function since it is not needed "outside" and does not depend on
any part of the `Process` class.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-05 09:28:47 +02:00
Barnabás Pőcze
b43691af94 libcamera: process: closeAllFdsExcept(): Take vector by value
Instead of creating a new vector, take the vector by value to make it
possible for the caller to use move construction when calling the function.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-08-05 09:28:47 +02:00
Barnabás Pőcze
7a42f3c3d8 libcamera: process: start(): Use span instead of vector
Use a span instead of a const reference to a vector, this does not
change the behaviour and allows e.g. arrays to be used to hold
arguments/file descriptors.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-07-31 11:42:35 +02:00
Barnabás Pőcze
5de79e93f0 libcamera: process: Use pid_ member to decide if running
Instead of using a separate member variable, use `pid_ > 0` to determine
if the process is still running. Previously the value of `pid_` was not
reset to -1 when the process terminated, but since it is only meaningful
while the process is running, reset it to -1 in `Process::died()`.

Neither `pid_` nor `running_` are exposed, so this change has no effect
on the public interface or observable behaviour.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-07-31 11:42:35 +02:00
Barnabás Pőcze
b0db9388f6 libcamera: base: log: Take LogCategory by reference
When no log category is specified, `nullptr` is passed, and
then the `_log()` function implementations replace that with
`LogCategory::defaultCategory()`. But since the call site always
knows the log category, this condition can be removed and the
`_LOG1()` macro can use `LogCategory::defaultCategory()`.

So remove the condition from the `_log()` implementations and
use references to refer to log categories.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-07-31 11:39:13 +02:00
Jaslo Ziska
096b9416b2 gstreamer: Enable bayer formats with 10/12/14/16 bits
GStreamer supports 10/12/14/16-bit bayer formats since version 1.24.

Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-07-31 00:04:04 +03:00
Jaslo Ziska
84c0b9dd0a gstreamer: Log and check adjusted camera configuration
As CameraConfiguration::validate() might alter the configuration
previously negotiated with downstream, log an info when this happens as
GStreamer source elements are not supposed to do that.

Also check if downstream can accept this new stream configuration and if
not, return a not-negotiated error.

Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <uajain@igalia.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-07-31 00:04:04 +03:00
Jaslo Ziska
36bec972d3 gstreamer: Fix reconfiguration condition check
gst_pad_peer_query_accept_caps() might only check if the caps are
acceptable with the peer element, but not recursively with all
downstream elements. If the reconfigure flag was set because the
pipeline downstream changed, gst_pad_peer_query_accept_caps() might still
return true, even though downstream can't handle the current caps, which
causes a not-negotiated error.

This commit fixes this issue by emitting a query event which
recursively checks with all downstream elements. Because at this point
we are only interested in whether the current caps are still acceptable,
use the currently used caps as a filter and then check if the query
returned empty caps.

Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-07-31 00:04:03 +03:00
Laurent Pinchart
56748884b6 Documentation: Replace links to Doxygen documentation with doxylink
Use the Sphinx doxylink extension to generate links to the
Doxygen-generated documentation automatically. Not only does this fix
currently broken links, but it also ensures that any removal or rename
of a class or function referenced to from the Sphinx documentation
without a corresponding documentation update will be caught by a
documentation build error.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Stefan Klug <stefan.klug@ideasonboard.com>
2025-07-30 18:54:30 +03:00
Laurent Pinchart
0382d215db Documentation: Use Sphinx doxylink to generate links to doxygen
The libcamera Sphinx documentation needs to link to the API
documentation generated by Doxygen. The links currently point to the
documentation hosted on the official https://libcamera.org/ website.
This causes multiple issues:

- Doxygen generates URLs with MD5 hashes of function signatures, making
  the link targets unstable.

- When testing documentation builds that include API changes, links to
  new API elements will be broken.

- The generated documentation can't be browsed offline.

Fix this by using the Sphinx doxylink extension. This allows specifying
link targets as class and function names, with the link being
automatically generated using the same MD5 hashing as Doxygen. The root
of the link target is configured in a central location, which defaults
to the build directory and can be overridden to point to the libcamera
website when pushing the documentation.

This commit only introduces the infrastructure to use doxylink. Manual
links will be replaced separately.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2025-07-30 18:54:26 +03:00
Laurent Pinchart
50cca05e88 Documentation: Drop documentation author names
The name of the documentation authors listed in conf.py is seriously out
of date. As the information is bound to bitrot, replace the names by a
generic mention of the libcamera documentation authors.

While at it, update the copyright dates.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2025-07-30 18:54:24 +03:00
Laurent Pinchart
41592b8670 Documentation: Remove unneeded options from Sphinx configuration
libcamera only generates HTML documentation. Drop the unused
configuration options for other output formats, as well as unneeded
entries in the exclude patterns.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2025-07-30 18:54:19 +03:00
Kieran Bingham
7aa68c7882 Documentation: application: Update mediactl URL
The linux kernel documentation for the Media Controller has moved.
Update the URL accordingly to the new location.

The existing link pointed to the 'introduction' page - but this isn't
easy to identify or get an overview of the full documentation available
for media controller. Instead point the link to the top level of the
media controller userspace API pages.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-07-30 18:54:17 +03:00
Laurent Pinchart
2d5a1367e2 meson: Update subprojects .gitignore
Commit a29c53f6a6 ("meson: Use libyaml wrap file from wrapdb")
modified the libyaml wrap in a way that resulted in the subproject
source code being stored in a different subdirectory, but didn't update
.gitignore accordingly. Fix it.

Fixes: a29c53f6a6 ("meson: Use libyaml wrap file from wrapdb")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2025-07-29 19:09:16 +03:00
Barnabás Pőcze
4a469b302c libcamera: camera: Do not call generateConfiguration() synchronously
Most pipeline handler methods are dispatched in the internal `CameraManager`
thread. `PipelineHandler::generateConfiguration()` is called directly,
however, which likely goes against the expectations, so call it on the
internal thread.

Before 14618cdd0c ("libcamera: base: bound_method: Move return value")
this could not be done because the function returns `std::unique_ptr`, and
that type cannot be copied.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=273
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-07-28 12:35:18 +02:00
Barnabás Pőcze
bd10ec4605 utils: codegen: ipc: Check ipc_ instead of isolate_
Only try to send the "Exit" message if the `IPCPipeUnixSocket` object
exists. If the constructor fails, then `ipc_` might remain nullptr,
which would lead to a nullptr dereference in the destructor.

This change also modifies the constructor so that only a valid
`IPCPipeUnixSocket` object will be saved into the `ipc_` member,
which avoids error messages when `IPCPipeUnixSocket::sendAsync()`
is callded in the inappropriate state.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=276
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-07-28 11:49:39 +02:00
Barnabás Pőcze
e0fcbea494 libcamera: control_serializer: Accept empty ControlList
Accept empty `ControlList`s without an info map. Serialization
supports `ControlList`s without an associated `ControlInfoMap`
object. However, for deserialization, a "v4l2" control list
without an info map resulted in a fatal error.

After 30114cadd8 ("ipa: rpi: Defer initialising AF LensPosition ControlInfo and value")
the `lensControls` member of `ipa::RPi::ConfigResult` is left empty
and without an info map in every case, not just when a lens is not present.
This causes the above assertion to trigger every single time.

Also fix the indefinite article of "a ControlInfoMap" in the
error message.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@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>
2025-07-28 11:34:37 +02:00
Laurent Pinchart
16da4892ed package: Drop Gentoo ebuild
libcamera includes packaging information for Gentoo Linux. This is due
to historical reasons, the ebuild is not testing or maintained, and we
don't plan to add packaging information for other major distributions
such as Debian or Fedora. Drop the Gentoo ebuild.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2025-07-25 15:28:00 +03:00
Umang Jain
8769279a64 gstreamer: Make format_map[] const
format_map[] is the mapping between GstVideoFormat and libcamera's
PixelFormat. Make it const as it is not meant to be changed.

Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-07-25 15:24:43 +03:00
Laurent Pinchart
76be047f74 apps: lc-compliance: Replace manual include guard with pragma once
libcamera uses #pragma once for include guards. One manual guard crept
in lc-compliance, replace it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2025-07-25 14:50:35 +03:00
Laurent Pinchart
cdc523225c libcamera: Drop remaining file names from header comment blocks
Header comment blocks used to contain the file name. Considered as
useless information, the names have been removed, with the last ones
supposed to be dropped in commit d3bf27180e ("libcamera: Drop
remaining file names from header comment blocks"). A few have however
been forgotten, and more crept back since. Remove them.

While at it, fix one typo in a header comment block by replacing
'MaliC55 with Mali-C55', and add a missing blank line in
src/ipa/rpi/pisp/pisp.cpp.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2025-07-24 21:04:09 +03:00
Laurent Pinchart
b43520d70e libcamera: v4l2_videodevice: Add color space to format string representation
To debug color issues in a pipeline it is necessary to know the color
space used. Therefore add the color space to the string representation
of V4L2DeviceFormat that is returned by toString() and operator<<(). The
format gets for example printed as

[0:05:52.981684000] [230] DEBUG RkISP1 rkisp1_path.cpp:468 Configured main resizer video device with 1920x1080-NV12/sYCC

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-07-24 12:12:48 +03:00
Laurent Pinchart
2e8de41413 qcam: Silence false positive warnings with Qt 6.9.0 and newer
In Qt 6.9.0 the qtmochelpers.h header introduced a construct that gcc 12
and gcc 13 incorrectly flag as variable shadowing:

In file included from src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:12:
/usr/include/qt6/QtCore/qtmochelpers.h: In instantiation of ‘constexpr void QtMocHelpers::detail::UintDataStorage<std::integer_sequence<int, Idx ...>, T ...>::forEach(F&&) const [with F = QtMocHelpers::UintData<QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)> >::copyTo<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t, QtMocHelpers::MetaObjectContents<24, 10, 60, 3> >(QtMocHelpers::MetaObjectContents<24, 10, 60, 3>&, size_t, uint&) const::<lambda(const auto:39&)>; int ...Idx = {0}; T = {QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)>}]’:
/usr/include/qt6/QtCore/qtmochelpers.h:255:21:   required from ‘constexpr const QtMocHelpers::MetaObjectContents<24, 10, 60, 3> ViewFinderGL::qt_staticMetaObjectContent<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t>’
src/apps/qcam/qcam.p/../../../../../../src/apps/qcam/viewfinder_gl.h:32:2:   required from ‘constexpr const auto ViewFinderGL::qt_staticMetaObjectStaticContent<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t>’
src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:63:5:   required from here
src/apps/qcam/qcam.p/../../../../../../src/apps/qcam/viewfinder_gl.h:32:2:   in ‘constexpr’ expansion of ‘ViewFinderGL::qt_create_metaobjectdata<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t>()’
src/apps/qcam/qcam.p/moc_viewfinder_gl.cpp:58:87:   in ‘constexpr’ expansion of ‘QtMocHelpers::metaObjectData<ViewFinderGL, {anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t, StringRefStorage<char [13], char [15], char [1], char [24], char [7]>, UintData<SignalData<void(libcamera::FrameBuffer*)> >, UintData<>, UintData<> >(0, qt_stringData, qt_methods, qt_properties, qt_enums, QtMocHelpers::UintData<>(), const QtMocHelpers::detail::UintDataBlock<0, 0>{uint [1](), uint [1]()})’
/usr/include/qt6/QtCore/qtmochelpers.h:563:36:   in ‘constexpr’ expansion of ‘(& methods)->QtMocHelpers::UintData<QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)> >::copyTo<{anonymous}::qt_meta_tag_ZN12ViewFinderGLE_t, QtMocHelpers::MetaObjectContents<24, 10, 60, 3> >(result, ((size_t)dataoffset), metatypeoffset)’
/usr/include/qt6/QtCore/qtmochelpers.h:201:57: error: declaration of ‘entry’ shadows a member of ‘QtMocHelpers::detail::UintDataStorage<std::integer_sequence<int, 0>, QtMocHelpers::SignalData<void(libcamera::FrameBuffer*)> >’ [-Werror=shadow]
  201 |         [[maybe_unused]] auto invoke = [&f](const auto &entry) { f(entry.entry); return 0; };
      |                                             ~~~~~~~~~~~~^~~~~
/usr/include/qt6/QtCore/qtmochelpers.h:180:7: note: shadowed declaration is here
  180 |     T entry;
      |       ^~~~~

There is little we can do but silence the warning. Do so selectively
based on the Qt and gcc versions, to still detect variable shadowing
with compilers unaffected by the issue.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2025-07-24 12:12:30 +03:00
Laurent Pinchart
b65df7e755 libcamera: camera_manager: Log info message to report camera creation
Camera creation is one of the most important events generated by
libcamera, but we are completely silent about it. The lack of a log
message makes it more difficult to identify problems and provide
support. Fix it by adding an Info message that reports the camera id and
its pipeline handler when the camera is added.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-07-22 11:41:57 +01:00
Paul Elder
6928522db6 pipeline: simple: Fix matching with empty media graphs
The match() function currently reports that it is not possible to create
any cameras if it encounters an empty media graph.

Fix this by looping over all media graphs and only returning false when
all of them fail to create a camera.

It is worth noting that an issue does exist when on a partial match that
ends in an invalid match, any media devices that were acquired will stay
acquired. This is not a new issue though, as any acquired media devices
in general are not released until pipeline handler deconstruction. This
requires a rework of how we do matching and pipeline handler
construction, so it is captured in a comment.

In the meantime, this fix fixes a problem without increasing the net
number of problems.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Hui Fang <hui.fang@nxp.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-07-22 11:17:33 +01:00
Han-Lin Chen
835c1bf35e libcamera: Put buffer back to V4L2BufferCache when VIDIOC_QBUF fails
The patch puts buffer back to V4L2BufferCache when VIDIOC_QBUF fails
in V4L2VideoDevice. This is to avoid cache leaks and causing assert.

Fixes: cadae67e45 ("libcamera: v4l2_videodevice: Add FrameBuffer interface")
Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Co-developed-by: Harvey Yang <chenghaoyang@chromium.org>
Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-07-22 11:09:41 +01:00
David Plowman
1d65c02e71 libcamera: camera: Fix up the AeEnable control during Camera::start()
In Camera::queueRequest() the control list is updated transparently by
converting AeEnable into ExposureTimeMode and AnalogueGainMode
controls.

However, this was not happening during Camera::start(), meaning that
setting AeEnable there was having no effect. It should behave the same
here too.

Fixes: 7abd413905 ("libcamera: camera: Pre-process AeEnable control")
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-07-21 20:05:23 +01:00
Naushir Patuck
486e042669 ipa: rpi: Fix static initialisation order bug in the Controller
There is a possible static initialisation issue with accessing the
HardwareConfigMap static object through Controller::getHardwareConfig().
Fix this by providing a static function hardwareConfigMap() to access
the object.

Though not proven, this is possibly the cause of a very infrequent
lockup in https://github.com/raspberrypi/rpicam-apps/issues/799.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-07-21 17:00:11 +01:00
Umang Jain
c7c40ed1a3 apps: cam: Print enum string for camera properties
Some camera properties might be set as a enumeration for e.g.
properties::Location. Instead of printing the int32_t values
for the enumeration, print the enum string as well. This will
enhance the readability for the user.

Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-07-21 16:45:37 +01:00
Antoine Bouyer
92df79112f pipeline: imx8-isi: Add multicamera support
ISI can be used to support multiple cameras at the same time in the media
device. A dedicated pad is assigned to each camera by HW (dts). We then
assign one (or more) source pad(s) depending on ISI constraints in the SoC.

Since ISI may have different number of pipes depending on SoC, the number
of cameras is computed _before_ going through all pipeline's components,
to limit number of pipes that could be assigned to a camera.

For instance, 3 is targeted as maximum amount of streams per camera as
defined by 'kNumStreams' constant. If 2 cameras are connected, with
only 5 ISI pipes, this target cannot be achieved. In such case, 2 streams
are assigned to each camera.

On the other hand, if ISI has 8 source pads (from index 6 to 13) and 2
cameras, first three source pads [6:8] are assigned to first camera, and
the three next source pads [9:11] are assigned to the second camera. All
these pads (sink and sources) must have same format to prevent configuration
mismatch during start.

However, since ISI routing must be performed _before_ any stream becomes
active, 'setRouting' is now executed during the 'match' step, instead of
'configure'. Indeed, it is up to the application to decide when a camera
'start' is executed: this could happen before or after the other camera
configuration is executed. Moving routing into the 'match' step makes sure
the routing is correctly applied before any 'start' is executed.

Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-07-21 12:41:57 +01:00
Antoine Bouyer
f3e8b7e538 pipeline: imx8-isi: Add constexpr for maximum pipeline and resize if needed
This patch adds number of streams per camera as constructor parameter, and
limits stream count to 3. Some applications may need up to 3 streams for
preview + capture + video record. Currently, imx8-isi pipeline only supports
up to 2. Increase constant parameter to 3 to match these applications'
requirements.

Minimum value between default value 3, and total amount of ISI's pipes is
now applied. For SOCs which only have 1 ISI pipe (ie i.MX93), available
stream count becomes 1.

Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-07-21 12:41:57 +01:00