Commit graph

4397 commits

Author SHA1 Message Date
Naushir Patuck
7802471a3b pipeline: rpi: Account for Bayer packing when validating format
RPiCameraConfiguration::validate() did not account for user supplied
Bayer packing when validating the RAW stream configuration. Fix this
by seeing what packing (if any) has been specified selecting the output
RAW stream format.

Fixes: 6c71ee1f15 ("pipeline: raspberrypi: Introduce PipelineHandlerBase class")
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-07-07 11:39:34 +03:00
Jai Luthra
954ba8a803 libcamera: pipeline: simple: Support TI CSI-RX
New TI SoCs from J7 and AM62 family have a camera pipeline that receives
data using Cadence's DPHY-RX and CSI-RX bridge. A pixel-grabbing "shim"
IP routes this incoming stream of data to the DMA subsystem, to finally
store the frame data in memory.

The driver for this is not merged in mainline yet, but v7 was posted [1]
on linux-media list a few months ago.

With some minor fixes, the work-in-progress v8 series [2] works with the
simple pipeline handler, so we enable support for this device.

Link: https://lore.kernel.org/all/20230314115516.667-1-vaishnav.a@ti.com/ [1]
Link: 6ff226ca13 [2]
Signed-off-by: Jai Luthra <j-luthra@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-07-07 11:39:34 +03:00
Laurent Pinchart
d314d3b98b libcamera: Add option to configure udev support
libcamera uses udev to support hotplug (and unplug) detection. This is
an optional feature, which gets selected automatically if udev is
available. Users may however want to build libcamera without hotplug
detection, even if udev is available on the system. Add a new feature
option to control udev support. The default value is auto, which retains
the existing behaviour.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-07 11:39:32 +03:00
Laurent Pinchart
ca437b4a0c meson: Fix space around colon issues
The meson style, which libcamera follows, recommends a space before
colons in function parameters. Fix the style violations through the
project.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2023-07-07 11:39:19 +03:00
Umang Jain
adb1bbb748 tests: gstreamer: Test cameras' enumeration from GstDeviceProvider
Test the enumeration of the cameras through GstDeviceProvider against
the libcamera camera manager.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2023-07-06 10:05:27 +02:00
Laurent Pinchart
d06ed87d49 utils: checkstyle: Add trailers checker
The libcamera git history contains numerous examples of incorrect commit
message trailers due to invalid trailer types (e.g. Change-Id), typos
and other small issues. Those went unnoticed through reviews, which
shows that an automated checker is required.

Add a trailers checker to checkstyle.py to catch invalid or malformed
trailers, with a set of supported trailers that match libcamera's commit
message practices. New trailer keys can easily be added later as new
needs arise.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-05 17:11:26 +03:00
Laurent Pinchart
925ee0ac8e utils: checkstyle: Don't include commit ID in commit title
The commit title and commit ID are two different pieces of information.
Don't include the latter in the former, to simplify code that only needs
the commit title. Constructing a string from the ID and title is easier
than splitting the combined string back into its elements.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-05 15:39:02 +03:00
Laurent Pinchart
69e3983acf utils: checkstyle: Support running checkers selectively
During development of the checkstyle.py script, it can be useful to run
only a subset of the checker. Add the ability to do so with a
'--checkers' command line argument.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-05 15:39:00 +03:00
Laurent Pinchart
c9b2f62edd utils: checkstyle: Add __repr__ method to CommitFile class
Add a custom representation to the CommitFile class in order to
facilitate debugging.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-05 15:39:00 +03:00
Laurent Pinchart
52579639ce apps: Add ipa-verify application
When packaging libcamera, distributions may break IPA module signatures
if the packaging process strips binaries. This can be fixed by resigning
the modules, but the process is error-prone.

Add a command line ipa-verify utility that tests the signature on an IPA
module to help packagers. The tool takes a single argument, the path to
an IPA module shared object, and expects the signature file (.sign) to
be in the same directory.

In order to access the public key needed for signature verification, add
a static function to the IPAManager class. As the class is internal to
libcamera, this doesn't affect the public API.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Javier Martinez Canillas <javierm@redhat.com>
2023-07-05 15:38:59 +03:00
Laurent Pinchart
1d5a072c5e Documentation: Add predefined macros from config.h to Doxyfile
libcamera creates a config.h file with predefined macros, and instructs
the compiler to include it implicitly with the -include argument.
Doxygen has no support for implicit inclusion of headers, but has a
PREDEFINED configuration option for its preprocessor that lists
predefined macros. Populate it with the values from the config_h
configuration data object that is used for generate the config.h file,
to ensure that documentation matches the configuration options libcamera
has been built with.

