Commit graph

2951 commits

Author SHA1 Message Date
Kieran Bingham
226563607e py: Fix gen-py-control-enums.py reference
Scripts should be referenced using the meson files() directive to ensure
the location is correctly identified with the relevant paths. This
prevents compilation failures if the working directory does not match
the source tree.

Fixes: 6e92cb9dc4 ("py: Generate control enums from yaml")
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-10 21:15:22 +02:00
Naushir Patuck
c39b52c184 v4l2_videodevice: Disable the watchdog timer when no buffers are queued
Only enable/reset the watchdog timer when there are buffers queued in the V4L2
device. Otherwise, we may trigger spurious warnings when the watchdog times out
even if there are no buffers queued in the device.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@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>
2022-05-10 16:49:53 +01:00
David Plowman
065a9e6c05 libcamera: raspberrypi: Fetch correct value for SensorSensitivity
These changes retrieve the correct value for sensitivity of the mode
selected for the sensor. This value is known to the CamHelper which
passes it across to the pipeline handler so that it can be set
correctly in the camera properties.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-10 14:24:45 +01:00
Naushir Patuck
998d23c0a2 libcamera: Add a SensorSensitivity property
The SensorSensitivity property is a scaling factor that describes how sensitive
the selected sensor mode is compared to other readout modes of the same sensor.
For example, a binned mode might have twice the sensitivity of the full
resolution mode, meaning you would get double the signal level for the same
exposure and gains.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-10 14:24:39 +01:00
Tomi Valkeinen
74ba01121a py: Add cam.py
Add cam.py, which mimics the 'cam' tool. Four rendering backends are
added:

* null - Do nothing
* kms - Use KMS with dmabufs
* qt - SW render on a Qt window
* qtgl - OpenGL render on a Qt window

All the renderers handle only a few pixel formats, and especially the GL
renderer is just a prototype.

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>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-10 13:53:43 +02:00
Tomi Valkeinen
6e92cb9dc4 py: Generate control enums from yaml
Generate enums for controls from control_ids.yaml. The generator script
has some heuristics to generate nicer enum names. E.g. instead of having
"LensShadingMapMode.LensShadingMapModeOff" we get
"LensShadingMapMode.Off". This heuristics may need to be updated when
the yaml file is changed or new controls are added.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.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>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-10 13:53:43 +02:00
Tomi Valkeinen
8aa02271fd Add Python bindings
Add libcamera Python bindings. pybind11 is used to generate the C++ <->
Python layer.

We use pybind11 'smart_holder' version to avoid issues with private
destructors and shared_ptr. There is also an alternative solution here:

https://github.com/pybind/pybind11/pull/2067

Only a subset of libcamera classes are exposed. Implementing and testing
the wrapper classes is challenging, and as such only classes that I have
needed have been added so far.

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>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-10 13:53:43 +02:00
Tomi Valkeinen
1ddda31f14 meson: Use new project_*_root() functions
meson.source_root() and meson.build_root() are deprecated. Use
meson.project_source_root() and meson.project_build_root() instead.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.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>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-10 13:53:43 +02:00
Han-Lin Chen
6d990f102f android: camera_hal_config: Use YamlParser to parse android HAL config
Use YamlParser to parse android HAL config files, instead of handling
YAML tokens directly, as a preparation for the further parameter extension.

Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-10 00:22:36 +03:00
Han-Lin Chen
fcb0ea001a libcamera: Introduce YamlParser as a helper to parse yaml files
Introduce YamlParser as a helper to convert contents of a yaml file to
a tree based structure for easier reading, and to avoid writing parser
with raw yaml tokens. The class is based on libyaml, and only support
reading but not writing a yaml file.

