Commit Graph

6138 Commits

Author SHA1 Message Date
Laurent Pinchart
f6f7bf0afa libcamera: Add missing SPDX headers
Multiple files in libcamera are missing SPDX headers. Add them with the
following licenses:

- CC-BY-SA-4.0 for documentation

- CC0-1.0 for build system, development tool configuration files and
  TODO lists, as we consider them non-copyrightable, and for example
  configuration files to facilitate their use

- BSD-2-Clause for a file copied from the Raspberry Pi tuning tool (and
  add the corresponding copyright information)

While at it, add a missing blank line to
src/libcamera/pipeline/virtual/README.md.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-20 01:27:21 +03:00
Laurent Pinchart
d268ecec00 utils: ipc: extract-docs: Work around reuse tool problem
The reuse tool fails to lint the extract-docs.py file because it
considers the 'SPDX-License-Identifier' string in a regex as a malformed
license identifier. Work around the issue by adding parentheses in the
regular expression, which doesn't affect the behaviour of the regex
matching but prevents the reuse tool from seeing the line.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-20 01:27:18 +03:00
Laurent Pinchart
05a4b531c2 reuse: Add missing files to REUSE.toml
The skipping.svg image and the Raspberry Pi 5 tuning files are missing.
Add them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-20 01:27:16 +03:00
Laurent Pinchart
3647ac93ee reuse: Drop unnecessary entry from REUSE.toml
The Documentation/camera-sensor-model.rst file contains an SPDX license
identifier. There's no need to list it in REUSE.toml. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-20 01:27:13 +03:00
Laurent Pinchart
09886912f8 reuse: Update file paths in REUSE.toml
Multiple files listed in REUSE.toml have moved within the repository
without any update to the REUSE.toml file. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-20 01:27:11 +03:00
Laurent Pinchart
3c445256bf reuse: Convert to REUSE.toml
Reuse dep5 support is deprecated. Convert to the recommended REUSE.toml.
The change was generated by `reuse convert-dep5`.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-20 01:27:09 +03:00
Laurent Pinchart
53b0f26599 subprojects: Add nlohmann_json to .gitignore
libcamera use the nlohmann_json wrap indirectly through libpisp. This
causes the nlohmann_json.wrap being copied to /subprojects at configure
time, and nlohmann_json being downloaded to /nlohmann_json-3.11.2. Add
an entryto .gitignore to cover both.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-20 01:27:06 +03:00
Laurent Pinchart
b225b2874f libcamera: software_isp: Move GPU TODO items to TODO.md
There's no need to store GPU-specific TODO items in a separate file,
that clutters the software_isp directory. Move them from gpuisp-todo.txt
to TODO.md.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-20 01:27:04 +03:00
Laurent Pinchart
56334ef5c6 libcamera: software_isp: Convert TODO list to markdown
To prepare for merging the two software ISP TODO lists (TODO and
gpuisp-todo.txt), convert the TODO file to markdown.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-20 01:26:59 +03:00
David Plowman
0eddf9dc01 gstreamer: Add sensor-config property
The sensor-config property may optionally be specified to give the
outputSize and bitDepth of the SensorConfiguration that is applied to
the camera configuration. For example, use

libcamerasrc sensor-config="sensor/config,width=2304,height=1296,depth=10"

to request the 10-bit 2304x1296 mode of a sensor.

All three parameters, width, height and bit depth, must be present, or
it will issue a warning and revert to automatic mode selection (as if
there were no sensor-config at all).

If a mode is requested that doesn't exist then camera configuration
will fail and the pipeline won't start.

As future-proofing, the SensorConfiguration's binning, increment and
analog-crop parameters may be specified, though libcamera currently
ignores them.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/300
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Tested-by: Fabien Danieau <fabien.danieau@pollen-robotics.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-17 09:25:19 +01:00
Kieran Bingham
8e5eedc851 cam: Add option to report libcamera version
The cam tool is our swiss army knife for interogating libcamera.

A frequently needed piece of information is to determine what version of
libcamera is installed or being run on a system.

