Commit graph

3766 commits

Author SHA1 Message Date
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
Laurent Pinchart
302731cdf8 test: v4l2_videodevice: Fix format configuration in the vimc pipeline
The V4L2VideoDeviceTest class configures the capture pipeline with
parameters that are partly hardcoded, and partly come from the current
configuration of the device. In particular, with the vimc pipeline, the
sensor subdevice is configured with the size retrieved from the capture
video node, and the video node is then reconfigured to 640x480.

Relying on the current (and thus possibly random) device configuration
can lead to broken pipes when starting streaming. This currently causes
failures of the dequeue_watchdog test when run after the formats test.

Fix it by explicitly setting the same size for both the vimc subdevs and
the video capture device.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-04-07 16:19:41 +03:00
Laurent Pinchart
3980448e9f test: v4l2_videodevice: dequeue_watchdog: Check return value of streamOn
If the streamOn() call fails, there is no way the test will then
succeed. Catch it and return a failure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-04-07 16:19:40 +03:00
Laurent Pinchart
dd76f8e11b test: v4l2_videodevice: dequeue_watchdog: Log message on failures
Failing a test without an error message makes it difficult to debug
issues. Add a message when buffer allocation fails.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-04-07 16:19:33 +03:00
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
Kieran Bingham
eea1c9c631 test: v4l2_videodevice: Verify the Dequeue Watchdog
Add a test that captures 5 frames, with a short (5ms) watchdog.
The default framerate of the VIMC pipeline should ensure that
we never meet this watchdog, and the timeout should activate.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
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:44:39 +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
Laurent Pinchart
c45f9ce04c Documentation: Briefly document the mail-based contribution process
While familiarity with git is nowadays common, many developers are not
familiar with mail-based patch submission. Add a paragraph to the
contribution guide to mention that libcamera uses a mail-based process
(which seems to have been taken for granted so much that we forgot to
say it explicitly), and link to git-send-email.io to help newcomers
setup git-send-email.

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 13:14:52 +03:00
David Plowman
8dc2699bb8 ipa: raspberrypi: Correct some of the ControlInfo ranges and defaults
Some of the values were listed incorrectly. Specifically:

ExposureValue: the range is now centred correctly on zero
Brightness: the default value (0.0) is made explicit
Contrast: the default value is corrected to be 1.0
Saturation: the default value is corrected to be 1.0

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-04-06 12:52:24 +03:00
Kunal Agarwal
a2aa1b4c4e Documentation: guides: introduction: Fix spelling errors
Fixes two spelling mistakes in introduction.rst
This patch has no functional changes.

Signed-off-by: Kunal Agarwal <kunalagarwal1072002@gmail.com>
Reviewed-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2022-04-02 01:10:03 +05:30
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
Laurent Pinchart
9bb0889baf gstreamer: Fix typo in comment
Possibly the most trivial patch.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-29 01:42:26 +03:00
Umang Jain
60c3d32a89 ipa: ipu3: Ensure controls exists in before they are queried
Add a validation check for sensor controls validateSensorControls()
before they are queried in IPAIPU3::updateSessionConfiguration().
Fail the IPAIPU3::configure() if the required sensor controls are
not found.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28 17:01:17 +05:30
Umang Jain
36f0cd57cb ipa: ipu3: Drop sensor controls private members from IPAIPU3
Drop exposure, gain private members from IPAIPU3 because the values
are handled directly via IPAFrameContext.

Move the default vblank value from IPAIPU3 to IPASessionConfiguration
structure as it is a default static value not expected to change
for a session.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28 17:01:17 +05:30
Umang Jain
a76b06e951 ipa: ipu3: Consolidate querying of exposure and gain limits
The exposure and gain limits are required for AGC configuration
handled in IPAIPU3::updateSessionConfiguration(), which is happening
already. Therefore the max/min private members in IPAIPU3 class for
exposure/gain serve no use except setting initial values of exposure_
and gain_ members.

Drop the max/min private members from IPAIPU3 class and set initial
gain_ and exposure_ in  IPAIPU3::updateSessionConfiguration().

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28 17:01:17 +05:30
Jean-Michel Hautbois
4b2251509f ipa: rkisp1: Introduce AWB
The RkISP1 ISP calculates a mean value for Y, Cr and Cb at each frame.
There is a RGB mode which could theoretically give us the values for R,
G and B directly, but it seems to be failing right now.

Convert those values into R, G and B and estimate the gain to apply in a
grey world.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28 12:31:37 +02:00
Jean-Michel Hautbois
8917c9e7ba ipa: rkisp1: agc: Add a histogram-based gain
As for the IPU3, we can estimate the histogram of the luminance. The
RkISP1 can estimate multiple ones, the R, G and B ones, the Y only one
and a combination of RGB. The one we are interested by in AGC is the Y
histogram.

Use the hardware revision to determine the number of bins of the
produced histogram.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28 12:31:37 +02:00
Jean-Michel Hautbois
88c69f8808 ipa: libipa: Histogram: Constify the constructor span
The Histogram constructor does not modify the data. Pass it a
Span<const uint32_t> instead of a Span<uint32_t>.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28 12:31:37 +02:00
Jean-Michel Hautbois
13c1e48e8e ipa: rkisp1: Introduce Black Level Correction
In order to have the proper pixel levels, apply a fixed black level
correction, based on the imx219 tuning file in RPi. The value is 4096 on
16 bits, and the pipeline for RkISP1 is on 12 bits, scale it.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Peter Griffin <peter.griffin@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28 12:31:37 +02:00
Jean-Michel Hautbois
f84e5e01a4 ipa: rkisp1: Use frame counter for the request queued
Introduce a frameCount variable in the IPAFrameContext which increments
each time a request is queued. It is reset at configure call, when the
camera is started.

This will allow the frameCount to be used by other algorithms, without
having to keep multiple private frame counters.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28 12:31:37 +02:00
Laurent Pinchart
4efca856c0 utils: hooks: pre-push: Catch commits without author's SoB
The pre-push git hook script catches commits without a SoB line
corresponding to the committer, but doesn't perform the same check on
the author. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-03-28 13:29:32 +03:00
Naushir Patuck
7349031294 test: Test V4L2BufferCache::isEmpty() member function
Add a test for V4L2BufferCache::isEmpty() for various levels for cache
fullness.

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-03-28 02:18:39 +03:00
Naushir Patuck
5704856681 libcamera: v4l2_videodevice: Empty the V4L2 buffer cache on streamOff()
When streamOff() is called, ensure the cache entries for the remaining queued
buffers are freed since this will not happen via the dequeueBuffer() mechanism.

Additionally, add a V4L2BufferCache::isEmpty() function and assert that the
cache is empty at the end of the streamOff() call.

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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-28 02:18:34 +03:00
Naushir Patuck
1fb71a6ffa libcamera: v4l2_videodevice: Do not allow buffer queueing in stopping state
If the device is in the process of being stopped (i.e. Stopping state), any
call to queueBuffer() must fail. This is to ensure the integrity of the buffer
queue, as it gets cleared at the end of streamOff.

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-03-28 02:18:23 +03:00