Commit Graph

4567 Commits

Author SHA1 Message Date
Matthias Fend
e8304bc6c1 libcamera: libipa: camera_sensor: Add Himax HM1246 sensor properties
Provide the Himax HM1246 camera sensor properties and registration with
libipa for the gain code helpers.

Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-18 16:31:28 +01:00
Benjamin Mugnier
481c659c7e libcamera: libipa: Add vd55g1 support for libipa
Values are sourced initially from the vd55g1 user manual.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-18 12:50:02 +01:00
Benjamin Mugnier
59db8f9863 ipa: rpi: Add vd55g1 tuning files for rpi
For both vc4 and pisp, vd55g1.json has been generated using ctt with
rpi.dpc algorithm removed as this is already handled in the sensor's
ISP. vd55g1_mono.json has been adapted from vd55g1.json by removing
color correction related algorithms.

Adding Cyril Liotard as co-developer for providing the base vd55g1.json
tuning files for both vc4 and pisp. Thank you.

Co-Developed-by: Cyril Liotard <cyril.liotard@st.com>
Signed-off-by: Cyril Liotard <cyril.liotard@st.com>
Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Acked-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-18 12:50:02 +01:00
Benjamin Mugnier
5e038387f1 ipa: rpi: Add vd55g1 support for rpi
The cam_helper gain formula and frameIntegrationDiff can be found in the
vd55g1 user manual.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Acked-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-18 12:50:02 +01:00
Benjamin Mugnier
57ca25b61e libcamera: camera_sensor_properties: Add vd55g1 camera sensor
Add unit cell size from the 'pixel size' element in the datasheet.
Controls are buffered within the sensor and are always applied at frame
N+2.