This information is available in the debug logs of libcamera when a
CameraManager is instantiated. However without actually starting the
CameraManager this information is not presented.

Add an option to 'cam' to allow it to report the version.  Whilst this
is the version from the 'cam' command, it directly gets the version of
the libcamera library to which cam is linked.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-17 09:05:10 +01:00
Stefan Klug
2e8a518784 Documentation: Enable treeview generation for doxygen < 1.13.0
Between v2 and the now merged v3 of commit 42d914f20c ("Documentation:
Enable doxygen-awesome-css") the GENERATE_TREEVIEW = YES was dropped
because it defaults to YES according to the doxygen web documentation.
Unfortunately for doxygen < 1.13.0 the default was NO.  Fix the value to
YES so that doxygen-awesome-css works properly even with older versions
of doxygen.

Fixes: 42d914f20c ("Documentation: Enable doxygen-awesome-css")
Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-04-17 10:00:01 +02:00
Kieran Bingham
4b6c47bd66 libcamera: camera: Report the pipeline handler name
Add the Pipeline handler name to the Camera Properties when a camera is
constructed.

This helps support and identify how the camera is being managed
internally and what configuration has taken effect, especially as the
pipeline handler chosen can be impacted by both environment variables
and configuration files.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-03 16:16:20 +01:00
Kieran Bingham
71e188f58f libcamera: properties: Add a pipeline handler name property
Allow the camera properties to report what pipeline handler is managing
the camera device.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-03 16:16:04 +01:00
Kieran Bingham
33dc1f24d9 utils: Introduce libcamera-bug-report
Introduce a script which can be installed into the system to aide
reporting potential camera and media related issues.

The script shall capture system information and store it in a temporary
file - but it remains the users responsibilty to choose to share this
data, and no automatic bug submissions are anticipated.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-03 16:08:54 +01:00
Hans de Goede
5f770f748c libcamera: Make converter/softISP configure()'s outputCfgs argument really const
The intent of the outputCfgs argument to the configure() function of
converter classes and the softISP is to allow the passed in stream-configs
to not be changed.

But only the vector is const, the reference inside the vector are not
const, which allows modifying the stream-configs as can be seen inside
DebayerEGL::configure() which was using a non const reference outputCfg
helper variable.

Fix this by making the references inside the vector const.

Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.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>
2026-04-01 14:59:38 +01:00
Naushir Patuck
1500ef15d1 utils: raspberrypi: Add a README.md to the old RPi CTT directory
This points to the GitHub repo hosting the RPi CTT source code and the
python package on pypi.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Kieran: Apply cleanup and reformat lines]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-01 14:56:22 +01:00
Naushir Patuck
585c5c7a49 utils: raspberrypi: Remove Raspberry Pi CTT from the source tree
This commit removes the Raspberry Pi CTT from the libcamera source tree.
This change is introduced to help a number of RPi users who are not so
faimilar with git and cloing the libcamera tree to run the CTT. The
library is also modularised in python for our users to incorporate into
their own "tuning" applications if needed. Licensing for our CTT tool
remains the same.

The Raspberry Pi CTT now lives at the following repo:
https://github.com/raspberrypi/ctt

and a package is avilable on pypi to install:
https://pypi.org/project/rpi-ctt/

