Commit graph

4214 commits

Author SHA1 Message Date
Paul Elder
207c9e1c1d utils: ipc: Add support for Flags
Add Flags<E> as a supported type in the IPA interface.

It is used in mojom with the [flags] attribute. Any field or parameter
type E that is prefixed with the [flags] attribute will direct the code
generator to generate the type name "Flags<E>" and appropriate
serialization/deserialization code for Flags<E> instead of for E.

It is usable and has been tested in struct members, function input and
output parameters, and Signal parameters. This does not add support for
returning Flags as direct return values.

Additionally, the [scopedEnum] attribute can be used on enum
definitions, which will instruct the code generator to convert it to an
enum class instead of a raw enum.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-18 18:51:33 +09:00
Paul Elder
fc6b5f49e1 libcamera: ipa_data_serializer: Add serializer for Flags
Implement an IPADataSerializer for Flags.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-18 18:51:25 +09:00
Paul Elder
3f9da2a71e utils: ipc: Add support for enums in function parameters
There is already support for enums as struct members, but there was no
support for enums in function parameters. Add it.

This does not add support for returning enums as direct return values.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-18 18:51:21 +09:00
Paul Elder
44eb16fb18 test: generated_serializer: Test enum that is struct member
Add an enum field to the test struct member to test
serialization/deserialization of enums that are struct members.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-18 18:51:17 +09:00
Naushir Patuck
eb02e62e6f ipa: raspberrypi: Extract line length from the embedded data parser
Update the imx219, imx477 and imx519 parsers to extract the line length
values from the embedded data stream and use these values in the
deviceStatus metadata, replacing the DelayedControls provided values.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-18 03:10:13 +03:00
Naushir Patuck
cb4c5f3e44 ipa: raspberrypi: Allow full line length control
Rename CamHelper::getVBlanking to CamHelper::getBlanking, and update the
calculations in that function to return both horizontal and vertical
blanking values for a given exposure time and frame duration limits. The
calculations are setup such that vertical blanking is extended to the
maximum allowable value, and any remainder gets put into horizontal
blanking.

The calculated horizontal blanking value is now returned to the pipeline
handler to pass into DelayedControls to program into the sensor.

Update the IPA to now specify the maximum frame duration from the
maximum horizontal + vertical blanking values provided by the sensor
mode. Additionally, the IPA now uses the frame specific horizontal
blanking value (as returned by DelayedControls) in all instances.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-18 03:10:08 +03:00
Naushir Patuck
dd667e3864 ipa: raspberrypi: Add line length to DeviceStatus
Add a lineLength field to the DeviceStatus structure to store the line
length used for a particular frame.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-18 03:10:05 +03:00
Naushir Patuck
51ac3e2671 ipa: raspberrypi: Add line length calculations helper functions
Add CamHelper::hblankToLineLength() to calculate the line length
duration from the horizontal blanking (in pixels) value.

Add CamHelper::lineLengthToHblank() to calculate the horizontal blanking
(in pixels) value from the line length duration.

Add CamHelper::lineLengthPckToDuration() to calculate the line length
duration from the line length in pixels.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-18 03:10:00 +03:00
Naushir Patuck
5661c934ec ipa: raspberrypi: Add pixel clock rate to the CameraMode structure
The pixel clock rate will be used in subsequent commits to calculate
line length durations.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-18 03:09:57 +03:00
Naushir Patuck
aa2fe6a86f pipeline: ipa: raspberrypi: Add HBLANK control to DelayedControls
Update CamHelper::getDelays() to return the sensor HBLANK delay. The
HBLANK delay is set to the same value as VBLANK delay for all sensors in
the Raspberry Pi IPA.

Return the HBLANK gain delay from the IPA to the pipeline handler, and
initialise DelayedControls to handle V4L2_CID_HBLANK with this delay
value.

As a drive-by, check that the V4L2_CID_HBLANK control is available when
calling IPARPi::configure().

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-18 03:09:52 +03:00
Naushir Patuck
f694da76be ipa: raspberrypi: Remove initialized_ field from CamHelper
Given that the single user of the CamHelper is the Raspberry Pi IPA, the
initialized_ field check is unnecessary. Remove the check and the field.

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>
2022-10-18 03:09:48 +03:00
Naushir Patuck
f9c490ab25 ipa: raspberrypi: Pass lineLength into the CamHelper API
Update CamHelper::exposureLines() and CamHelper::exposure() to take a
line length duration parameter for use in the exposure calculations.