Signed-off-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-18 12:50:02 +01:00
Barnabás Pőcze
0e096da4b4 libcamera: request: addBuffer(): Do not destroy fence on failure
Take the unique pointer to the `Fence` object by rvalue reference
so that it is not destroyed if the function returns an error code
and does not take ownership of the unique pointer.

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-09-16 17:48:46 +02:00
Stefan Klug
49439d6de5 pycamera: Fix FrameBuffer::planes wrapper
In commit b8d332cdcc ("libcamera: framebuffer: Replace vector with
span in constructor") the FrameBuffer::planes() function was modified to
return a Span instead of a vector. This leads to the following runtime
exception in the python binding:

TypeError: Unregistered type : libcamera::Span<libcamera::FrameBuffer::Plane const, 18446744073709551615ul>

Fix that by manually converting the Span to a vector.

Note: The best solution would be to implement a Span type caster for
pybind11. But implementing and testing that properly is a bit more
involved than expected. As we don't need bidirectional mapping, use the
same workaround as for FrameMetadata::planes() for now.

While at it, update the lambda for pyFrameMetadata.planes() to call the
inner planes() only once.

Fixes: b8d332cdcc ("libcamera: framebuffer: Replace vector with span in constructor")
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>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2025-09-16 16:37:42 +02:00
Laurent Pinchart
b8d332cdcc libcamera: framebuffer: Replace vector with span in constructor
The FrameBuffer constructor takes a list of planes as an std::vector.
The caller may stores the planes in a different type of container,
resulting in the needless allocation of a temporary vector. Replace it
with a span.

Suggested-by: Daniel Rákos <daniel.rakos@rastergrid.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2025-09-08 20:40:18 +02:00
Laurent Pinchart
5e351b89f0 pipelines: Use lambda functions to factor out buffer mapping code
Multiple pipeline handlers duplicate code related to mapping params and
stats buffers to IPA modules. Factor out the code to lambda functions to
share it between the two buffer types.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-08 20:40:18 +02:00
Milan Zamazal
baea40a8a5 apps: cam: Support PPM output for other RGB formats
GPU ISP can produce only 32-bit output.  Let's add support to the PPM
writer for all the common RGB image formats so that we can store GPU ISP
output as PPM files.  Contingent alpha values are ignored as there is no
support for the alpha channel in PPM.

There is no obvious performance penalty in my environment compared to
output in the raw format.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-04 12:13:00 +01:00
Paul Elder
6554b62642 utils: Add unary negation operation to Duration
In the near future we will add a SyncAdjustment control for adjusting
the frame duration via the sync algorithm. This control needs to be able
to take on a negative value, since the frame duration can be shortened
in addition to being extended. While the control is an int, it would be
convenient to be able to clamp it to frame duration limits, which are
usually handled as utils::Duration values internally. To allow this
using utils::Duration, add a unary negation operation to
utils::Duration. Also add a test for the operator.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-01 12:43:43 +01:00
Paul Elder
278cdfd865 libcamera: clock_recovery: Use nanoseconds in addSample()
FrameWallClock was recently changed to nanoseconds, and all users of
ClockRecovery use SensorTimestamp directly, which is also in
nanoseconds. Thus addSample() should also use nanoseconds. Fix this.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-01 12:43:42 +01:00
David Plowman
3f509744ab ipa: rpi: ccm: Implement "manual" CCM mode
The CCM algorithm will now let an explicit colour matrix be set when
AWB is in manual mode.

We must handle any controls that can cause the AWB to be enabled or
disabled first, so that we know the AWB's state correctly when we come
to set the CCM.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
[Kieran: Remove duplicated Matrix3x3 from ccm.cpp]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-01 09:27:59 +01:00
Barnabás Pőcze
16cbc826b7 apps: qcam: Do nothing if no camera is selected
If the currently selected camera disappears as reported by the `cameraRemoved`
signal, then `MainWindow::camera_` is reset to `nullptr`. In this case,
pressing the start/stop button will try to start streaming, leading to
a nullptr derefence in `MainWindow::startCapture()` when the configuration
is generated for the camera.

Fix that by returning from `MainWindow::toggleCapture()` if no camera is set.
While this will cause the "checked" status of `startStopAction_` to go out of
sync, this should not be an issue because when a new camera is selected, the
state is synchronized.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=177
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-01 09:12:54 +01:00
Hans de Goede
473e2dc893 pipeline: simple: Enable simple pipelinehandler with SoftISP on Intel IPU7
Enable the simple pipelinehandler with SoftISP on Intel IPU7 machines.

This has been successfully tested with the IPU7 CSI2 receiver driver in
drivers/media/staging in kernel version 6.17-rc# on a Lenovo ThinkPad X1
Carbon Gen 13 (Lunar Lake, ov08x40 sensor).

On this specific laptop a couple of kernel patches which are pending
upstream are necessary on top of 6.17-rc#:

https://lore.kernel.org/linux-usb/20250809102326.6032-1-hansg@kernel.org/
https://lore.kernel.org/linux-acpi/20250829142748.21089-1-hansg@kernel.org/

Tested-by: Hans de Goede <hansg@kernel.org> # Lenovo ThinkPad Carbon X1 Gen 13
Signed-off-by: Hans de Goede <hansg@kernel.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-01 09:12:19 +01:00
Naushir Patuck
076c965706 libcamera: sensor: imx462: Add sensor delays to CameraSensorProperties
The sensor delays for IMX462 were missing from the CameraSensorProperties
table. They are identical to the IMX290, so copy those values.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-01 09:12:06 +01:00
Naushir Patuck
e511a57c27 ipa: rpi: imx462: Add official RPi tuning for IMX462
This sensor has now been fully tuned for the Innomaker IMX462 module.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-09-01 09:12:06 +01:00
David Plowman
ad891914c6 ipa: rpi: sdn: Remove legacy denoise warning
We use the legacy format for the VC4 platform, and are not planning to
change this. So remove the warning.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-29 23:16:31 +01:00
David Plowman
115748428e ipa: rpi: vc4: Minor tuning changes
Sharpening is reduced slightly for official Raspberry Pi cameras, and
exposure profiles made a bit more consistent.

Denoise is reduced for the imx708 where it appears too strong.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-29 23:16:31 +01:00
David Plowman
7911270353 ipa: rpi: pisp: data: Update all non-official camera tuning files
Apply the same updates to the non-official cameras as to the official
ones.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-29 23:16:31 +01:00
David Plowman
ecbe4b1af3 ipa: rpi: pisp: data: Improve noise and detail tuning
Noise and detail tuning is improved for all official Raspberry Pi
cameras.

The old tunings left too much noise in and even sharpened some of
it. The new tunings remove more noise, and no longer sharpen it. Some
of the more general over-sharpening is also removed. Note that lost
detail can be recovered well using TDN (temporal denoise), which is
the recommended method to get the best results.

There are some minor adjustments to the CDN deviation, now that this
gets backed-off as TDN ramps up.

The contrast in the gamma in the bright areas is also toned down just
a little.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-29 23:16:31 +01:00
David Plowman
524fb97084 ipa: rpi:: denoise: Implement TDN back-off for CDN deviation
The CDN (colour denoise) deviation gets gradually reduced frame by
frame as TDN (temporal denoise) comes in and has more effect. CDN is
more harmful to image detail than TDN, so ramping it down in favour of
TDN is beneficial.

The tuning file parameters are chosen so that existing tuning files
don't have to be updated and will carry on working "mostly like they
did" (apart from the new back-off).

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-29 22:56:49 +01:00
Kieran Bingham
db288a6ce4 ipa: rpi: Add Arducam B0569 IMX415 tuning files
Add an imx415 tuning file for both the VC4 and PiSP. This tuning file
has been created and supplied by Arducam to support the B0569 module.

Note that this conflicts with an already existing imx415.json and
as such is provided as imx415_b0459.json.

More work will be required to support module specific tuning file
parsing.

Acked-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-29 22:56:10 +01:00
Kieran Bingham
b4dce59978 ipa: rpi: Add Arducam B0568 IMX335 tuning files
Add an imx335 tuning file for both VC4 and PiSP. This tuning file
has been created and supplied by Arducam to support the B0568 module.

Acked-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-29 22:56:02 +01:00
Antoine Bouyer
a139cd3803 pipeline: imx8-isi: Fix crossbar's sink pad computation
In current implementation, the sink pad counter of the crossbar is not
incremented if the pad is not connected to any subdevice. This would lead
to incorrect routing and format configuration if CSI is not connected
to first sink pad.

To avoid such issue, every sink pads must be taken into account. Then if
CSI and sensor are present, current counter is used for routing at match(),
and stored in camera data to be reused during configure().

Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com>
Tested-by: Pavel Löbl <pavel@loebl.cz>
Tested-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-29 22:36:58 +01:00
Laurent Pinchart
d54e5537ca py: libcamera: Always use install path from meson python module
libcamera uses the meson python module to handle native compilation of
Python extension modules, and uses the shared_module() function when
cross-compiling due to an issue in the python module. The difference
between native and cross compilation also extends to the installation
path: native compilation lets the python module handle the paths, while
cross compilation constructs a path manually using a heuristic based on
the Python version and hardcoded components.

This manually-constructed installation path is problematic for cross
compilation for the same reason it caused issue when used for native
compilation: it is not guaranteed to be right, and it can't be
overridden by users.

Switch to obtaining the installation path from the meson python module
for cross-compilation as well. This also prepares for usage of
py.extension_module() once the file suffix issue will be fixed in meson.

On Debian 13, this change replaces the incorrect path
/usr/local/lib/python3.12/site-packages/libcamera with the still (but
differently) incorrect /usr/local/lib/python3/dist-packages/libcamera.
Future fixes in meson to address this issue will make the path correct
by default.

When the path calculated by the python module is not correct, it can now
be overridden by the user through the meson python.platlibdir
configuration variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2025-08-20 13:19:48 +03:00
Laurent Pinchart
a2b21d60c7 py: libcamera: Get dependency from meson python module unconditionally
libcamera uses the meson python module to handle native compilation of
Python extension modules.

When cross-compiling, the module uses the build machine suffix instead
of the host machine suffix in some enviroments (for instance naming the
shared object file _libcamera.cpython-313-x86_64-linux-gnu.so instead of
_libcamera.cpython-313-aarch64-linux-gnu.so when cross-compiling from
x86_64 to aarch64). This prevents using the python module in that case,
and libcamera uses the normal dependency() function to locate the Python
libraries, and the shared_module() function to build the module.

Not using the meson python module to get the Python dependency prevents
selecting a specific Python interpreter, the same way as it does for
native builds. While having multiple Python interpreter versions in a
cross-build environment is likely less common, different behaviours and
features between native and cross-compilation are still not optimal.

Improve this situation by getting the dependency from the python module
for cross-compilation as well. This also prepares for usage of
py.extension_module() once the file suffix issue will be fixed in meson.

The user will need to ensure that the Python interpreter for the build
machine matches the version of the interpreter in the cross-compilation
environment for the host machine. Otherwise, meson will fail to find the
Python dependency. Cross-compilation environment provided by Linux
distributions (such as Debian multi-arch support) should work out of the
box, but compiling libcamera manually against a cross-compilation
environment provided by Buildroot or Yocto may require manual
configuration.

When the interpreters versions do not match, meson needs to be pointed
to the build ùachine interpreter from the cross-compilation environment
using the cross file. For instance, assuming a 'br_host_dir' variable
pointing to the host directory from Buildroot, the cross file should
contain

[binaries]
python = br_host_dir / 'bin/python3'

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2025-08-20 13:19:40 +03:00
William Vinnicombe
91365356bd py: libcamera: Improve python binding installation
The existing meson.build file installs the bindings to a manually
constructed directory that is not included in the Python path in most
distributions. For instance, on a  Debian 12 system, the modules is
intalled in /usr/lib/x86_64-linux-gnu/python3.11/site-packages/, while
the Python interpreter looks for site packages in
/usr/lib/python3/dist-packages/.

It also always builds the bindings using the system Python, as it
searches for the Python library using the standard dependency()
function. This prevents build the Python bindings for a different
interpreter version without changing the system default interpreter.

Modify the build process to use the meson python module to build the
Python bindings targets, so it installs them to the correct directories
for Python. This also allows specifying a different target Python
interpreter through the '[binaries]' section of a meson native file.

The behaviour is not changed for cross-compilation, as the meson python
module has known issues in that case.

Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
Co-developed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2025-08-20 13:19:32 +03:00
Laurent Pinchart
6e68c391f8 apps: cam: drm: Drop unneeded local variable
The planes variable in the Device::createFrameBuffer() function is a
reference to buffer.planes() that is only used as a range initializer in
a range-based for loop. Use buffer.planes() directly and drop the
variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2025-08-19 18:46:20 +03:00
Laurent Pinchart
470fa978a8 pipeline: rpi: Use structured bindings in range-based for loop
Simplify a range-based for loop by replacing an iterator with structure
bindings. This makes the code easier to read.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2025-08-19 18:46:18 +03:00
Laurent Pinchart
34b9d31700 pipeline: rkisp1: Replace error handling gotos with utils::exit_scope
Use utils::exit_scope in PipelineHandlerRkISP1::allocateBuffers() to
avoid gotos for error handling.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2025-08-19 18:46:15 +03:00
Laurent Pinchart
6498d3a94f pipeline: ipu3: Drop unneeded forward declarations
Multiple classes are forward-declared in frames.h, without being used in
that header file. Drop the unneeded forward declarations.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2025-08-19 18:46:13 +03:00
Laurent Pinchart
83243a2f24 libcamera: v4l2_videodevice: Avoid repeated calls to FrameBuffer::planes()
The V4L2VideoDevice::dequeueBuffer() calls buffer->planes() multiple
times. Store the planes array in a local variable to make this more
efficient.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2025-08-19 18:46:09 +03:00
Laurent Pinchart
392e9044b1 meson: Use dependency('dl')
Support for locating libdl through dependency('dl') was broken before
meson v0.62.0. Now that we require a newer version, drop the hack and
use the dependency() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2025-08-19 18:00:01 +03:00
Barnabás Pőcze
aa4338eed5 apps: cam: Do not overwrite name when adding camera model
If `addModel` is true, then the previously set `name` will be overwritten.
This does not seem to be the intended behaviour, so fix it by using `+=`.

Before:

  Available cameras:
  1: 'imx219' (/base/soc@0/bus@30800000/i2c@30a30000/camera@10)

After:

  Available cameras:
  1: External camera 'imx219' (/base/soc@0/bus@30800000/i2c@30a30000/camera@10)

Fixes: aab49f903e ("cam: Do not assume Location is available")
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-19 12:02:25 +02:00
Barnabás Pőcze
7609719514 libcamera: base: semaphore: Do not unlock prematurely
In `Semaphore::release()`, unlocking the mutex before signalling the condition
variable can be problematic, especially with "temporary" objects such as the
ones `BoundMethodBase::activatePack()` uses to handle `ConnectionTypeBlocking`.

Specifically, `Semaphore::acquire()` might lock the mutex after `Semaphore::release()`
has unlocked it, but before it had the chance to notify the condition variable.
In that case `Semaphore::acquire()` can succeed, and execution may proceed to
destroy the `Semaphore` object while the other thread is in the process of
running `std::condition_variable::notify_all()`.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=225
Fixes: 66e7c5b774 ("libcamera: Add Semaphore 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-19 09:44:24 +02:00
Barnabás Pőcze
1bd66f54a6 libcamera: base: thread: eventDispatcher(): Not thread safe
The function is not actually thread safe contrary to its documentation.
Since it is currently not used in an unsafe context, simply remove the
mention of thread safety from the documentation.

The variable must still remain atomic because it is accessed internally
from different threads, e.g. `Thread::postMessage()`.

Also add an assertion to enforce this.

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-18 13:56:51 +02:00
Barnabás Pőcze
af43c2f945 apps: common: options: Avoid copying in range based for loop
The copy can trigger `-Wrange-loop-construct` and is not needed,
so use a reference to avoid it.

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-15 11:22:28 +02:00
Stefan Klug
452fbd2295 libcamera: ipa_proxy: Log configuration file path
It is often helpful to know which tuning file is used. Add a log
statement with INFO level for that.

As the core logic has multiple return paths, adding the log statement is
not straight forward. Extract finder logic into a ipaConfigurationFile()
function and call that with the name and optionally the fallbackName
from the configurationFile() function.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2025-08-13 18:12:08 +02:00
Barnabás Pőcze
caf00087ba libcamera: pipeline: Avoid unnecessary indirection in frame info map
There is no reason to allocate the frame info objects dynamically,
and then store raw pointers in the `std::map` in the rkisp1
and ipu3 pipeline handler.

Instead, store the objects directly in the map. This removes
the need for manually calling new/delete, simplifies the code,
and eliminates one memory allocation per frame.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-08-13 15:41:30 +02:00
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
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