Bump the minimum meson version to 0.57 to use cfg_data.keys().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-05 15:38:55 +03:00
Hans de Goede
c49958d0b4 utils: ipu3-capture.sh: Fix the script to work with recent media-ctl versions
Recent media-ctl versions include the framerate in the fmt property output:

- entity 37: ov5693 4-0036 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev6
	pad0: Source
		[fmt:SBGGR10_1X10/2592x1944@1/30
		 crop.bounds:(16,6)/2592x1944
		 crop:(16,6)/2592x1944]
		-> "ipu3-csi2 1":0 [ENABLED]

This resulted in $sensor_size getting set to: "2592x1944@1 30", which
causes the script to fail.

Fix this by:

1. Replacing the gsub() to remove the '/' between e.g. SBGGR10_1X10
and 2592x1944 with a sub() so that only that first '/' gets replaced
(resulting in a $sensor_size of "2592x1944@1/30" instead).

2. Adding a new sub() to remove the @1/30 suffix.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-05 00:51:34 +01:00
Barnabás Pőcze
26a4b83d1b libcamera: Remove StreamRoles alias
Now that `Camera::generateConfiguration()` takes a `libcamera::Span`
of `StreamRole`, remove the `StreamRoles` type, which was an alias
to `std::vector<libcamera::StreamRole>`.

The removal has two reasons:
 - it is no longer strictly necessary,
 - its presence may suggest that that is the preferred (or correct)
   way to build/pass a list of `StreamRole`.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
[Kieran: Fix small checkstyle report on roles initialiser]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-04 22:56:38 +01:00
Barnabás Pőcze
86fa7300fa libcamera: camera: Take span of StreamRole instead of vector
Change the parameter type of `generateConfiguration()` from `const std::vector&`
to `libcamera::Span`. A span is almost always preferable to a const vector ref
because it does not force dynamic allocation when none are needed, and it allows
any contiguous container to be used.

A new overload is added that accepts an initializer list so that

  cam->generateConfiguration({ ... })

keeps working.

There is no API break since a span can be constructed from a vector
and the initializer list overload takes care of the initializer lists,
but this change causes an ABI break.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Kieran: Apply checkstyle fixups]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-04 22:48:30 +01:00
Kieran Bingham
8da938b007 meson: Use x.y soname versioning
Now that we identify ABI breakages, provide incremental releases which
can support backwards compatible linkage across release points that have
a compatible ABI.

Introduction of this commit does not convey that libcamera now has a
stable API, but that patch releases with a common minor number
(0.minor.patch) may potentially be used by applications without
recompilation and linkage against new releases.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-04 20:25:10 +01:00
Kieran Bingham
bbb77cc59b utils: ABI Compatibility checker
Provide support to compare ABI compatibility between any two git commits
or by a commit and the most recent ancestral tag of that commit.

Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-04 20:25:10 +01:00
Kieran Bingham
63966ae587 libcamera: base: Do not install private headers
Split the public and private headers from the base library and stop installing
private headers as part of the install process.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-04 20:22:05 +01:00
Kieran Bingham
fae9c8f0f2 libcamera: base: Move thread_annotations to private
The libcamera thread annotations are for internal use only and are
not part of any public API. Mark the header accordingly by including the
private.h header guard.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-04 20:21:25 +01:00
Umang Jain
e6b6a6d42e gstreamer: Drop libcamera_private dependency
Drop libcamera_private dependency entirely as to avoid libcamerasrc
getting more dependent on it. In order to achieve that, one of the
mutex locks in GstLibcameraSrcState needs to be replaced with GMutex.

However doing so, this won't let us to use the clang's thread annotation
macros in libcamera (which should be fine as libcamerasrc would move
out of libcamera repo once matured).

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2023-06-28 23:23:13 +02:00
Naushir Patuck
1f607da926 libcamera: meson: Allow PH to change libcamera_deps
Pipeline handlers can have custom dependencies.

Allow each pipeline handler subdir to add them to libcamera_deps[].

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-19 11:31:36 +01:00
Naushir Patuck
0d1e402e1b pipeline: rpi: Do not return an error from pipeline config file handling
If a user provided pipeline config file is not present, or if the
version reported in the file is invalid, do not return with an error
when creating the pipeline handler. Instead, log a warning message and
return success with default pipeline config values used.

This now matches the behaviour when the pipeline config file could not
be parsed correctly, and we revert to default values.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2023-06-19 11:31:16 +01:00
Naushir Patuck
618b9aaa17 ipa: rpi: agc: Do not switch to a default if a mode is unavailable
In commit 0ee9339331, a default metering/exposure/constraint mode is
used if a control sets a mode that is not listed in the camera tuning
file.

