Commit Graph

6236 Commits

Author SHA1 Message Date
b7ba2c9cfe Android.bp: add vendor_available to IPA and camera static lib deps
The ninja-to-soong migration marked all libcamera shared libs as
soc_specific: true but omitted vendor_available: true from the static
libs they link against. This causes Soong to fail with "missing variant:
image:vendor" when the static libs are pulled in transitively by the
vendor APEX com.android.hardware.camera.libcamera.

Add vendor_available: true to the five affected cc_library_static modules.
2026-06-15 11:53:28 +00:00
Konsta
2c3d3b6185 android: Add soong blueprint makefiles generated by ninja-to-soong 2026-04-30 16:14:23 +03:00
Konsta
8bf59a6bbd android: hal: Convert to apex 2026-04-30 16:11:18 +03:00
Konsta
14780c69ca android: Add soong blueprint makefiles for ipa data 2026-04-30 16:11:18 +03:00
Konsta
58561aba10 android: subprojects: Use libpisp from raspberry-vanilla
* To build using NDK.
2026-04-30 16:11:18 +03:00
Konsta
aa46cf68d9 android: Pass project version to gen-version.sh
* To have version number in meson generated src/libcamera/version.cpp
  on NDK build.
2026-04-30 16:11:18 +03:00
Konsta
caeab4e6ef android: Don't set soversion
Change-Id: Ic8056f5bf13d9706fb1671dbfbebeb03c45515c8
2026-04-30 16:11:18 +03:00
Konsta
d1d0c73304 HACK: android: Make libjpeg optional
* To build using NDK.
2026-04-30 16:11:18 +03:00
Konsta
0ee1303114 HACK: android: Fixes to build as part of AOSP 2026-04-30 16:11:18 +03:00
Konsta
5910141a68 HACK: android: Remove support for color spaces 2026-04-30 16:11:18 +03:00
Roman Stratiienko
2a1ba049b9 HACK: android: Set cfg.bufferCount to some value
Otherwise Android framework will fail to configure camera.

Change-Id: I8d89a8ae52b248781c1fce9e890d3a6fc258e4f4
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2026-04-30 16:11:18 +03:00
Roman Stratiienko
91d99ba46e HACK: android: Report IPA signature is always valid
Without gnutls libcamera will always require proxy service for IPA.
Building within Android using meson.build has a problem with producing
executables, therefore disable check to allow dlopen() IPA instead.

Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Change-Id: Ia1262cc7198ca196860b5f6526b55c8071b07f1f
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2026-04-30 16:11:18 +03:00
Maxime Fournier
b02341aa90 android: hal: implement signalStreamFlush with race condition handling
Add proper implementation of signalStreamFlush() to handle stream buffer
flushing before reconfiguration. Features:
- Stream configuration counter to prevent race conditions
- Validation of stream IDs against configured streams
- Inflight buffer tracking and reporting for affected streams
- Warning when buffers are detected to prevent fatal errors

Increments mStreamConfigCounter during configureStreams() and uses atomic
operations to detect stale signalStreamFlush() calls, ensuring proper
synchronization during stream reconfiguration.

Further details about the race condition scenario can be found at [1].

[1] https://android.googlesource.com/platform/hardware/interfaces/+/master/camera/device/aidl/android/hardware/camera/device/ICameraDeviceSession.aidl#489

Signed-off-by: Maxime Fournier <mfournier@baylibre.com>
2026-04-30 16:11:18 +03:00
Maxime Fournier
7e2ca2b541 android: hal: implement isReconfigurationRequired function
Add session parameter comparison logic to determine when stream
reconfiguration is needed. Compares critical parameters between
old and new session configurations:
- ANDROID_CONTROL_AE_TARGET_FPS_RANGE (frame rate changes)
- ANDROID_FLASH_MODE (flash/torch mode changes)
- ANDROID_CONTROL_VIDEO_STABILIZATION_MODE (stabilization changes)

Returns true if any parameter changes would require complete stream
reconfiguration, enabling more efficient camera session management.

Signed-off-by: Maxime Fournier <mfournier@baylibre.com>
2026-04-30 16:11:18 +03:00
Maxime Fournier
3002f283ea android: hal: implement repeatingRequestEnd callback
Add proper implementation of repeatingRequestEnd() function for Android
Camera HAL compliance. Validates stream IDs and logs notification about
the final frame number when repeating requests end.

This is a lightweight notification callback that informs the HAL when
repeating capture requests will terminate at a specific frame number
for given streams, as required by the Android Camera HAL specification.

Always return Status::OK since the method must always succeed as described in [1].

[1] https://android.googlesource.com/platform/hardware/interfaces/+/master/camera/device/aidl/android/hardware/camera/device/ICameraDeviceSession.aidl#570

Signed-off-by: Maxime Fournier <mfournier@baylibre.com>
2026-04-30 16:11:18 +03:00
Maxime Fournier
276d062e23 android: camera: fix unsupported camera control validation
Add runtime validation for camera controls before setting them to prevent
spam errors. Check controls.find() for ANDROID_SCALER_CROP_REGION and
ANDROID_STATISTICS_FACE_DETECT_MODE before attempting to set values.

Fixes error spam:
- "Control 0x0000001b is not valid" (ScalerCrop)
- "Control 0x0000271a is not valid" (FaceDetectMode)