The interface is inspired by Json::Value class from jsoncpp:
http://jsoncpp.sourceforge.net/class_json_1_1_value.html

Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-05-10 00:22:36 +03:00
Laurent Pinchart
c70323e494 ipa: raspberrypi: Demote noisy message to Debug
The message that prints all controls in a request in
IPARPi::queueRequest() is noisy. Demote it from Info to Debug.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2022-05-09 12:31:39 +03:00
Laurent Pinchart
8a845ab078 libcamera: Replace toString with operator<<() for format classes
Now that format classes implement the stream formatting operator<<(),
use it instead of the toString() function.

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-05-04 14:11:33 +03:00
Laurent Pinchart
d5d6dbe85c libcamera: Add operator<<() for V4L2 format classes
Implement the stream output operator<<() for the V4L2DeviceFormat and
V4L2SubdeviceFormat classes to simplify printing 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-05-04 14:11:31 +03:00
Laurent Pinchart
08d6133113 libcamera: bayer_format: Add operator<<()
Implement the stream output operator<<() for the BayerFormat class to
simplify printing 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-05-04 14:11:31 +03:00
Laurent Pinchart
2efd8ab36a libcamera: Add operator<<() for pixel format classes
Implement the stream output operator<<() for the PixelFormat and
V4L2PixelFormat classes to simplify printing 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-05-04 14:11:30 +03:00
Laurent Pinchart
37958dfd71 libcamera: Replace toString with operator<<() for geometry classes
Now that geometry classes implement the stream formatting operator<<(),
use it instead of the toString() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-04 14:11:25 +03:00
Laurent Pinchart
4f1d1a48fe libcamera: object: Silence gcc false positive error in release mode
gcc 10 and 11 produce an error when compiling libcamera in release mode:

In file included from ../../src/libcamera/base/object.cpp:13:
../../include/libcamera/base/message.h: In member function ‘void libcamera::Object::notifyThreadMove()’:
../../include/libcamera/base/message.h:58:47: error: array subscript ‘const libcamera::InvokeMessage[0]’ is partly outside array bounds of ‘libcamera::Message [1]’ [-Werror=array-bounds]
   58 |         Semaphore *semaphore() const { return semaphore_; }
      |                                               ^~~~~~~~~~
../../src/libcamera/base/object.cpp:280:17: note: while referencing ‘msg’
  280 |         Message msg(Message::ThreadMoveMessage);
      |                 ^~~

This seems to be a false positive, given that msg->type() can never be
equal to Message::InvokeMessage in Object::message() when called from
Object::notifyThreadMove(), as the message is created there with the
Message::ThreadMoveMessage type. The problem as been reported in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105400, but the error
nonetheless needs to be fixed without waiting for a new gcc release, and
a dynamic_cast does the job with a small additional runtime cost that
shouldn't be a big issue, given that moving objects between threads is a
rare operation.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=125
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-04 14:11:23 +03:00
Han-Lin Chen
dc7fc90573 libcamera: geometry: Correct the string representation of Rectangle
Change the string representation of class Rectangle from
"(top x left)/width x height" to "(top, left)/width x height".

Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-22 00:38:54 +03:00
Han-Lin Chen
c730dc7479 libcamera: geometry: Add operator<< for classes in geometry
Add operator<< for geometry classes for easier logging.

Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-22 00:38:50 +03:00
Kate Hsuan
0111feb04b ipa: ipu3: af: A not initialized frame ignore counter fixing
A not initialized frame ignore counter (ignoreCounter_) makes the AF
function not work since the ignore counter may start from a random
negative number. The counter was set to kIgnoreFrame when AF is in
prepare stage.

Signed-off-by: Kate Hsuan <hpa@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-04-14 00:19:37 +02:00
Jean-Michel Hautbois
d9692cd481 ipa: RPi: Move the IPA to the ipa::RPi namespace
Simplify name-spacing of the RPi components by placing it in the
ipa::RPi namespace directly. It also aligns the RPi IPA with the other
ones (ipa::ipu3 and ipa::rkisp1) which already have this applied.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-04-14 00:19:36 +02:00
Dorota Czaplejewicz
d98af71eaa libcamera: framebuffer: Make FrameBuffer::cancel() private
FrameBuffer::cancel() is not meant to be used by applications. Move it
to the FrameBuffer::Private class.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
[Kieran: Handle rebase]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-04-14 00:19:36 +02:00
Umang Jain
cef3e15324 ipa: vimc: Synchronise parameter buffer ops naming
Synchronise the names of the operations with respect to parameters
buffer with the names used in other IPA interfaces.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-13 19:04:58 +05:30
Umang Jain
52cd4dacd0 ipa: vimc: Establish logical order of operations
It is preferred that the interface definition should represent
the logical order in which the operations will be called.