Setting a default mode may be undesirable in these cases, so instead
keep the agc mode unchanged. This also matches the behaviour for other
IPA controls where no changes are made in error conditions.

Fixes: 0ee9339331 ("ipa: rpi: agc: Gracefully handle missing agc modes")
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2023-06-19 11:31:10 +01:00
Jacopo Mondi
9c666075f3 libcamera: camera_sensor: Adjust properties::Rotation
As the CameraSensor::validateTransform() function compensate
for the sensor's mounting rotation, the properties::Rotation value
should be adjusted to make sure application that receive already
"corrected" images do not get confused by Rotation still reporting
a value.

Howerver, as an image sensor can only compensate rotations by applying
H/V flips, only correct Rotation when the mounting rotation is 180
degrees.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2023-06-19 10:58:12 +02:00
Cedric Nugteren
5a142438b0 gstreamer: Add enable_auto_focus option to the GStreamer plugin
Cameras such as the PiCam 3 support auto-focus, but the GStreamer plugin
for libcamera does not enable auto-focus. With this patch auto-focus can
be enabled for cameras that support it. By default it is disabled, which
means default behaviour remains unchanged. For cameras that do not
support auto-focus, an error message shows up if auto-focus is enabled.

This was tested on cameras that do not support auto-focus (e.g. PiCam2)
and was tested on a camera that does support auto-focus (PiCam3). The
test involved setting the focus to AfModeContinous and observing it.
However, by not setting "auto-focus-mode" or using AfModeManual as
the "auto-focus-mode" both resulting in auto-focus being disabled.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=188
Signed-off-by: Cedric Nugteren <cedric@plumerai.com>
Reviewed-by: Maarten Lankhorst <dev@lankhorst.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2023-06-18 17:44:29 +05:30
Kieran Bingham
b9113a8626 libcamera: pipeline: Register device numbers with camera
Register the identified device numbers with each camera as the
SystemDevices property.

This facilitates camera daemons or other systems to identify which
devices are being managed by libcamera, and can prevent duplication of
camera resources.

As the SystemDevices property now provides this list of devices, use it
directly from within the CameraManager when adding a Camera rather than
passing it through the internal API.

Tested-by: Ashok Sidipotu <ashok.sidipotu@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-06-17 22:52:39 +01:00
Kieran Bingham
1de9518f51 libcamera: properties: Provide a Devices camera property
Provide a new Camera property that allows pipeline handlers to list any
kernel device used to operate the camera. This allows other frameworks
and daemons such as PipeWire to better understand the resources consumed
by a Camera and consider ignoring those resources when enumerating
camera devices on a system.

Tested-by: Ashok Sidipotu <ashok.sidipotu@collabora.com>
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>
2023-06-17 22:52:34 +01:00
Kieran Bingham
75ddd20209 libcamera: camera_manager: Move {add,remove}Camera to internal
The CameraManager exposes addCamera and removeCamera as public API
calls, while they should never be called from an application. These
calls are only expected to be used by PipelineHandlers to update the
CameraManager that a new Camera has been created and allow the Camera
Manager to expose it to applications.

Remove the public calls and update the private implementations such that
they can be used directly by the PipelineHandler through the internal
CameraManager::Private provided by the Extensible class.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Tested-by: Ashok Sidipotu <ashok.sidipotu@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-06-17 22:52:32 +01:00
Kieran Bingham
7144fe6f9c libcamera: camera_manager: Move private implementation to internal
The CameraManager makes use of the Extensible pattern to provide an
internal private implementation that is not exposed in the public API.

Move the Private declaration to an internal header to make it available
from other internal components in preperation for reducing the surface
area of the public interface of the CameraManager.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Tested-by: Ashok Sidipotu <ashok.sidipotu@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-06-17 22:52:26 +01:00
Kieran Bingham
f36c05c21e libcamera: internal: request: convert to pragma once
Remove the verbose #ifndef/#define/#endif pattern for maintaining
header idempotency, and replace it with a simple #pragma once.

This simplifies the headers, and prevents redundant changes when
header files get moved.

The internal/request.h was missed at the time of the original
conversion. Update it.

Fixes: df131ad088 ("libcamera: internal: Convert to pragma once")
Tested-by: Ashok Sidipotu <ashok.sidipotu@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-06-17 22:52:24 +01:00
Naushir Patuck
0ee9339331 ipa: rpi: agc: Gracefully handle missing agc modes
If a metering/exposure/constraint mode is not listed in the sensor
tuning file, and a control for the missing mode is set on the agc, we
terminate the application with a fatal log message.