Only sets controls that are supported by the specific camera hardware,
improving HAL compliance and reducing log noise.

Signed-off-by: Maxime Fournier <mfournier@baylibre.com>
2026-04-30 16:11:18 +03:00
Mattijs Korpershoek
66b0bcbbee android: hal: Add AIDL camera HAL
This is a combination of 31 commits.

android: hal: provider: Import legacy provider 2.4 HAL from AOSP

AOSP does not ship an up-to-date (libhardware) camera provider HAL.

In order to write an AIDL HAL compatible with libcamera, we need
some reference codebase to start from.

Import the 2.4 legacy HAL from AOSP from tag android-15.0.0_r12.
Folder path: //hardware/interfaces/camera/provider/2.4/default/
commit ad2ba1b851b6 ("[DON'T BLOCK] Test ownership migration rules")

Note: only the "legacy" part has been imported since external cameras are
supported via android.hardware.camera.provider-V1-external-service.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: device: Import helpers from camera.device-external-impl

The ExternalCameraDevice AIDL HAL provides some convience functions to
convert between libhardware structures and AIDL classes.
It also provides a wrapper to convert common::Status to ScopedAStatus.

We need those convience functions for our HAL implementation as well.

Since they are not in a separate library, we can't simply link against it.

Make a local copy for our own usage here.

Import from android-15.0.0_r12 tag
Folder path: //hardware/interfaces/camera/device/default/
commit ad2ba1b851b6 ("[DON'T BLOCK] Test ownership migration rules")

Note: this only imports the conversion code.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: device: Rename device-external-impl -> device-libcamera-impl

For now camera.device-libcamera-impl only supports conversion functions.

This is already useful for the provider implementation in order to
convert from common::Status to AScopedStatus.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: Use Android-Apache-2.0 instead of hardware_interfaces_license

hardware_interfaces_license is only available for projects in:
//hardware/interfaces//

Since our HAL is not located in that folder, we cannot use it.

  variant "android_common": depends on
  //hardware/interfaces:hardware_interfaces_license which is
  not visible to this module

Switch to Android-Apache-2.0 which is the same license and is
available in all Android projects.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: Remove 32-bits build targets

Recent Android versions (with kernel version 6.2+) require 64-bits userspace.

Therefore, there is no point in keeping unused 32-bits build targets.
Remove them.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: Rename 2.4 -> 2.5 to prepare HIDL update

The most recent libbhardware (legacy) based camera provider HAL in AOSP
is the 2.5 version located in //hardware/interfaces/camera/provider/2.5/default/
LegacyCameraProviderImpl_2_5 is implemented as a subclass of
LegacyCameraProviderImpl_2_4.

We don't want this subclassing to be done because it makes converting to AIDL
more difficult.
Instead, we want the new 2.5 function (notifyDeviceStateChange()) to
be part of our class.

In order to prepare for importing the 2.5 codebase, rename all mentions
from 2.4 -> 2.5.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: Import HIDL v2.5 provider HAL from AOSP

The most recent libbhardware (legacy) based camera provider HAL in AOSP
is the 2.5 version located in //hardware/interfaces/camera/provider/2.5/default/
LegacyCameraProviderImpl_2_5 is implemented as a subclass of
LegacyCameraProviderImpl_2_4.

We don't want tho subclass because it makes converting to AIDL more difficult.
Instead, we want the new 2.5 function (notifyDeviceStateChange()) to
be part of our class.

Import the 2.5 code from tag android-15.0.0_r12.
Folder path: //hardware/interfaces/camera/provider/2.5/default/
commit ad2ba1b851b6 ("[DON'T BLOCK] Test ownership migration rules")

