Commit graph

3996 commits

Author SHA1 Message Date
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
Naushir Patuck
d476f5e4e2 ipa: raspberrypi: Fix sensor delays for the IMX296
The IMX296 implements a 2 frame delay for exposure, gain and vertical
blanking changes. Report this in the camera helper.

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:45 +03:00
Laurent Pinchart
036d26d667 test: threads: Test thread cleanup upon abnormal termination
If a thread ends abnormally (that is, without retuning normally from its
run() function, for instance with a direct call to pthread_cancel()),
thread cleanup should still be performed. Add a test to ensure this.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-04 17:58:00 +03:00
Laurent Pinchart
ca33225ceb libcamera: v4l2_device: List controls when setting file descriptor
The base V4L2Device class is bound to a video device node by either
open(), which opens the device node and creates a new file descriptor,
or setFd(), which takes an already open file descriptor. The former
populates the V4L2Device instance controls, while the latter doesn't.
This prevents using controls on V4L2 M2M devices. Fix it by populating
controls in setFd(), which is called by open().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
2022-10-04 17:58:00 +03:00
Laurent Pinchart
2cc5654633 test: v4l2_m2mdevice: Test control enumeration
Verify that the V4L2M2MDevice correctly enumerates controls supported by
the device. The test currently fails, and will be fixed by a subsequent
patch.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Xavier Roumegue <xavier.roumegue@oss.nxp.com>
2022-10-04 17:58:00 +03:00
Laurent Pinchart
dbd937e375 qcam: Fix YUV planar fragment shaders
Commit 251f0534b7 ("qcam: viewfinder_gl: Take color space into account
for YUV rendering") introduced compilation failures in the YUV
semi-planar and planar fragment shaders due to a bad copy & paste. Fix
it.

Fixes: 251f0534b7 ("qcam: viewfinder_gl: Take color space into account for YUV rendering")
Reported-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-10-04 12:04:53 +03:00
Kieran Bingham
351abecdb9 ipa: ipu3: Correct context during configure()
The introduction of the FCQueue in the IPU3 inadvertently introduced a
bug which cleared the initialisation of the session configuration
immediately after some parameters had been set.

Furthermore, it cleared and never re-initialised the sensor line
duration property, which was previously only set during the call to
init().

Move the clearing of the contexts from the updateSessionConfiguration()
call to the earliest opportunity in configure(), and immediately
re-initialise the sensor parameters.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=151
Fixes: 85c5c47325 ("ipa: ipu3: Use the FCQueue")
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-10-03 03:58:34 +03:00
Laurent Pinchart
79f0fc937d ipa: rkisp1: Remove initialized_ flags from algorithms
Multiple algorithms have an initialized_ flag that they set to true at
the end of the init() function, and check at the beginning of prepare()
to skip preparation. This serves no real purpose, as the flag can only
be false if init() fails, in which case the IPA module initialization as
a whole will fail.

Drop the initialized_ flags.

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-01 00:01:56 +03:00
David Plowman
c97cf467ea py: Support controls that are ControlTypeNone
Such controls can now be created when a control doesn't have a
reasonable or obvious default value. We support them using Python's
"None" value, rather than generating a runtime error.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Christian Rauch <Rauch.Christian@gmx.de>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-09-30 23:12:05 +03:00
Laurent Pinchart
daec83536d utils: rkisp1: gen-csc-table: Add support for inverting the CSC
Add a -i/--invert command line argument to invert the YCbCr encoding and
output a YCbCr to RGB matrix.

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-09-30 22:30:17 +03:00
Laurent Pinchart
0cd715c4de cam: kms_sink: Add color space support
KMS defines YCbCr encoding and quantization properties for planes. When
supported by the device, set them to match the color space of the
stream to render colors accurately.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Eric Curtin <ecurtin@redhat.com>
2022-09-30 22:00:13 +03:00
Laurent Pinchart
1d54f8d0a2 libcamera: Add missing SPDX headers for miscellaneous CC0-1.0 contents
Miscellaneous files that are not considered copyrightable are missing an
SPDX-License-Identifier header. Fix this by adding a header listing the
CC0-1.0 license.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-09-30 21:51:23 +03:00
Laurent Pinchart
3440740ff3 utils: raspberrypi: Add missing SPDX header to delayedctrls_parse.py
The delayedctrls_parse.py script is missing license information. Add an
SPDX header to fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-09-30 21:51:20 +03:00
Laurent Pinchart
eff6874e62 android: Add missing SPDX headers to Android headers
Most headers imported from Android have an SPDX tag (added manually in
commit 190bebef08), but four headers that have been imported more
recently are missing license identifiers. Fix them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-09-30 21:51:18 +03:00
Laurent Pinchart
b4e31a88d3 Documentation: theme: Specify license of search.png
The search.png icon is derived from the magnifying glass icon used by
most websites, which comes from Font Awesome. Specify its license and
attribution in dep5, as PNG files can't contain SPDX headers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-09-30 21:51:14 +03:00
Laurent Pinchart
930b4927ac Documentation: Add missing SPDX headers
Two documentation files are missing SPDX headers. Add them, with the
CC-BY-SA-4.0 license that covers all the libcamera documentation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-09-30 21:50:56 +03:00
Umang Jain
ed591e705c libcamera: v4l2_device: Log control id instead of errorIdx
v4l2_ext_controls.errorIdx (in the case of single failing control for
VIDIOC_*_EXT_CTRLS calls) represents the index of that control.
Since it is a single control, we can print the control id rather than
its index. This improves logging as the id can be easily co-related
with the controls while reading the log.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-09-29 11:04:14 +05:30
Laurent Pinchart
aafad4d0ca cam: drm: Skip DRM devices not capable of mode setting
The DRM helper picks the first DRM card that it can open. On platforms
that have a standalone GPU, this risks selecting a device corresponding
to the GPU instead of the display controller. Fix this by skipping
devices that don't support the KMS mode setting API. Some legacy display
controllers would be skipped as well, but libcamera doesn't run on those
systems anyway.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Eric Curtin <ecurtin@redhat.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-09-28 16:38:58 +03:00
Laurent Pinchart
2f1efe50a9 ipa: rkisp1: awb: Remove bias from gain calculation
The red and blue gains are computed by dividing the green mean by the
red and blue means respectively. An offset of 1 is added to the dividers
to avoid divisions by zero. This introduces a bias in the gain values.
Fix it by clamping the divisors to a minimum of 1.0 instead of adding an
offset.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-09-28 05:41:15 +03:00