This commit also removes the delayedctrls_parse.py script that has long
since code rotted.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-01 14:56:22 +01:00
Barnabás Pőcze
f094bc8a52 meson: Guard softisp gpu acceleration with feature option: softisp-gpu
Previously it was not possible to disable gpu acceleration if every
dependency was discovered by meson. Fix that by adding a new option.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-04-01 15:31:37 +02:00
Barnabás Pőcze
b83794d7eb meson: Move egl related dependencies to software_isp subdir
This way the dependencies are only added if they are actually used.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-04-01 15:31:37 +02:00
Barnabás Pőcze
626f7407ba meson: Use dependency object when checking for headers
A dependency might very well have custom include directories,
so use it when checking for the header file.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Bryan O'Donoghue <bod.linux@nxsw.ie>
2026-04-01 15:31:37 +02:00
Barnabás Pőcze
7ce10469ab meson: Remove gles_headless_enabled
Use the `mesa_works` variable instead to simplify, the two variables
have the same value.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Bryan O'Donoghue <bod.linux@nxsw.ie>
2026-04-01 15:31:37 +02:00
Barnabás Pőcze
1ed958315e meson: Simplify condition
If `softisp_enabled` is false, then `subdir_done()` is called above.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-04-01 15:31:37 +02:00
Barnabás Pőcze
aefa5df821 meson: Add egl.cpp to sources alongside debayer_egl.cpp
There are no other users of `egl.cpp`, so simplify by adding it to the
sources array at the same time.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Bryan O'Donoghue <bod.linux@nxsw.ie>
2026-04-01 15:31:37 +02:00
Barnabás Pőcze
383fdb76ff meson: Drop unnecessary egl, gles feature defines
`HAVE_LIBEGL` and `HAVE_GLESV2` are not used, so drop them.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Bryan O'Donoghue <bod.linux@nxsw.ie>
2026-04-01 15:31:37 +02:00
Barnabás Pőcze
f9525c25fd meson: Add apps-output-dng option to control libtiff dependency
Previously it was not possible to disable the use of libtiff in the cam
and qcam applications if it was detected. Fix that by adding a meson
feature option.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-01 15:17:51 +02:00
Barnabás Pőcze
00017b3679 meson: Add options to control drm, sdl2, jpeg dependencies of cam
Previously it was not possible to control these dependencies, they were
always used if found. Furthermore, libjpeg was unnecessarily added as a
dependency even if sdl2 was not found. Fix that by introducing three
options to control the dependencies.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-04-01 14:50:49 +02:00
David Plowman
033bb2cce3 ipa: rpi: Fix gamma lookup table generation for PiSP platform
generateLut was failing to fill in the final slope value, meaning that
fully saturated pixels would full slightly short (the slope of the
final piecewise linear segment would default to zero).