This:
- Removes the '-impl' library (it's a template-based header only)
- Add notifyDeviceStateChange() method
- Update copyright notice

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: Remove templated CameraProvider struct

CameraProvider is implemented as a wrapper structure in order to
be backwards compatible with various HIDL versions.

Since this code is about to get upgraded to AIDL, we don't care about the
deprecated HIDL support.

Remove the HIDL interface layer and make LegacyCameraProviderImpl
implement the ICameraProvider interface.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: Rename legacy -> libcamera

This provider HAL is libcamera specific. As a first step we will still rely on
libhardware as interface, but that can get plumbed in future reworks.

Rename from "legacy" to "libcamera" to make it clear that this provider HAL is
for supporting cameras using libcamera.

While at it, also update the LOG_TAGs to match the new naming.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: Send libcamera logs to logcat

By default libcamera logs only warnings and errors to stdout.

Use LIBCAMERA_LOG_LEVELS and LIBCAMERA_LOG_FILE to ensure
that libcamera logs info+ logs are send to logcat.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: Remove V2_5 namespace to prepare for AIDL

Most AIDL HALs don't use the AIDL version inside the C++ namespace.
Follow that practice and remove it here as well.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: Don't hard-code the hwbinder thread count

Following example from //hardware/interfaces/camera/provider/default,
use a constant instead of hard-coding the thread count.

This will simplify AIDL migration to match what is done for the
ExternalCameraProvider.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: Don't use intermediate variable for LAZY_SERVICE

The intermediate bool variable is not needed since we can use the pre-processor
for this.

Remove it as done in ExternalCameraProvider.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: device: Add a stub implementation for provider

In order to implement the provider HAL in AIDL, we need to
instantiate a ICameraDevice.
A ICameraDevice implementation must inherit from BnCameraDevice.

Add a minimal stub, named LibcameraDevice which builds.
This can be used by the provider HAL in getCameraDeviceInterface().

Note that we no longer depend on hidl_defaults so get rid of that as well.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: Migrate from v3.5 HIDL to AIDL v1

This migrates the provider HAL from HIDL into AIDL.

This includes the following changes:
- Replace use std::string instead of hidl_string
- Use CameraDeviceStatus enum instead of CAMERA_DEVICE_STATUS
- Use std::shared_ptr<> instead of android::sp<>
- Use method argument naming from ExternalCameraProvider
- Return ndk::ScopedAStatus instead of camera::common::Status
- Remove support of vendor tags as it's un-implemented in libcamera

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: device: Implement BnCameraDevice interface

Implement all required operations of a BnCameraDevice with the exception
for session handling.

Session being a quite complex topic, it will be enabled after the
LibcameraDeviceSession class is implemented.

This is based on the both the legacy 3.2 HIDL HAL and
the External AIDL located in:

//hardware/interfaces/camera/device/3.2/default/CameraDevice
//hardware/interfaces/camera/device/default/ExternalCameraDevice

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: session: Import legacy 3.2 CameraDeviceSession from AOSP

In order to write an AIDL HAL compatible with libcamera, we need
some reference codebase to start from.

Import the 3.2 legacy HAL from AOSP from tag android-15.0.0_r12.
Folder path: //hardware/interfaces/camera/device/3.2/default/
commit ad2ba1b851b6 ("[DON'T BLOCK] Test ownership migration rules")

Note: only the "legacy" part has been imported since external cameras are
supported via android.hardware.camera.provider-V1-external-service.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: session: rename CameraDeviceSession -> LibcameraDeviceSession

This is going to be libcamera specific, so rename it accordingly.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: session: Remove V3_2 namespace to prepare for AIDL

Most AIDL HALs don't use the AIDL version inside the C++ namespace.
Follow that practice and remove it here as well.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: session: Remove HIDL trampoline code to prepare for AIDL

We don't need this, as it's HIDL specific.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: session: Migrate from v3.2 HIDL to AIDL v1

This migrates the DeviceSession class from HIDL into AIDL.

This includes the following changes:
- Use std::shared_ptr<> instead of android::sp<>
- Use std::string instead of hidl_string
- Use std::vector instead of hidl_vec
- Remove V1_0 namespace for camera::common::helper
- Use HandleImporter from camera::common::helper
- Use AIDLMessageQueues and change data type from uint8_t -> int8_t
- Use makeFromAidl() for fence handling
- Use std::move() instead of hand-cloning fences
- Use new NotifyMsg API with class enums
- Use NativeHandle instead off native_handle_t* when needed

Note: by switching to dupToAidl(), we must ensure that the original handle
is deleted.

Note: All AIDL specific operations are stubbed for now, as we are not sure that
those are implemented by libcamera's hw_module.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: device: Use LibcameraDeviceSession class

Now that LibcameraDeviceSession is implemented, we can use it in
LibcameraDevice.

With this change, we can see preview using com.android.camera2 app and
take pictures via libcamera.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: Rename outdated LOG_TAGs

These were leftovers from the code import from AOSP.

Update to use the new naming scheme so that it's easier to grep
for this HAL in logcat.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: Remove un-needed dependencies

While converting to AIDL, we failed to remove the HIDL
dependencies.

Cleanup the dependencies and also depend on common-helper instead of
the deprecated common@1.0-helper.

Note that for device, we cannot get rid of libhidlbase because of our
usage of HandleImporter.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: Remove lazy service support

We have never used the lazy implementation and don't even know how
to test it.

To simplify the codebase, get rid of it.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: add libcamera_aidl_defaults

Add a new libcamera_aidl_defaults which is used by the
camera library.

This allows us to remove lots of duplicated shared_libs since
they are defined in the new defaults.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: provider: Return ILLEGAL_ARGUMENT when callback is nullptr

When a user attempts to setCallback() using a nullptr, we should
return ILLEGAL_ARGUMENT, not OK.

Update the condition and while at it, drop the braces which are
not needed for a single statement.

Not: this is tested by VTS.

Test: atest PerInstance/CameraAidlTest#setCallback/1_android_hardware_camera_provider_ICameraProvider_libcamera_0
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: device: Fix openInjectSession() return code

The AIDL doc states that we should return OPERATION_NOT_SUPPORTED when
this is not implemented.

Fix the return code. This is tested with VTS.

Test: atest PerInstance/CameraAidlTest#configureInjectionStreamsAvailableOutputs/1_android_hardware_camera_provider_ICameraProvider_libcamera_0
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: device: Fix torch related return codes

When these operations are not supported, we should return
OPERATION_NOT_SUPPORTED instead of ILLEGAL_ARGUMENT.

Fix both return codes.

This is tested by VTS.

Test: atest PerInstance/CameraAidlTest#turnOnTorchWithStrengthLevel/1_android_hardware_camera_provider_ICameraProvider_libcamera_0
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: device: Return ILLEGAL_ARGUMENT on invalid output buffer

When we are importing an invalid output buffer, we should return
ILLEGAL_ARGUMENT, not INTERNAL_ERROR.

Fix this.

This is tested by VTS.

Test: atest PerInstance/CameraAidlTest#processCaptureRequestInvalidBuffer/1_android_hardware_camera_provider_ICameraProvider_libcamera_0
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

android: hal: Cleanup makefiles
2026-04-30 16:11:18 +03:00
Roman Stratiienko
1b54a0dbae android: Fallback to some default min/max frame duration
Instead of failing to initialize pipeline.
(uvccamera pipeline doesn't expose these controls)

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
2026-04-30 16:11:18 +03:00
Vitor Sato Eschholz
e60f44b965 android: Remove discontiguous planes check from camera buffer
The way discontiguous planes are checked in generic_camera_buffer
ignores that they can be placed in the same dmabuf. This is the
case for AM62x boards, where multiplanar formats are stored
continuously in the memory and referenced through only one
File Descriptor.

Remove the check from generic_camera_buffer.cpp to allow the
creation of CameraBuffers for AM62x boards. The verification
for discontiguous planes are done in v4l2_videodevice.cpp.

Signed-off-by: Vitor Sato Eschholz <vsatoes@baylibre.com>
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2026-04-30 16:11:18 +03:00
Mattijs Korpershoek
485875b0a8 android: camera3_hal: Add stubs for CAMERA_MODULE_API_VERSION_2_5
CAMERA_MODULE_API_VERSION_2_5 provides new functions such as
isStreamCombinationSupported().

isStreamCombinationSupported() is tested by VtsAidlHalCameraProvider_TargetTest

Add stubs for implementing these to fix more VTS.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2026-04-30 16:11:18 +03:00
Konsta
eebc8644cf android: Update libhardware headers
* From hardware/libhardware/include/hardware/ in android-16.0.0_r1.
* Needed for CAMERA_MODULE_API_VERSION_2_5.
2026-04-30 16:11:18 +03:00
Mattijs Korpershoek
fe37826bf4 android: mm: generic: Use GraphicBufferAllocator instead of gralloc.h
gralloc.h is a very old API that has been deprecated at least since
Android P (9).

Switch over to a higher level abstraction of gralloc from libui, which
is compatible with Android 11 and up.
Libui:
* is provided in the VNDK (so it's available to vendors).
* is also used in the camera vts test named VtsAidlHalCameraProvider_TargetTest.

Drop the libhardware stub since we no longer need it.

Notes:
* GraphicsBufferAllocator being a Singleton, buffer lifecycle
  management is easier.
* The imported headers from Android generate the -Wextra-semi warning.
  To avoid patching the files, a pragma has been added before inclusion.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2026-04-30 16:11:18 +03:00
Mattijs Korpershoek
8691ade614 android: Stub GraphicBufferAllocator for build tests
If we want to keep building libcamera on traditional Linux systems with:
  -Dandroid=enabled -Dandroid_platform=generic

We should stub GraphicBufferAllocator, which is not available.
It's only available when building with the VNDK or when building within the
AOSP tree.

Also remove some deprecated methods and inclusions which are not needed for
the stub class.

Note: the imported headers from Android generate the -Wextra-semi warning.
      To avoid patching the files, a pragma has been added before inclusion.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2026-04-30 16:11:18 +03:00
Mattijs Korpershoek
f2744d760e android: Import GraphicBufferAllocator header from vndk v33
The GraphicBufferAllocator class (from libui) provides a more modern interface
to Android buffer allocation.

Moreover, the gralloc.h API has been deprecated since Android P (9).

Import the GraphicBufferAllocator.h from the VNDK.

These have been imported from:
URL: https://android.googlesource.com/platform/prebuilts/vndk/v33/
rev: 390028a9da88 ("Update VNDK snapshot v33 to build 9948968. am: 3042508aee am: 7092391a46")

No changes have been made to the files, besides adding the SPDX comment.

Note: because GraphicBufferAllocator has lots of Android-specific dependencies,
a future patch is needed to stub/simplify this include.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2026-04-30 16:11:18 +03:00
Mattijs Korpershoek
dd4cf500d2 android: Import libutils/libui headers from vndk v33
In order to switch to the more modern GraphicBufferAllocator class, we need
additional compile-time dependencies.

Import all the needed headers from the Android Vendor Native Development
Kit (vndk) and add them to the android_includes.

These have been imported from:
URL: https://android.googlesource.com/platform/prebuilts/vndk/v33/
rev: 390028a9da88 ("Update VNDK snapshot v33 to build 9948968. am: 3042508aee am: 7092391a46")

No changes have been made to the files, besides adding the SPDX comment.

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2026-04-30 16:11:18 +03:00
Naushir Patuck
a0f996c21c ipa: rpi: imx500: Update exposure profiles
Allow the max gain to go upto 16x.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2026-04-30 16:11:18 +03:00
David Plowman
2c5a3a0e9c ipa: rpi: awb: Update neural network AWB tunings for vc4 platform
The network was trained against CT curves measured for PiSP, so use
those as results are generally a bit better.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
2026-04-30 16:11:18 +03:00
David Plowman
aa7e6d7e2e ipa: rpi: Update imx500 tuning files to include neural network AWB
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
2026-04-30 16:11:18 +03:00
Richard Oliver
4ee74d6373 ipa: rpi: Expose frameCount in extracted IMX500 tensors
When injecting input tensors, the output results are expected to be made
available at a specific frame. This change exports tensors' frameCount
so that an appropriate comparison can be made by the controlling
application.

Signed-off-by: Richard Oliver <richard.oliver@raspberrypi.com>
2026-04-30 16:11:18 +03:00
Konsta
5ae5aea2e1 pipeline: rpi: pisp: Use correct cfe devices
* Raspberry Pi 5 ISP (PiSP) support submitted to upstream libcamera is
  different from their own libcamera fork [1].
* These match the naming used in driver that was merged in upstream
  Linux 6.13 kernel [2].
* Revert back to the correct cfe devices that match the current kernel [3].

[1]: https://github.com/raspberrypi/libcamera
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c#n126
[3]: 317477113b/drivers/media/platform/raspberrypi/rp1_cfe/cfe.c (L139-L194)
2026-04-30 16:11:18 +03:00
Naushir Patuck
df8ba90d44 pipeline: rpi: pisp: Enable FE stats crop if needed
If the decimation width is greater than the max stats width, add a
centre crop on the image to allow the stats to be gathered correctly.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2026-04-30 16:11:18 +03:00
Naushir Patuck
ac83d6fb72 RASPBERRYPI ONLY: Handle mandatory stream flags
Look for the RAW mandatory stream flag in the pipeline handler config
file. If this flag is set, it guarantees that the application will
provide buffers for Unicam Image, so override the minUnicamBuffers and
minTotalUnicamBuffers config parameters in the following way:

- If startup drop frames are required, allocate at least 1 internal buffer.
- If no startup drop frames are required, do not allocate any internal buffers.

Look for the Output 0 mandatory stream flag in in the pipeline handler
config file. If this flag is set, it guarantees that the application
will provide buffers for the ISP, do not allocate any internal buffers
for the device.

Add a new rpi_apps.yaml pipeline handler config file that enables both
these flags.  To use the file, set the following env variable for a
custom build:

export LIBCAMERA_RPI_CONFIG_FILE=/usr/local/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml

or for a packaged install:

export LIBCAMERA_RPI_CONFIG_FILE=/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2026-04-30 16:11:18 +03:00
Naushir Patuck
7b1d459071 ipa: rpi: imx500: Fix stringop-truncation warning
This warning is issued by the compiler because the strncpy copies across
the whole string array, leaving no place for the nul terminator. Fix it
by copying sizeof(str) - 1 elements.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2026-04-30 16:11:18 +03:00
Naushir Patuck
ad64f9e8cc ipa: rpi: Add support for the Sony IMX500 camera sensor
Add a Sony IMX500 camera helper to the IPA. This also includes support
for the on-chip CNN hardware accelerator and parsing of the neural
network data stream returned in the metadata buffer.

Add tuning files for both VC4 and PiSP platforms.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2026-04-30 16:11:18 +03:00
Naushir Patuck
81fd85c271 ipa: rpi: Handle the new CNN controls in the IPA
Add code to handle the new CNN vendor controls in the Raspberry Pi IPA.

The value of CnnInputTensorInfo is cached as it is the only stateful
input control.

All other controls are output controls, and the values are copied into
directly from the rpiMetadata object if present. The camera helpers
populate the rpiMetadata object if the sensor supports on-board CNN
processing, such as the IMX500.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2026-04-30 16:11:18 +03:00
Naushir Patuck
6405af684d controls: ipa: rpi: Add CNN controls
Add the follwing RPi vendor controls to handle Convolutional Neural
Network processing:

CnnOutputTensor
CnnOutputTensorInfo
CnnEnableInputTensor
CnnInputTensor
CnnInputTensorInfo
CnnKpiInfo

These controls will be used to support the new Raspberry Pi AI Camera,
using an IMX500 sensor with on-board neural network processing.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2026-04-30 16:11:17 +03:00
Kieran Bingham
183e37362f libcamera v0.7.1
This release brings 142 commits with the largest developments in the core of
libcamera components. Perhaps the most obvious is that we now use C++20 for the
project. The Configuration file handling has had a substantial rework with
updates to the yaml_parser.

The RKISP1 IPA has now added a new Hue control which brought with it a rework
of how we manage fixed point arithmetic with the Quantized class. I hope this
makes it easier to convey types with hardware operations.

The SoftISP has the ability to perform CPU debaying with multiple threads which
helps throughput on platforms such as the Arduino Uno Q.

The Mali-C55 pipeline handler now has full support for the RZG2LCRU and inline
handling which enables camera support on the Renesas RZ/V2H and RZ/V2NP
platforms.

And of interest in the apps components, the gstreamer plugin now has the
ability to select and configure the sensor mode configuration properties.
Finally a new script "libcamera-bug-report" is available to be packaged which
will help users identify issues when reporting bugs.

Contributors:

    64  Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    28  Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
    21  Kieran Bingham <kieran.bingham@ideasonboard.com>
     8  Hans de Goede <johannes.goede@oss.qualcomm.com>
     7  Jacopo Mondi <jacopo.mondi@ideasonboard.com>
     3  David Plowman <david.plowman@raspberrypi.com>
     3  Milan Zamazal <mzamazal@redhat.com>
     3  Naushir Patuck <naush@raspberrypi.com>
     2  Stefan Klug <stefan.klug@ideasonboard.com>
     1  Daniel Scally <dan.scally@ideasonboard.com>
     1  Gianfranco Mariotti <gianfranco.mariotti94@gmail.com>
     1  van Veen, Stephan <stephan.vanveen@karlstorz.com>

142 commits,  319 files changed, 5346 insertions(+), 8486 deletions(-)

Integration Overview:

ABI:

The abi-compliance checker reports 100% compatibility in this release,
so the SONAME is maintained at 0.7.

Validating ABI compatibility between v0.7.0 and v0.7.1
Preparing, please wait ...
Comparing ABIs ...
Comparing APIs ...
Creating compatibility report ...
Binary compatibility: 100%
Source compatibility: 100%
Total binary compatibility problems: 0, warnings: 0
Total source compatibility problems: 0, warnings: 0

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

bugs:
 - libcamera: converter: converter_dw100_vertexmap: Fix dewarp parameter p2 handling
   - Fixes: 1784e08be3 ("libcamera: dw100_vertexmap: Implement parametric dewarping")
 - py: Disable `-Winvalid-offsetof`
   - Link: https://github.com/pybind/pybind11/pull/5824
 - libcamera: software_isp: Set initial values of DebayerParams
   - Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/311
 - py: Fix include order
   - Link: https://github.com/python/cpython/issues/61322
 - ipa: simple: Fix `again10` value with sensor helper
   - Fixes: 950ca85e8a ("ipa: software_isp: AGC: Do not lower gain below 1.0")
 - apps: qcam: Fix clang build
   - Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/315
 - apps: qcam: Show `QImageWriter` errors
   - Link: https://gitlab.freedesktop.org/camera/libcamera/-/issues/313
 - gstreamer: Add `-Wno-volatile` for GCC
   - Link: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719
 - treewide: Use character literal instead of string in some cases
   - Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105329
 - Documentation: Enable treeview generation for doxygen < 1.13.0
   - Fixes: 42d914f20c ("Documentation: Enable doxygen-awesome-css")
 - gstreamer: Add sensor-config property
   - Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/300
 - utils: update-kernel-headers: Fix destination path
   - Fixes: ee8f88fc64 ("include: linux: Add v4l2-isp.h")
 - libcamera: egl: Remove `eGLImage::image_`
   - Fixes: f520b29fe9 ("libcamera: software_isp: debayer_egl: Add an eGL Debayer class")
 - libcamera: pipeline: rkisp1: Fix buffer queue memleaks
   - Fixes: c8f63760e5 ("pipeline: rkisp1: Support raw Bayer capture at runtime")
 - ipa: rpi: awb_nn: Rename YamlObject to ValueNode
   - Fixes: 554c5c7fa1 ("libcamera: Rename YamlObject to ValueNode")

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

core:
 - libcamera: base: Add missing `private.h` includes
 - meson: Add `libdw` option to control libdw dependency
 - libcamera: converter: converter_dw100_vertexmap: Fix dewarp parameter p2 handling
 - libcamera: controls: Define a new core Hue control
 - libcamera: Replace iterators with structured bindings
 - libcamera: Replace iterators with range-based for loops
 - libcamera: Use `it` variable name for iterators only
 - libcamera: Standardize on 'const auto'
 - libcamera: rpi: Make the controller min frame duration configurable
 - utils: Add missing SPDX headers to scripts
 - meson: Ignore `Wredundant-move` with GCC 11 and above
 - libcamera: base: log: Ignore deprecations
 - treewide: Use character literal instead of string in some cases
 - meson: Switch to C++20
 - meson: Add options to control drm, sdl2, jpeg dependencies of `cam`
 - meson: Add `apps-output-dng` option to control libtiff dependency
 - meson: Drop unnecessary egl, gles feature defines
 - meson: Add `egl.cpp` to sources alongside `debayer_egl.cpp`
 - meson: Simplify condition
 - meson: Remove `gles_headless_enabled`
 - meson: Use dependency object when checking for headers
 - meson: Move egl related dependencies to `software_isp` subdir
 - meson: Guard softisp gpu acceleration with feature option: softisp-gpu
 - utils: raspberrypi: Remove Raspberry Pi CTT from the source tree
 - utils: raspberrypi: Add a README.md to the old RPi CTT directory
 - libcamera: Make converter/softISP configure()'s outputCfgs argument really const
 - utils: Introduce libcamera-bug-report
 - libcamera: properties: Add a pipeline handler name property
 - libcamera: camera: Report the pipeline handler name
 - subprojects: Add nlohmann_json to .gitignore
 - reuse: Convert to REUSE.toml
 - reuse: Update file paths in REUSE.toml
 - reuse: Drop unnecessary entry from REUSE.toml
 - reuse: Add missing files to REUSE.toml
 - libcamera: Add missing SPDX headers
 - libcamera: rpi: Add missing SPDX headers
 - include: linux: Convert drm_fourcc.h to use SPDX
 - meson: Print soft ISP boolean options as YES/NO
 - meson: Print missing application options in summary
 - utils: update-kernel-headers: Fix destination path
 - meson: Use <version> header for C++ library version check
 - libcamera: egl: Remove `eGLImage::image_`
 - utils: checkstyle: Add license commit checker
 - libcamera: Drop unneeded usage of this pointer
 - libcamera: Replace plain pointers with std::unique<>
 - libcamera: pipeline_handler: Add createIPA() function
 - libcamera: camera_manager: Move IPAManager creation to start() time
 - libcamera: utils: Add overloaded visitor helpers
 - libcamera: yaml_parser: Use std::make_unique<>
 - libcamera: yaml_parser: Rename Container to ValueContainer
 - libcamera: yaml_parser: Rename Getter to Accessor
 - libcamera: yaml_parser: Replace getList() with get() specializations
 - libcamera: yaml_parser: Add function to set a YamlObject value
 - libcamera: yaml_parser: Add functions to add children
 - libcamera: yaml_parser: Un-friend YamlParserContext from YamlObject
 - libcamera: yaml_parser: Move Size handling to geometry.cpp
 - libcamera: yaml_parser: Drop unneeded \fn Doxygen commands
 - libcamera: yaml_parser: Split YamlObject from YamlParser
 - libcamera: yaml_object: Miscellaneous documentation improvements
 - libcamera: Rename YamlObject to ValueNode
 - libcamera: value_node: Add constructor with value
 - libcamera: value_node: Rework templates to prepare for mutable views
 - libcamera: value_node: Add mutable adapters
 - libcamera: value_node: Add mutable children accessors
 - libcamera: value_node: Support adding nested children in one operation
 - libcamera: value_node: Support looking up descendant node by path
 - libcamera: value_node: Add functions to erase child nodes
 - libcamera: Pass CameraManager around instead of GlobalConfiguration
 - libcamera: global_configuration: Reorder functions
 - libcamera: global_configuration: Add missing include and comment
 - libcamera: global_configuration: Rename yamlConfiguration_
 - libcamera: global_configuration: Rename Configuration to Option
 - libcamera: global_configuration: Drop Option type
 - libcamera: global_configuration: Populate empty configuration
 - libcamera: global_configuration: Override options with environment variables

ipa:
 - libcamera: ipa: simple: Fix multiplication order in Awb
 - ipa: rkisp1: Fix awb algorithm brief
 - ipa: simple: Remove duplicate header inclusion
 - ipa: libipa: Provide a Quantized data type support
 - ipa: libipa: fixedpoint: Fix unsigned usage
 - ipa: libipa: Provide fixed point quantized traits
 - ipa: rkisp1: cproc: Convert to use Quantized types
 - ipa: rkisp1: cproc: Report metadata
 - ipa: rkisp1: cproc: Provide a Hue control
 - ipa: rkisp1: ccm: Use Q<4, 7> format directly
 - ipa: mali-c55: Reduce AWB calculations to float precision
 - ipa: mali-c55: Convert AWB to UQ<4, 8> usage
 - ipa: mali-c55: agc: Quantise the ISP Digital Gain
 - ipa: libipa: fixedpoint: Move float conversion inline
 - ipa: rpi: awb_nn: Remove unused constexpr variable
 - ipa: simple: Fix `again10` value with sensor helper
 - ipa: libipa: quantized: Enable `constexpr` operation
 - ipa: rpi: Fix gamma lookup table generation for PiSP platform
 - utils: ipc: extract-docs: Work around reuse tool problem
 - ipa: rpi: awb_nn: Rename YamlObject to ValueNode

pipeline:
 - libcamera: software_isp: debayer: Take `DebayerParams` by ref
 - libcamera: software_isp: Remove redundant include of time.h
 - libcamera: software_isp: Fix LIBCAMERA_SOFTISP_MODE log print
 - libcamera: software_isp: debayer_egl: Remove `frameSize()`
 - libcamera: software_isp: Set initial values of DebayerParams
 - libcamera: software_isp: Convert TODO list to markdown
 - libcamera: software_isp: Move GPU TODO items to TODO.md
 - libcamera: software_isp: debayer: Add missing `override`
 - libcamera: software_isp: debayer_egl: Remove unnecessary declarations
 - libcamera: pipeline: rkisp1: Fix buffer queue memleaks
 - libcamera: mali-c55: Add RZG2LCRU class
 - libcamera: mali-c55: Split TPG and Inline camera handling
 - libcamera: mali-c55: Register memory input camera
 - libcamera: mali-c55: Configure camera in memory-to-memory
 - libcamera: mali-c55: Do not rely on bufferCount
 - libcamera: mali-c55: Implement capture for memory-to-memory
 - libcamera: mali-c55: Fix sensor size computation

test:
 - test: Remove uses of `O_TMPFILE`
 - test: libipa: Add tests for Quantized types
 - test: libipa: Provide FixedPoint Quantized tests
 - test: libipa: Remove legacy fixed point conversion test
 - test: ipa: ipa_interface: Use IPAManager::createIPA()
 - test: ipa: ipa_interface: Replace FIFO with pipe
 - test: Add ValueNode unit test
 - test: yaml-parser: Simplify test
 - test: yaml-parser: Standardize on explicitly qualifying std namespace
 - test: yaml-parser: Fix typos in error messages
 - test: yaml-parser: Replace "object" with "node"

softisp:
 - software_isp: benchmark: Add missing _ postfix to measure data member
 - software_isp: benchmark: Print what is being benchmarked
 - software_isp: swstats_cpu: Prepare for multi-threading support
 - software_isp: debayer_cpu: Add DebayerCpuThread class
 - software_isp: debayer_cpu: Add multi-threading support
 - software_isp: Log input config from configure()

apps:
 - android: camera_stream: Include <poll.h> instead of <sys/poll.h>
 - py: Disable `-Winvalid-offsetof`
 - py: Fix include order
 - apps: qcam: Fix clang build
 - apps: qcam: Show `QImageWriter` errors
 - gstreamer: Add `-Wno-volatile` for GCC
 - cam: Add option to report libcamera version
 - gstreamer: Add sensor-config property

documentation:
 - Documentation/runtime_configuration: Add missing software_isp.mode doc
 - Documentation: Enable treeview generation for doxygen < 1.13.0
 - Documentation: Update to C++20
 - Documentation: Rename runtime configuration title

tuning:
 - tuning: Handle macbeth_ref.pgm license through REUSE.toml

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2026-04-28 19:13:28 +01:00
Laurent Pinchart
4765309efe ipa: rpi: awb_nn: Rename YamlObject to ValueNode
The global rename of YamlObject to ValueNode in commit 554c5c7fa1
missed awb_nn.cpp. Fix it.

Fixes: 554c5c7fa1 ("libcamera: Rename YamlObject to ValueNode")
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>
2026-04-24 20:33:28 +03:00
Laurent Pinchart
7227dd4b40 Documentation: Rename runtime configuration title
The Documentation/runtime_configuration.rst file has a title that
mentions "variables" to refer to environment variables. Spell it out
fully for clarity.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2026-04-24 18:09:35 +03:00
Laurent Pinchart
16063986bb libcamera: global_configuration: Override options with environment variables
libcamera supports several environment variables that can override
configuration options. This requires components that use such overrides
to call the special envOption() and envListOption() functions, spreading
knowledge of the overrides through the code base. This will hinder
future enhancements to the global configuration, such as implementing
per-camera options that will override pipeline handler-level options. To
prepare for that, move handling of the environment variables to the
GlobalConfiguration class.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-24 18:09:31 +03:00
Laurent Pinchart
f06ad77043 libcamera: global_configuration: Populate empty configuration
If no configuration file can be parsed, populate an empty configuration.
This will serve as a base to store the configuration options set through
environment variables.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2026-04-24 18:09:18 +03:00
Laurent Pinchart
0ef232b486 libcamera: global_configuration: Drop Option type
The GlobalConfiguration::Option type was introduced to decouple the
configuration option storage from its users, and make changes to the
underlying implementation easier. While the type could indeed be changed
to map to a different class, the API would need to remain the same. The
Option type therefore brings little value. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2026-04-24 18:09:15 +03:00
Laurent Pinchart
24c965a234 libcamera: global_configuration: Rename Configuration to Option
The GlobalConfiguration::Configuration type represent a configuration
option. Rename it to Option to make this clearer. This shortens lines as
an added bonus.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2026-04-24 18:09:12 +03:00
Laurent Pinchart
800a861b01 libcamera: global_configuration: Rename yamlConfiguration_
Once parsed, the global configuration isn't a YAML file anymore. Rename
the yamlConfiguration_ to configuration_.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2026-04-24 18:09:11 +03:00
Laurent Pinchart
49d87c613b libcamera: global_configuration: Add missing include and comment
global_configuration.h uses std::initializer_list, include the
corresponding header. Add a comment in global_configuration.cpp to close
an anonymous namespace, as mandated by the coding style.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2026-04-24 18:09:09 +03:00
Laurent Pinchart
e2aea3f4e1 libcamera: global_configuration: Reorder functions
Member functions should be implemented in the .cpp file in the same
order as in the class definition, within each access group. Move them to
the right location. While at it, move load() before loadFile() in the
class definition to match execution order, making 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: Isaac Scott <isaac.scott@ideasonboard.com>
2026-04-24 18:09:07 +03:00
Laurent Pinchart
1c3e1baa6e libcamera: Pass CameraManager around instead of GlobalConfiguration
The GlobalConfiguration is explicitly passed around through constructors
of various objects that need access to the configuration. This ad-hoc
solution works for the specific use cases it was meant to support, but
isn't very generic. We have a top-level object in libcamera, the
CameraManager, that also needs to be accessed from various locations and
is passed to object constructors. Standardize on passing the
CameraManager everywhere, and access the global configuration through
it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2026-04-24 18:09:05 +03:00
Laurent Pinchart
9cff4b757a test: yaml-parser: Replace "object" with "node"
Now that the storage class for the property tree storing data parsed
from YAML has been renamed from YamlObject to ValueNode, rename
variables and update error messages accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com>
2026-04-24 18:09:03 +03:00
Laurent Pinchart
9c4e8f0b6c test: yaml-parser: Fix typos in error messages
The unit test contains a few typos in error messages. Fix them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-24 18:09:02 +03:00
Laurent Pinchart
0561f9abb9 test: yaml-parser: Standardize on explicitly qualifying std namespace
yaml-parser.cpp mixes unqualified and qualified identifier in the std
namespace. Standardize on qualified identifiers, and drop the
"using namespace std" statement.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
2026-04-24 18:09:00 +03:00