For now, only use the minimum line length for all the calculations to
match the existing IPA behavior.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-18 03:09:44 +03:00
Naushir Patuck
c513522f3f ipa: raspberrypi: Add minimum and maximum line length fields to CameraMode
Add fields for minimum and maximum line length duration to the
CameraMode structure. This replaces the existing lineLength field.

Any use of the existing lineLength field is replaced by the new
minLineLength field, as logically we always want to use the fastest
sensor readout by default.

As a drive-by cosmetic change, split all fields in the CameraMode
structure into separate lines.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-18 03:09:38 +03:00
Naushir Patuck
e5fc0132f8 camera_sensor: Add minimum and maximum line length to IPACameraSensorInfo
Add fields for minimum and maximum line length (in units of pixels) to
the IPACameraSensorInfo structure. This replaces the existing lineLength
field.

Update the ipu3, raspberrypi and rkisp1 IPAs to use
IPACameraSensorInfo::minLineLength instead of
IPACameraSensorInfo::lineLength, as logically we will always want to use
the fastest sensor readout by default.

Since the IPAs now use minLineLength for their calculations, set the
starting value of the V4L2_CID_HBLANK control to its minimum in
CameraSensor::init().

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-18 03:09:06 +03:00
Jean-Michel Hautbois via libcamera-devel
ae7809307e qcam: dng: Make TIFFTAG_CFAPATTERN variable count
Since libtiff version 20201219, the CFAPATTERN tag is using a variable
count and not the fixed 4 values size.
For reference, the commit introducing this is:

	commit 2eb5a954cb7b7ad61559da00743c4b0e2fce34d0
	Author: Sam Hasinoff <hasinoff@google.com>
	Date:   Sun Mar 8 21:23:16 2020 +0100
	Make TIFFTAG_CFAPATTERN variable count

Add a version check in the DNGWriter::write function when this tag is
written as this breaks the raw capture in qcam.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2022-10-17 20:40:14 +09:00
Xavier Roumegue
f4201e9636 libcamera: v4l2_subdevice: Add JPEG_1X8 and BGR888_1X24 mbus formats to formatInfoMap
The warnings "Unknown subdev format 0x4001, defaulting to RGB encoding" and
"Unknown subdev format 0x1013, defaulting to RGB encoding" are thrown while using
simple pipeline handler with NXP ISI hardware.
The JPEG_1X8 and BGR888_1X24 media bus formats, supported by the ISI driver, are
missing in the V4L2SubdeviceFormatInfo structure storing the correspondence
between a media bus format and a colour encoding. So populate the structure with
the missing media bus formats.

Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-15 19:59:12 +03:00
Kieran Bingham
a83aed77df libcamera v0.0.1
This patch release commences the package release procedures for the
project.

Initial releases will include a bump to the patch (0.0.x) version
number, as well as a corresponding increment to the soname.

Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-14 14:48:46 +01:00
Kieran Bingham
fc46d09123 utils: Provide a release script
Support making releases of libcamera by introducing a helper script
which will facilitate the increment of any release version, along with
generating an associated tag.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-13 12:40:24 +01:00
Kieran Bingham
1bd14fc895 utils: semver: Add version helper
Provide the semver utility (version 3.4.0) from [0] to make use of it
with our versioning and release scripts.

[0] https://raw.githubusercontent.com/fsaintjacques/semver-tool/3c76a6f9d113f4045f693845131185611a62162e/src/semver

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-13 12:40:23 +01:00
Kieran Bingham
0aac297afd meson: Shared Object version handling
The libcamera project is not yet ready to declare ABI nor API stability,
but it will benefit the community to be able to provide more regular
release cycles to determine 'versioned' points of history.

Ideally, these releases will be made at any ABI breakage, but can be
made at arbitary time based points along the way.

To support releases which may not be ABI stable, declare the soversion
of both the libcamera and libcamera-base library to be dependant upon
both the major minor and patch component of the project version.

As part of this, introduce a new 'Versions' summary section to highlight
the different version components that may become apparent within any
given build.