The loop is slightly reorganised to fix the problem.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@rasbperrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-01 12:35:34 +01:00
Hans de Goede
3c08aaef14 Documentation/runtime_configuration: Add missing software_isp.mode doc
The software_isp.mode setting was missing from the runtime_configuration
documentation, add it.

Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-01 12:06:45 +01:00
Hans de Goede
c2f0aeb5fc software_isp: Log input config from configure()
As shown by commit 94d32fdc55 ("pipeline: simple: Consider output sizes
when choosing pipe config"), the extra pixel columns CPU debayering
requires on the input side makes resolution selection non trivial.

Add logging of the selected input config on a successful configure() so
that the logs clearly show which sensor mode has been selected.

Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-01 12:06:45 +01:00
Hans de Goede
e948ada380 software_isp: debayer_cpu: Add multi-threading support
Add CPU soft ISP multi-threading support.

Benchmark results for the Arduino Uno-Q with a weak CPU which is good for
performance testing, all numbers with an IMX219 running at
3280x2464 -> 3272x2464:

1 thread : 147ms / frame, ~6.5 fps
2 threads:  80ms / frame, ~12.5 fps
3 threads:  65ms / frame, ~15 fps

Adding a 4th thread does not improve performance.

Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> # ThinkPad X1 Yoga Gen 7 + ov2740
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-01 12:06:27 +01:00
Hans de Goede
41d17f8211 software_isp: debayer_cpu: Add DebayerCpuThread class
Add a DebayerCpuThreadclass and use this in the inner render loop.
This contains data which needs to be separate per thread.

This is a preparation patch for making DebayerCpu support multi-threading.

Benchmarking on the Arduino Uno-Q with a weak CPU which is good for
performance testing, shows 146-147ms per 3272x2464 frame both before and
after this change, with things maybe being 0.5 ms slower after this change.

Tested-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> # ThinkPad X1 Yoga Gen 7 + ov2740
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-01 12:05:15 +01:00
Hans de Goede
6e53e72e96 software_isp: swstats_cpu: Prepare for multi-threading support
Make the storage used to accumulate the RGB sums and the Y histogram
value a vector of SwIspStats objects instead of a single object so
that when using multi-threading every thread can use its own storage to
collect intermediate stats to avoid cache-line bouncing.

Benchmarking with the GPU-ISP which does separate swstats benchmarking,
on the Arduino Uno-Q which has a weak CPU which is good for performance
testing, shows 20ms to generate stats for a 3272x2464 frame both before
and after this change.

Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-01 12:04:42 +01:00
Barnabás Pőcze
2a1c75504c meson: Switch to C++20
Switch to using the C++20 standard when compiling libcamera.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-03-27 16:29:49 +01:00
Barnabás Pőcze
9b6179fdb3 treewide: Use character literal instead of string in some cases
Use character literals instead of single character long strings. The main
purpose of this change is to work around a GCC bug that results in `-Wrestrict`
warnings at certain optimization levels in C++20. libstdc++ 13 has been
adjusted to avoid triggering the compiler warning.

Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2026-03-27 16:29:49 +01:00
Barnabás Pőcze
bfd5518d6b libcamera: base: log: Ignore deprecations
`std::atomic_{load,store}()` with `std::shared_ptr` has been deprecated
in C++20 in favour of `std::atomic<std::shared_ptr<>>`. However, it is
not available on all supported platforms. So ignore the deprecation warnings.
The specialization is available since gcc (libstdc++) 12 and llvm (libc++) 15.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2026-03-27 16:29:49 +01:00
Barnabás Pőcze
17681b75f7 meson: Ignore Wredundant-move with GCC 11 and above
In C++20 mode, object slicing in a return statement triggers automatic move
since GCC 11, and using `std::move()` emits `-Wredundant-move` in those
same GCC versions. So disable the warning in those as well.

This is relevant for `valueOrTuple()` in `py_helpers.cpp`, which
returns a `py::tuple` as `py::object`.

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>
2026-03-27 16:29:49 +01:00
Barnabás Pőcze
3dbf1376a4 gstreamer: Add -Wno-volatile for GCC
Older versions of glib may use `volatile` qualified variables, triggering
the warning in C++20. So suppress it.

Link: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2026-03-27 16:29:49 +01:00
Laurent Pinchart
4937f5489b utils: Add missing SPDX headers to scripts
The gen-header.sh and gen-shader-headers.sh scripts are missing an SPDX
header. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Bryan O'Donoghue <bod.linux@nxsw.ie>
2026-03-24 18:04:05 +02:00
Barnabás Pőcze
9f35e45b17 apps: qcam: Show QImageWriter errors
When saving the current iamge, `QImageWriter::write()` may fail for various
reasons. However, this is currently not reported in any way.

Use a simple `QMessageBox` to report the issues.

Link: https://gitlab.freedesktop.org/camera/libcamera/-/issues/313
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-03-24 08:12:59 +01:00
Barnabás Pőcze
309b99f3ee apps: qcam: Fix clang build
While gcc ignores attempts to disable unknown warnings, clang does not
(`-Wunknown-warning-option`), thus compilation fails due to the recent
addition of `-Wno-sfinae-incomplete`. So only add it conditionally.

Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/315
Fixes: aa2a0812e6 ("apps: qcam: Disable -Wsfinae-incomplete")
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>
2026-03-20 11:16:26 +01:00
Barnabás Pőcze
6ce7132b1b ipa: libipa: quantized: Enable constexpr operation
There is nothing inherently non-constexpr in the `Quantized` type. Whether
it can work in `constexpr` contexts depends on the traits type. There is
no reason to explicitly disallow `constexpr` operation. So mark all eligible
methods `constexpr`.

In addition, add some `static_assert()`s to the "quantized" test to check
constexpr operation.

For example, `FixedPointQTraits<...>::toFloat()` is `constexpr`, so this
enables the construction of `{U,}Q<...>` from the underlying quantized
value in `constexpr` contexts, which can be useful for example for
storing default values in e.g. `static constexpr` variables.

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>
2026-03-20 08:35:17 +01:00
Barnabás Pőcze
02277d4c1a ipa: simple: Fix again10 value with sensor helper
`CameraSensorHelper::gain(uint32_t)` maps a gain code to the actual floating
point gain value. Calling it with `1.0` as the argument will simply get
the real gain for gain code 1. This is most likely not what was intended.

For example, in the case of the `ov2740` sensor, `againMin` is 1, but the
calculated `again10` (1 / 128 ~ 0.078) ends up being < 1, meaning that the
agc algorithm will never lower the exposure.

Fix that by using the maximum of the minimum gain and 1 as `again10`.

Fixes: 950ca85e8a ("ipa: software_isp: AGC: Do not lower gain below 1.0")
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
2026-03-10 08:56:47 +01:00
Barnabás Pőcze
20ea9ae1e5 py: Fix include order
Python.h hence the pybind header must be included first since pyconfig.h
unconditionally overrides certain feature test macros[0]. This was mostly
hidden by the fact that macro redefinitions with the same value do not
trigger compiler warnings. However, glibc 43 has changed certain defaults[1],
causing mismatches, leading to compiler warnings.

So change the include order so that `<pybind11/...>` headers are included
first and then the local `"py_..."` headers, and then everything else. Also
remove some redundant includes.

Adjust `.clang-format` and the documentation as well.

[0]: https://docs.python.org/3/c-api/intro.html#include-files
[1]: https://sourceware.org/git/?p=glibc.git;a=commit;h=a5cc3018f31a125f019685b239c6e5a0bf1a272b

Link: https://github.com/python/cpython/issues/61322
Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2026-03-06 18:24:56 +01:00
Naushir Patuck
14ba4d1680 ipa: rpi: awb_nn: Remove unused constexpr variable
The kDefaultCT variable is unused, remove it.

Signed-off-by: Naushir Patuck <naush@raspberrypi.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>
2026-03-02 12:27:18 +00:00
Milan Zamazal
0d3e543b4d libcamera: software_isp: Set initial values of DebayerParams
Debayer parameters and processing are currently run asynchronously.
This can lead to assertion errors in case the processing tries to use
not yet computed debayer parameters.  To prevent this situation, specify
some default values for DebayerParams members.  This doesn't make
correct parameters but prevents crashes or other crazy behaviours at
least.

Note this patch is just a workaround.  The mutually asynchronous
parameters computation and processing can cause more problems, like
using parameters computed for a different frame.  But it is non-trivial
to fix that; in the meantime, setting the default values solves the
worst problem.

Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/311
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-26 16:37:41 +00:00
David Plowman
cc74afcdbd libcamera: rpi: Make the controller min frame duration configurable
The controller min frame duration is used to rate limit how often we
run IPAs. Historically this has been set to 33333us, meaning that the
algorithms effectively skip frames when the camera is running faster
than 30fps.

This patch adds a small amount of plumbing that allows this value to
be set in the Raspberry Pi configuration file. Some applications or
platforms (such as Pi 5) are easily capable of running these more
often, should there be a need to do so.

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: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-02-26 10:17:36 +00:00
Barnabás Pőcze
71c5c08fcf libcamera: software_isp: debayer_egl: Remove frameSize()
The base class (`Debayer`) already contains a non-virtual function with
the same name and implementation, so remove it from the derived class.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2026-02-24 18:01:30 +01:00
Barnabás Pőcze
6db2a7ab43 py: Disable -Winvalid-offsetof
A "small vector" implementation has been introduced in the latest version of
pybind11 (3.0.2), which might use `offsetof()` on a non standard layout type.
This triggers the `invalid-offsetof` warning.

So disable it for the python bindings.

Link: https://github.com/pybind/pybind11/pull/5824
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>
2026-02-24 10:06:51 +01:00
Laurent Pinchart
993968d80e libcamera: Standardize on 'const auto'
'const auto' and 'auto const' are interchangeable in C++. There are 446
occurrences of the former in the code base, and 67 occurrences of the
latter. Standardize on the winner.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-02-20 13:34:30 +01:00