The patch has no functional changes.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-13 19:00:02 +05:30
Kieran Bingham
1724077225 libcamera: camera: Ensure requests belong to the camera
Requests are created by a Camera, and can only be queued to that
specific Camera. Enforce this during the public API to prevent mis-use
by incorrect applications.

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>
2022-04-12 09:18:10 +02:00
Kieran Bingham
8ca491cbf1 ipa: ipu3: af: Simplify accumulations of y_items
Simplify the accumulation of the total and variance with a ternary
operator.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Kate Hsuan <hpa@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-09 21:00:48 +02:00
Kieran Bingham
2f7a52df95 ipa: ipu3: af: Use Span for y_table_item_t
Convert the y_table_item_t to a Span and use that for iteration when
estimating variance of the table.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Kate Hsuan <hpa@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-09 21:00:47 +02:00
Kieran Bingham
9366dd6d12 ipa: ipu3: af: Remove redundant memcpy
The af statistics can be accessed directly from the mapped buffer.
Remove the redundant memcpy, and simplify the call to
afEstimateVariance().

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-04-09 21:00:47 +02:00
Kieran Bingham
3067203325 ipa: ipu3: af: Use geometry classes to perform grid centering
Use our geometry classes for Rectangle, Size and Point to identify
the region of interest for the autofocus, and center it on the BDS output.

This will facilitate custom ROI being passed in through controls at a later
time.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-04-09 21:00:47 +02:00
Kieran Bingham
50dc051fc6 ipa: ipu3: af: Move constants to implementation
A selection of constants are imported from ChromiumOS.

Move these out of the header, and simplify their documentation.  Further
more, add a direct reference to the location they were obtained from.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-04-09 21:00:47 +02:00
Kieran Bingham
b0c2484d61 ipa: ipu3: af: enforce grid size restrictions
Provide enforcement of the selection of the block_{width,height}_log2
parameters to the capabilities of the hardware.

While this selection is currently hardcoded to the minimum, providing
the restriction now allows for further dynamic sizing in the future and
documents the restrictions directly in code, making use of the already
existing constants.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-04-09 21:00:47 +02:00
Umang Jain
d630cc06db ipa: ipu3: Inline parseStatistics() into processStatsBuffer()
Since we have moved away from switch/case on the operation ID,
there's little reason to split the operation in two functions.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-08 14:05:11 +05:30
Umang Jain
9230cf69cb ipa: ipu3: Inline fillParams() in fillParamsBuffer()
Since we have moved away from switch/case on the operation ID,
there's little reason to split the operation in two functions.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-08 13:54:58 +05:30
Umang Jain
cbfa81cb4e ipa: ipu3: Replace event-based ops with dedicated functions
The IPAIPU3 interface currently uses event-type based structures in
order to communicate with the pipeline-handler (and vice-versa).
Replace the event based structures with dedicated functions associated
to each operation.

The translated naming scheme of actions to signals are:
  ActionSetSensorControls => setSensorControls
  ActionParamFilled       => paramsBufferReady
  ActionMetadataReady     => metadataReady

The translated naming scheme of events to dedicated functions are:
  EventProcessControls    => queueRequest()
  EventStatReady          => processStatsBuffer()
  EventFillParams         => fillParamsBuffer()

The dedicated functions are called from pipeline-handler to the IPA
using IPC. These functions run asynchronously and when completed,
the IPA emits the respective signals as stated above in the translated
naming scheme.

The EventProcessControls is translated to queueRequest() to bring
symmetry to the IPU3 interface with other IPA interfaces.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-08 12:55:10 +05:30
Umang Jain
85204b4b44 libcamera: v4l2_videodevice: Fix uninitialised watchdogDuration_
Initialise the watchdogDuration_ member to 0ms before it is used
in rest of the code base. Failing to do so, spews out log warnings
regarding dequeue timer being expired.

Fixes: 16f3d2de50 ("libcamera: v4l2_videodevice: Add a dequeue timer")
Signed-off-by: Umang Jain <umang.jain@ideasonboard.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-04-07 10:21:50 +03:00
Laurent Pinchart
e2d00fbcbb libcamera: base: utils: Add missing constructor for Duration
The Duration class is missing the equivalent to the
std::chrono::duration constructor that takes a number of ticks expressed
as a scalar. Fix it, which allows initializing a Duration instance to 0
or 0.0.

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>
2022-04-07 10:20:28 +03:00
Laurent Pinchart
1a9587b8f2 libcamera: camera_sensor: Drop const on the return value of sizes()
The sizes() function returns a value, not a reference. There's no need
for it to be const.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-04-06 20:25:48 +03:00
Naushir Patuck
8f4238a390 libcamera: v4l2_videodevice: Fix typos in a comment
Is/ingore/ignore/ and s/prevetn/prevent/

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-04-06 15:45:23 +03:00
Naushir Patuck
04faa8477a pipeline: raspberrypi: Add a Unicam dequeue timeout
Enable the V4L2VideoDevice dequeue timeout for the Unicam Image node, and
connect the timeout signal to a slot in the pipeline handler. This slot will
log an error message informing the user of a possible hardware stall.