Bumping versions may leave dangling libcamera.so.* symlinks in build
directories. This will confuse Doxygen which will print during its
directory scanning phase a warning that the symlink can't be read. As we
don't need Doxygen to follow symlinks, disable it with EXCLUDE_SYMLINKS.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-13 12:40:23 +01:00
Kieran Bingham
cfe30ec54f meson: Fix typo
The comment for supporting the custom script on 'make dist' contains a
typo. Fix it.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-13 12:40:23 +01:00
Laurent Pinchart
8108ba3202 libcamera: v4l2_videodevice: Warn if bytesused == 0 when queuing output buffer
V4L2 has deprecated queuing output buffers with bytesused set to 0. Warn
if the caller attempts to do so.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
2022-10-10 17:49:54 +03:00
Laurent Pinchart
87f507bbf2 pipeline: rkisp1: Set bytesused before queuing parameters buffer
The bytesused value for the parameters buffer is initialized to 0 and
never set. The V4L2 API specification indicates that, for an output
video device, the driver will set the bytesused value to the size of the
plane in that case. The videobuf2 framework does so, but considers this
as deprecated and prints a warning:

[   54.375534] use of bytesused == 0 is deprecated and will be removed in the future,
[   54.388026] use the actual size instead.

Fix it by setting bytesused to the correct value before queuing the
parameters buffer.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
2022-10-10 17:49:53 +03:00
Laurent Pinchart
3338958822 pipeline: ipu3: Set bytesused before queuing parameters buffer
The bytesused value for the parameters buffer is initialized to 0 and
never set. The V4L2 API specification indicates that, for an output
video device, the driver will set the bytesused value to the size of the
plane in that case. The videobuf2 framework does so, but considers this
as deprecated and prints a warning:

[   54.375534] use of bytesused == 0 is deprecated and will be removed in the future,
[   54.388026] use the actual size instead.

Fix it by setting bytesused to the correct value before queuing the
parameters buffer.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
2022-10-10 17:49:53 +03:00
Laurent Pinchart
c20d3f5575 libcamera: framebuffer: Move remaining private data to Private class
Private members of the FrameBuffer class are split between FrameBuffer
and FrameBuffer::Private. There was no real justification for this
split, and keeping some members private in the FrameBuffer class causes
multiple issues:

- Future modifications of the FrameBuffer class without breaking the ABI
  may be more difficult.
- Mutable access to members that should not be modified by applications
  require a friend statement, or going through the Private class.

Move all remaining private members to the Private class to address the
first issue, and add a Private::metadata() function to address the
second problem.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
2022-10-10 17:49:49 +03:00
Laurent Pinchart
e0e54965df libcamera: base: utils: Drop defopt
utils::defopt causes compilation issues on gcc 8.0.0 to gcc 8.3.0,
likely due to bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86521
that was fixed in gcc 8.4.0. gcc 8.3.0 may be considered old (libcamera
requires gcc-8 or newer), but it is shipped by Debian 10 that has LTS
support until mid-2024.

As no workaround has been found to fix compilation on gcc 8.3.0 while
still retaining the functionality of utils::defopt, remove it from the
libcamera base library. This change could be reverted once support for
gcc-8 will be dropped.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-10 17:04:29 +03:00
Laurent Pinchart
603a4d60f6 ipa: rkisp1: Drop use of utils::defopt
utils::defopt causes compilation issues on gcc 8.0.0 to gcc 8.3.0,
likely due to bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86521
that was fixed in gcc 8.4.0. gcc 8.3.0 may be considered old (libcamera
requires gcc-8 or newer), but it is shipped by Debian 10 that has LTS
support until mid-2024.