Instead of this fatal termination, log a warning message and switch to
the appropriate default mode so that the application continues running.

Bug: https://github.com/raspberrypi/libcamera/issues/59
Bug: https://github.com/ayufan/camera-streamer/issues/67
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-06-07 20:39:32 +01:00
Naushir Patuck
5242b78c0b ipa: rpi: agc: Use std::string instead of char arrays
Replace the char array strings in struct AgcStatus with std::string
objects. This simplifies the string handling in the source code.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-06-07 20:31:02 +01:00
Naushir Patuck
c6ff999053 ipa: rpi: tunings: Add missing short and long exposure profiles
Some sensor tuning files were missing the short and/or long exposure
mode profiles. Add the missing items to the relevant files.

As a drive-by, rename the "sport" exposure profile to "short" for the
IMX290 tuning.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-06-07 20:30:05 +01:00
Jacopo Mondi
e58121cfc1 libcamera: rkisp1: Fix enumeration of RAW formats
The current implementation enumerates a single RAW format (the sensor's
resolution) and does that regardless of what role the
CameraConfiguration has been generated for.

Fix this by:
- Enumerate RAW StreamFormats only when the requested role is
  StreamRole::Raw
- Add all the sensor's provided resolutions that fit the video device
  output maximum size

Before this patch, a single RAW size was enumerated in stream formats

 * Pixelformat: SRGGB10 (4208x3120)-(4208x3120)/(+1,+1)
  - 4208x3120

With this patch applied all sensor's supported resolutions are
enumerated but only when the stream role RAW is explicitly requested

 * Pixelformat: SRGGB10 (1048x780)-(4208x3120)/(+0,+0)
  - 1048x780
  - 2104x1560
  - 4032x3024
  - 4208x3120

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2023-06-06 18:59:26 +02:00
Jacopo Mondi
d45da036a4 libcamera: rkisp1: Assign sizes to roles
Currently each RkISP1 path (main and self) generate a configuration
by bounding the sensor's resolution to their respective maximum output
aspect ratio and size.

	Size maxResolution = maxResolution_.boundedToAspectRatio(resolution)
					   .boundedTo(resolution);

In the case of self path, whose maximum size is 1920x1920, the generated
configuration could get assigned unusual sizes, as the result of the
above operation.

As an example, with the imx258 sensor whose resolution is 4208x3118, the
resulting size for the Viewfinder use case is an unusual 1920x1423.

Fix this by assigning to each role a desired output size:
- Use the sensor's resolution for StillCapture and Raw
- Use 1080p for Viewfinder and VideoRecording

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-06 18:59:26 +02:00
Jacopo Mondi
311e5bc1a8 libcamera: rkisp1: Crop on ISP before downscaling
Crop on the resizer sink pad before downscaling to the aspect ratio
of the desired output size.

Cropping the input frame to the output aspect ratio allows to maintain
the correct picture proportions, as otherwise downscaling would change
the image geometry.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2023-06-06 18:59:26 +02:00
Jacopo Mondi
c6124d757c libcamera: rkisp1: Generate config using main path
The generateConfiguration() implementation in the Rockchip RkISP1
pipeline handler uses by default the self path (if available) for
the Viewfinder and VideoRecording StreamRoles.

The validate() implementation, at the contrary, prefers using the main
path, when available, for all streams.

As the self-path is limited in output resolution to 1920x1920,
generating a configuration using the self path limits the maximum
stream size to 1920x1920, while higher resolutions can be obtained by
using the main path.

Align the generateConfiguration() implementation to the validate() one
by using the main path by default if available.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=180
Reported-by: libcamera@luigi311.com
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-06 18:59:25 +02:00
Naushir Patuck
fab47108e1 ipa: rpi: Set lens position to hyperfocal on startup
On the first ipa->configure() call, set the lens position (if a lens is
present) to the default position. Typically this would be the hyperfocal
position based on the tuning data.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-06 18:22:20 +03:00
Naushir Patuck
d66ff77759 pipeline: ipa: rpi: Return lens controls from ipa->configure()
In addition to sensor controls, return lens controls from
IpaBase::configure() back to the pipeline handler. If there are lens
controls present in the ControlList, action them in the pipeline handler
as part of the configure routine.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-06 18:21:00 +03:00
Naushir Patuck
bdba31cc02 libcamera: controls: Define a default lens position behaviour
Update the AfMode control description to explicitly define a
startup/default behaviour.