The timeout is calculated as 2x the maximum frame length possible for a given
mode, returned by the IPA.

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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-06 15:44:37 +03:00
Naushir Patuck
16f3d2de50 libcamera: v4l2_videodevice: Add a dequeue timer
Add a timer that gets reset on every buffer dequeue event. If the timeout
expires, optionally call a slot in the pipeline handler to handle this
condition. This may be useful in detecting and handling stalls in either the
hardware or device driver.

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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-06 15:44:32 +03:00
Naushir Patuck
226792a141 ipa: raspberrypi: alsc: Limit the calculated lambda values
Under the right circumstances, the alsc calculations could spread the colour
errors across the entire image as lambda remains unbound. This would cause the
corrected image chroma values to slowly drift to incorrect values.

This change adds a config parameter (alsc.lambda_bound) that provides an upper
and lower bound to the lambda value at every stage of the calculation. With this
change, we now adjust the lambda values so that the average across the entire
grid is 1 instead of normalising to the minimum value.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-06 15:30:37 +03:00
Umang Jain
28a44e80f0 ipa: vimc: Rename processControls() to queueRequest()
Synchronise with other IPA interfaces (for e.g. IPU3, RkISP1)
that uses queueRequest() to pass in the request controls to
IPA.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-02 01:09:56 +05:30
Umang Jain
08d7e66df0 ipa: rkisp1: Split queuing of request and parameter filling
Queuing of request (i.e. passing of controls to the IPA)
and filling of the parameters buffer are two separate operations.
Treat them as such by splitting them into two functions in
the rkisp1 IPA interface.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-02 00:34:22 +05:30
Paul Elder
0040820fc1 libipa: camera_sensor_helper: Add OV5640 helper
The OV5640 is an OmniVision sensor with a linear gain model, expressed
in 1/16 steps.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
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-04-01 14:48:29 +03:00
Laurent Pinchart
e342e522cb libipa: camera_sensor_helper: Add IMX296 helper
The IMX296 is a Sony sensor that expresses its gain in 0.1dB units. It
thus maps to the exponential gain model.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-01 14:48:29 +03:00
Laurent Pinchart
4011994780 libipa: camera_sensor_helper: Add IMX290 helper
The IMX290 is a Sony sensor that expresses its gain in 0.3dB units. It
thus maps to the exponential gain model.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-01 14:48:24 +03:00
Laurent Pinchart
8ad9249fb0 libipa: camera_sensor_helper: Implement exponential gain model
The CameraSensorHelper specifies two gain models, linear and
exponential. They are modelled after the MIPI CCS specification. Only
the linear model has been implemented, the exponential model was left
for later.

We now need to support sensors that configure their gain in a hardware
register with a value expressed in dB. This has similarities with the
MIPI CCS exponential gain model, but is only has an exponential factor,
while CCS also allows sensors to support a configurable linear factor.

The full CCS exponential model needs two values (for the linear and
exponential factors) to express a gain, while IPAs use a single linear
gain value internally. However, the exponential gain model example in
the CCS specification has a fixed linear factor, which may indicate that
it could be common for sensors that implement the exponential gain model
to only use the exponential factor. For this reason, implement the
exponential gain model with a fixed linear factor, but with a
sensor-specific coefficient for the exponential factor that allows
expressing the gain in dB (or other logarithmical units) instead of
limiting it to powers of 2 as in the MIPI CCS specification.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-01 14:29:25 +03:00
Laurent Pinchart
a9d43c4710 libipa: camera_sensor_helper: Reorganize gain constants
To prepare for other gain models than the linear model, store the gain
constants in a union with per-model members. Due to the lack of
designated initializer support in gcc with C++17, initializing a single
complex structure that includes a union will be difficult. Split the
gain model type to a separate variable to work around this issue.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-04-01 14:29:05 +03:00
Laurent Pinchart
f9e2df9519 libcamera: v4l2_videodevice: Fix potential errno overwrite
The errno variable can potentially be overwritten by operator<<(). Store
it in a local variable before logging the error message.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-04-01 14:18:10 +03:00
Laurent Pinchart
b90faccb2c libcamera: camera_sensor: Add IMX290 sensor properties
The Sony IMX290 is a rolling shutter sensor with a 1945x1109 pixel array
size, with a recommended resolution after CFA interpolation of
1920x1080.

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-03-29 13:20:09 +03:00