As no workaround has been found to fix compilation on gcc 8.3.0 while
still retaining the functionality of utils::defopt, stop using it in the
RkISP1 IPA module.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-10 17:04:12 +03:00
Laurent Pinchart
4bf68fdbe1 ipa: raspberrypi: Remove unneeded Span casts
Commit 09c1b081ba ("libcamera: controls: Generate and use fixed-sized
Span types") added explicit Span casts for fixed extent spans that were
required due to the ControlList::set() function that takes an
std::initializer_list not being able to infer a control size from
template arguments. This has now been fixed, so the casts are not needed
anymore. Drop them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Christian Rauch <Rauch.Christian@gmx.de>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-07 18:28:21 +03:00
Laurent Pinchart
f9c28992a9 libcamera: controls: Construct Span with size for array controls
The ControlList::set() function overload used for array controls
constructs a Span from an initializer list. It doesn't specify the Span
size explicitly, which results in a dynamic extent Span being
constructed. That causes a compilation failure for fixed-size array
controls, as they are defined as Control<T> with T being a fixed-extent
Span, and conversion from a dynamic-extent to fixed-extent Span when
calling ControlValue::set() can't be implicit.

Fix this by constructing the Span using the size of the control, which
resolves to a fixed-extent and dynamic-extent Span for fixed-size and
dynamic-size array controls respectively. The ControlList::set()
function that takes an initializer list can then be used for fixed-size
array controls.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-07 18:28:13 +03:00
Laurent Pinchart
22ab0b4193 utils: gen-controls: Improve YAML notation for variable-size array controls
Array controls specify the array size through the YAML 'size' element,
which stores a list of values, one per dimension. Variable-size arrays
currently use an empty 'size' list, which prevents describing the number
of dimensions of the array.

Improve this by using the same notation for fixed-size and variable-size
array controls. Dimensions that are not fixed are described as a string
instead of an integer, such as [n], [n,3] or [w,h]. The strings have
currently no special meaning, this may change in the future.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-07 18:28:05 +03:00
Laurent Pinchart
24f866f6a3 utils: gen-controls: Factor out YAML data handling in classes
The gen-controls.py script handles the data structure produced by the
YAML parser manually through the whole code base. Clean this up by
encapsulating it in Control and ControlEnum classes to model a control
and its enum values respectively, to decouple YAML data handling from
generation.

No functional change intended.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-07 18:27:31 +03:00
Laurent Pinchart
0bc9286eb9 libcamera: pipeline_handler: Implement factories through class templates
The REGISTER_PIPELINE_HANDLER() macro defines a class type that inherits
from the PipelineHandlerFactory class, and implements a constructor and
a createInstance() function. Replace the code generation through macro
with the C++ equivalent, a class template, as done in libipa with the
Algorithm and CameraSensorHelper factories.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-07 18:10:38 +03:00
Laurent Pinchart
ba3a1adc13 libcamera: pipeline_handler: Return unique_ptr from createInstance
Avoid naked pointer with memory allocation by returning a unique_ptr
from PipelineHandlerFactory::createInstance(), in order to increase
memory allocation safety.

This allows iterating over factories in the CameraManager and unit tests
using const pointers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-07 18:10:31 +03:00
Laurent Pinchart
5a867f312c libcamera: pipeline_handler: Make registerType() private
The PipelineHandlerFactory::registerType() function is called by the
PipelineHandlerFactory class only. Make it private.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-07 18:10:23 +03:00
Laurent Pinchart
7e38ae8a1e libcamera: pipeline_handler: Make factory create() function const
The PipelineHandlerFactory::create() function has no need to modify the
factory instance. Make it const, as well as the createInstance()
function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-07 18:10:16 +03:00
Laurent Pinchart
014698cba1 ipa: camera_sensor_helper: Implement factories through class templates
The REGISTER_CAMERA_SENSOR_HELPER() macro defines a class type that
inherits from the CameraSensorHelperFactory class, and implements a
constructor and createInstance() function. Replace the code generation
through macro with the C++ equivalent, a class template, as done by the
Algorithm factory.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-07 18:10:05 +03:00
Laurent Pinchart
9d9481188f ipa: camera_sensor_helper: Return unique_ptr from createInstance
Avoid naked pointer with memory allocation by returning a unique_ptr
from CameraSensorHelperFactory::createInstance(), in order to increase
memory allocation safety.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-07 18:02:16 +03:00
Laurent Pinchart
b4a3e6ade7 ipa: camera_sensor_helper: Make registerType() and createInstance() private
The CameraSensorHelperFactory registerType() and createInstance()
functions are called by the CameraSensorHelperFactory class only. Make
them private.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-07 18:02:06 +03:00
Laurent Pinchart
c4d39f0c31 ipa: camera_sensor_helper: Make factory createInstance() function const
The CameraSensorHelperFactory::createInstance() function has no need to
modify the factory instance. Make it const.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-07 18:01:44 +03:00
Laurent Pinchart
7465ee8e0c libcamera: camera_manager: Rename parameter to get()
The CameraManager::get() function takes a string containing the ID of
the requested camera. This is correctly documented and implemented in
the .cpp file, but the header file names the parameter 'name' instead of
'id'. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-07 17:05:44 +03:00
Laurent Pinchart
8abcce31ee test: meson: Use dictionaries instead of arrays to store test information
Tests are listed in meson.build using arrays that contain the test name
and source files at fixed positions. This isn't very readable, leading
to code using test[0], test[1] and test[2]. Replace the arrays with
dictionaries to improve readability.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-07 17:05:42 +03:00
Laurent Pinchart
2ee8faf3c8 test: Rename 't' to 'test' in meson.build
The 't' name is very short and not very explicit. Rename it to 'test'
instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-07 17:05:33 +03:00
Laurent Pinchart
c09ca91ae5 ipa: ipu3: Fix minor Doxygen issues in IPAFrameContext
The IPAFrameContext documentation has a spurious Doxygen \struct
statement that is not needed, and uses a \struct instead of a \var in
another location. Fix both issues. This doesn't cause any change in the
generated documentation.

Note that the Doxygen output for IPAFrameContext is incorrect,
documentation is missing for all members. This is caused by using "."
instead of "::" in our documentation, which we currently do because the
correct syntax produces Doxygen warnings (and still incorrect output).
See https://github.com/doxygen/doxygen/issues/9343.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-07 03:07:19 +03:00
Laurent Pinchart
8c2b092a20 test: threads: Fix link failure due to missing dependency
Commit 036d26d667 ("test: threads: Test thread cleanup upon abnormal
termination") added calls to functions provided by the pthread library
in the threads test, but didn't add the corresponding dependency. This
caused a link breakage on some platforms:

/usr/bin/ld: test/threads.p/threads.cpp.o: undefined reference to symbol 'pthread_cancel@@GLIBC_2.4'
/usr/bin/ld: /lib/arm-linux-gnueabihf/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

Fix it by adding the missing dependency.

Fixes: 036d26d667 ("test: threads: Test thread cleanup upon abnormal termination")
Reported-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2022-10-05 20:31:14 +03:00
Naushir Patuck
487989eec6 ipa: raspberrypi: Fix the imx296 mono tuning black level
The sensor black level is 60 (in 10-bits), fix this in the mono variant tuning
file.

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>
2022-10-05 15:49:19 +03:00
Naushir Patuck
0083df56f0 ipa: raspberrypi: Add a tuning file for the colour variant of IMX296
Add the tuning file (imx296.json) for the colour variant of the IMX296 sensor.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
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>
2022-10-05 15:49:19 +03:00
Naushir Patuck
820607b195 pipeline: raspberrypi: Update naming convention for tuning files
Append "_mono" to the sensor name when generating the tuning filename for
monochrome sensor variants. So the new naming convention is as follows:

<sensor_name>.json - Standard colour sensor variant
<sensor_name>_mono.json - Monochrome sensor variant

Rename the existing imx296.json file to imx296_mono.json as this tuning file
is based on the monochrome variant of the IMX296.

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>
2022-10-05 15:49:19 +03:00
Naushir Patuck
ec63095716 libcamera: bayer_format: Add unpacked mono 12-bit format to the conversion table
Add BayerFormat conversions for formats::R12 (12-bit unpacked) format.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
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>
2022-10-05 15:49:19 +03:00
David Plowman
12f4708e35 pipeline: raspberrypi: Detect monochrome "R" formats as being raw
The "R" pixel formats (R8, R10, R10_CSI2P etc.) record the associated
colour space as being YUV rather than RAW, meaning that the code was
not detecting them as being raw formats.

In the case of Raspberry Pi, we deal only with raw formats, so the
revised test must work correctly for both these and the standard Bayer
formats.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-04 22:59:37 +03:00
Naushir Patuck
e730867873 ipa: raspberrypi: Limit minimum exposure time for the IMX296
Limit the minimum allowable exposure time to a single line in the IMX296
camera helper. This equates to approximately 30us.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-04 18:38:50 +03:00