On startup, the camera will move the lens to the position given by the
default value of the LensPosition control if operating in manual focus
mode. Typically this would be the hyperfocal position of the lens.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-06 18:19:51 +03:00
Jacopo Mondi
ea93e7899f ipa: rkisp1: agc: Restore minimum analogue gain limit
Commit a3178dd039 ("ipa: rkisp1: agc: drop hard-coded analogue gain range")
removed both minimum and maximum limits for the analogue gain value.

However, as some sensors can potentially have a minimum gain lower than
1.0, restore the check for the minimum limit.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-06 18:17:35 +03:00
Jacopo Mondi
db86713ec1 ipa: ipu3: agc: Drop hard-codec analogue gain max
As the sensor's analogue gain range is known, drop the arbitrary
maximum limit for the sensor analogue gain.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
Tested-by: Daniel Scally <dan.scally@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-06 18:17:35 +03:00
Benjamin Bara
0a37c203da libipa: camera_sensor_helper: Restore alphabetical order
The addition of the CameraSensorHelperImx327 class was not correctly
inserted in alphabetical sort order.

Move it to the correct location.

Fixes: 7d5b38e2ef ("libipa: camera_sensor_helper: Add IMX327 helper")
Reported-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-06 18:14:37 +03:00
Laurent Pinchart
f65a73f3c8 libcamera: controls: Drop reference to IPA in controls documentation
The controls relates to the public API, which doesn't expose IPA modules
as they are internal to libcamera. Replace the mention of "IPA" in the
controls documentation.

While at it, fix a small text reflow issue.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-06-05 20:00:02 +03:00
Naushir Patuck
a0271e72a8 ipa: rpi: Handle controls for mono variant sensors
Do not advertise colour related controls (i.e. [A]WB, colour saturation)
in the ControlInfoMap of available controls returned out to the
application.

Silently ignore these controls in the control handler in case applications
don't use the advertised ControlInfoMap to validate controls.

As a drive-by fix, don't advertise controls::ColourCorrectionMatrix in
the ControlInfoMap as it is not handled by the IPA.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-05 11:40:31 +03:00
Naushir Patuck
54340ef70f camera_sensor: ipa: core: Add CFA pattern to IPACameraSensorInfo
Add a new cfaPattern field to the IPACameraSensorInfo to pass the
CFA/Bayer pattern for the current sensor configuration to the IPA.
This field takes a value from properties::draft::ColorFilterArrangementEnum.

Populate cfaPattern in CameraSensor::sensorInfo(), called by the
pipeline handler before it calls ipa->init() and ipa->config().

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-05 11:40:25 +03:00
Tomi Valkeinen
f44df6f4fa py: unittests.py: Fix type checker warnings
Fix type checker warnings by dropping unused imports and using _ for
variable names that are not used.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-04 16:10:51 +03:00
Tomi Valkeinen
a1f0556a46 py: Fix code formatting
Fix code formatting.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-04 12:25:35 +03:00
Tomi Valkeinen
f513fd70ba subprojects: Drop leftovers of pybind11
The pybind11 subproject was removed in commit ad4719c10c ("py: Move to
mainline pybind11 version"), but two traces remained, one in .gitignore
and a second one as a meson.build for pybind11. Remove them.

Fixes: ad4719c10c ("py: Move to mainline pybind11 version")
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-04 11:48:00 +03:00
Naushir Patuck
49fd9e52f4 ipa: rpi: imx296: Small refinements to the IMX296 mono sensor tuning
Update the noise profile and reference lux level with newly taken
calibration pictures. Remove GEQ/cross-talk processing block as this is
a mono sensor.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-06-02 07:40:37 +03:00
Tomi Valkeinen
ad4719c10c py: Move to mainline pybind11 version
We are using pybind11 'smart_holder' branch to solve the Camera
destructor issue (see the comment in this patch, or the commit
that originally added Python bindings support).

As it would be very nice to use the mainline pybind11 (which is packaged
in distributions), this patch adds a workaround allowing us to move to
the mainline pybind11 version.

The workaround is simply creating a custom holder class
(PyCameraSmartPtr), used only for the Camera, which wraps around the
shared_ptr. This makes the compiler happy.

Moving to mainline pybind11 is achieved with:

- Change the pybind11 wrap to point to the mainline pybdind11 version

- Tell pybind11 to always use shared_ptr<> as the holder for
  PyCameraManager, as we use the singleton pattern for the
  PyCameraManager, and using shared_ptr<> to manage it is a requirement

- Tell pybind11 to always use PyCameraSmartPtr<> as the holder for Camera

- Change the meson.build file to use a system-installed pybind11

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-05-31 19:48:02 +03:00