Commit graph

3766 commits

Author SHA1 Message Date
Naushir Patuck
99feb66df0 ipa: raspberrypi: Rate-limit the controller algorithms
The controller algorithms currently run on every frame provided to the
IPA by the pipeline handler. This may be undesirable for very fast fps
operating modes where it could significantly increase the computation
cycles (per unit time) without providing any significant changes to the
IQ parameters. The added latencies could also cause dropped frames.

Pass the FrameBuffer timestamp to the IPA through the controls. This
timestamp will be used to rate-limit the controller algorithms to run
with a minimum inter-frame time given by a compile time constant,
currently set to 16.66ms. On startup, we don't rate-limit the algorithms
until after the number of frames required for convergence.

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>
2021-05-11 03:14:42 +03:00
Naushir Patuck
a80db5a723 ipa: raspberrypi: Add a Merge method to RPiController::Metadata
Add a new Merge method to the Metadata class. This will merge all unique
key/value pairs from a source metadata map to the destination map.

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>
2021-05-11 03:14:27 +03:00
Naushir Patuck
2bbd1e4766 ipa: raspberrypi: Add move/copy ctors and operators to Metadata class
Add a default, move and copy constructor as well as a move operator
implementation RPiController::Metadata class.

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>
2021-05-11 03:14:22 +03:00
Naushir Patuck
7de2bbed9b ipa: raspberrypi: Switch to std::scoped_lock in the Metadata class
Replace std::lock_guard with std::scoped_lock. When locking a single
mutex, both are functionally the same. When locking two mutexes in the
operator= overload, the scoped_lock uses a deadlock avoidance algorithm
to avoid deadlock.

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>
2021-05-11 03:13:45 +03:00
Naushir Patuck
340477f987 ipa: raspberrypi: Reformat RPiController::Metadata class header
Rearrange header includes to be in alphabetical order.
Add whitespace to class definition to match libcamera coding guidelines.
Fix a typo in the comment showing an example of scoped locks.

There are no functional changes in this commit.

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>
2021-05-11 03:13:39 +03:00
Naushir Patuck
3099e91c7b ipa: raspberrypi: Store dropped frame count in a member variable
Store the number of dropped frames on startup in a member variable. This
will be used in a subsequent change for rate limiting the controller
algorithms.

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>
2021-05-11 03:13:26 +03:00
David Plowman
82e4a98026 libcamera: pipeline: raspberrypi: Update ControlInfoMap after sensor format change
The Raspberry Pi pipeline handler does not update the sensor format
using CameraSensor::setFormat(), so it must manually force the update of
the associated ControlInfoMap.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-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>
2021-05-11 02:31:19 +03:00
David Plowman
91122dea97 libcamera: camera_sensor: Fix frame lengths calculated by sensorInfo()
The minimum and maximum vblanking can change when a new format is
applied to the sensor subdevice, so be sure to retrieve up-to-date
values.

The V4L2Device acquires the new updateControlInfo() method to perform
this function, and which the CameraSensor calls automatically if its
setFormat method is used to update the sensor.

However, not all pipeline handlers invoke the setFormat method
directly, so the new method must be made publicly available for
pipeline handlers to call if they need to.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
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>
2021-05-11 02:31:08 +03:00
Jacopo Mondi
45c6a7e6e8 android: camera_device: Report sensor physical size
Calculate the value of the ANDROID_SENSOR_INFO_PHYSICAL_SIZE property
multiplying the number of sensor's readable pixels with the pixel unit
cell size if provided by the Camera.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-10 15:08:51 +02:00
Jacopo Mondi
cdfcb05bed libcamera: camera_sensor: Register static properties
Register static properties in the CameraSensor class by inspecting the
camera sensor properties database.

Static properties are overridden by properties retrieved from
the kernel interface at run-time if any overlap between the two
sets occurs.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-10 15:08:26 +02:00
Jacopo Mondi
a58a94e4c2 libcamera: Introduce camera sensor properties
Introduce a database of camera sensor properties, which contains
information on the camera sensor which are not possible, or desirable,
to retrieve from the device at run time.

The camera sensor database is accessed through a static function and
is indexed using the camera sensor model as reported by
properties::Model.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-10 15:07:59 +02:00
David Plowman
5fda81e1f4 ipa: raspberrypi: Use CamHelpers to generalise sensor embedded data parsing
CamHelpers get virtual Prepare() and Process() methods, running just
before and just after the ISP, just like Raspberry Pi Algorithms.

The Prepare() method is able to parse the register dumps in embedded
data buffers, and can be specialised to perform custom processing when
necessary.

The IPA itself only needs to call the new Prepare() and Process()
methods. It must fill in the DeviceStatus from the controls first, in
case the Prepare() method does not supply its own values.

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>
2021-05-08 02:49:13 +03:00
David Plowman
df36fb4abb ipa: raspberrypi: Make sensor embedded data parser use Span class
Improve MdParser::Parse() by taking a Span, pointing to const data
that it should not change, as its input buffer.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-08 02:49:03 +03:00
Kieran Bingham
414babb60b libcamera: controls: Remove merge assertion
The ControlList merge operation is protected with an ASSERT to guarantee
that the two lists are compatible.

Unfortunately this assertion fails when we run IPAs in an isolated case
as while the lists are compatible, the isolated IPA has a unique
instance of the id map. This breaks the pointer comparison, and the
assertion fails with a false positive.

Remove the assertion, leaving only a todo in it's place as this breaks
active users of the library.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=31
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-05-07 17:21:11 +01:00
Jacopo Mondi
d66fd818ec android: camera_device: Use controls::SensorTimestamp
Use the controls::SensorTimestamp value to populate
ANDROID_SENSOR_TIMESTAMP result metadata.

The Camera is assumed to provide the control in the Request metadata.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:09:42 +02:00
Jacopo Mondi
b3a504e965 cam: Implement OptMetadata
Implement support for the new '--metadata' option by printing the
value of each metadata entry associated with a completed Request.

As sample of the output, running on raspberry pi, looks like the
following:

3050.205672 (30.01 fps) stream0 seq: 000033 bytesused: 720000
	ScalerCrop = (0x2)/3280x2460
	ExposureTime = 13969
	AeLocked = true
	DigitalGain = 1.000721
	Lux = 771.204224
	ColourGains = [ 1.561101, 1.629698 ]
	ColourTemperature = 4289
	SensorBlackLevels = [ 4096, 4096, 4096, 4096 ]
	ColourCorrectionMatrix = [ 1.691066, -0.599756, -0.091317, -0.437452, 1.983766, -0.546314, -0.083429, -0.722407, 1.805836 ]
	AnalogueGain = 2.000000
	SensorTimestamp = 3050205672000

3050.238999 (30.01 fps) stream0 seq: 000034 bytesused: 720000
	ScalerCrop = (0x2)/3280x2460
	ExposureTime = 13969
	AeLocked = true
	DigitalGain = 1.000709
	Lux = 771.232422
	ColourGains = [ 1.560868, 1.630029 ]
	ColourTemperature = 4289
	SensorBlackLevels = [ 4096, 4096, 4096, 4096 ]
	ColourCorrectionMatrix = [ 1.691081, -0.599726, -0.091362, -0.437497, 1.983627, -0.546130, -0.083420, -0.722523, 1.805943 ]
	AnalogueGain = 2.000000
	SensorTimestamp = 3050238999000

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:09:42 +02:00
Jacopo Mondi
7df772f559 cam: Add option to print the Request metadata
Add the "--metadata" option to the cam tool, which will be used to
print the metadata associated with a completed capture request.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:09:42 +02:00
Jacopo Mondi
fcfb1dc02a libcamera: raspberry: Report sensor timestamp
Report the sensor's timestamp in the Request metadata by using the
Unicam::Image buffer timestamp as an initial approximation.

The buffer's timestamp is recorded at DMA-transfer time, and it does not
theoretically matches the 'start of exposure' definition, but when used
to compare two consecutive frames it gives an acceptable estimation of
the sensor frame period duration.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:09:42 +02:00
Jacopo Mondi
131b209693 libcamera: raspberrypi: Do not over-write metadata
When a Request is completed upon receiving the IPA produced metadata,
the metadata associated with the Request are over-written, deleting
the information set at output buffer completion, such as the
SensorTimestamp.

This commit applies to the RaspberryPi pipeline handler the same change
applied to IPU3 in commit 2ee3dd57e2fc ("libcamera: ipu3: Merge IPA
metadata controls").

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:09:30 +02:00
Jacopo Mondi
99de822436 libcamera: buffer: Re-work setRequest() documentation
I got fooled by the documentation of setRequest() implying that the
function is meant to be called by pipeline handlers only, which it is
used in the Request class at Request::addBuffer() and Request::reuse()
time.

Rework the documentation to report that.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:09:18 +02:00
Jacopo Mondi
787c90027c libcamera: vimc: Report sensor timestamp
Report the sensor's timestamp in the Request metadata using the
completed buffer timestamp.

The buffer's timestamp reports the video capture buffer processing time,
and it does not theoretically matches the 'start of exposure'
definition.

VIMC being a testing platform and the test driver completes the buffers
for each media entity connected in the pipeline one after the other, the
current solution is acceptable for the pipeline.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:09:18 +02:00
Jacopo Mondi
922833f774 libcamera: simple: Report sensor timestamp
Report the sensor's timestamp in the Request metadata using the
completed buffer timestamp.

The buffer's timestamp is recorded at DMA-transfer time, and it does not
theoretically matches the 'start of exposure' definition. Record this with
a \todo entry.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:09:18 +02:00
Jacopo Mondi
62f53a0f22 libcamera: rkisp1: Report sensor timestamp
Report the sensor's timestamp in the Request metadata using the
completed buffer timestamp.

The buffer's timestamp is recorded at DMA-transfer time, and it does not
theoretically matches the 'start of exposure' definition. Record this with
a \todo entry.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:09:17 +02:00
Jacopo Mondi
210c59b6bb libcamera: rkisp1: Do not over-write metadata
When a Request is completed upon receiving the IPA produced metadata,
the metadata associated with the Request are over-written, deleting
the information set at output buffer completion, such as the
SensorTimestamp.

This commit applies to the RkISP1 pipeline handler the same change
applied to IPU3 in commit 2ee3dd57e2fc ("libcamera: ipu3: Merge IPA
metadata controls").

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:08:56 +02:00
Jacopo Mondi
ae342991dc libcamera: uvc: Report sensor timestamp
Report the sensor's timestamp in the Request metadata using the
completed buffer timestamp.

The UVC driver reports timestamps of SOE event through metadata, for
which there is no support in the current pipeline implementation.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:08:56 +02:00
Jacopo Mondi
d9a68af06d libcamera: ipu3: Merge IPA metadata controls
When a Request is completed upon receiving the IPA produced metadata,
they should be merged with the metadata set by the pipeline handler
before reporting them to applications.

Use ControlList::merge() to collect the IPA produced controls to the
request's metadata.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:08:34 +02:00
Jacopo Mondi
cb43c18040 libcamera: ipu3: Report sensor timestamp
Report the sensor's timestamp in the Request metadata by using the
CIO2 buffer timestamp as an initial approximation.

The buffer's timestamp is recorded at DMA-transfer time, and it does not
theoretically matches the 'start of exposure' definition, but when used
to compare two consecutive frames it gives an acceptable estimation of
the sensor frame period duration.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:08:34 +02:00
Jacopo Mondi
4f26020e66 libcamera: controls: Destage 'SensorTimestamp'
Destage the 'SensorTimestamp' control, which is used by pipeline
handlers to report the time when the first active line of the sensor's
pixel array is exposed.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:08:34 +02:00
Jacopo Mondi
b3a603a489 test: control_list: Test ControlList::merge()
Test the ControlList::merge() method by creating a new list and
merging it with the existing one.

Test that the merged list contains all the controls, the existing values
do not get overwritten and the ones copied are not changed.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:08:34 +02:00
Jacopo Mondi
f348188625 test: control_list: Check for Brightness presence
The current test verifies that after adding a new control to a list
already populated with one control the new one is present.

However the test wrongly tests for its presence twice instead of
making sure the existing control is still there.

Fix this by checking for the presence of both controls after the
update, and fix the error message accordingly.

Fixes: a8c40942b9 ("libcamera: controls: Improve the API towards applications")
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:08:34 +02:00
Laurent Pinchart
a5c881645a libcamera: controls: Add a function to merge two control lists
Add a new ControlList::merge() function to merge two control lists by
copying in the values in the list passed as parameters.

This can be used by pipeline handlers to merge metadata they populate
with metadata received from an IPA.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[reimplement the function by not using std::unordered_map::merge()]
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-06 15:07:52 +02:00
Umang Jain
332870ea2b test: bayer-format: Rectify internal header's #include path
libcamera internal headers are not available system-wide. Hence,
directive `#include <libcamera/internal/header.h>` is wrong. Fix it
by using "" for the #include directive.

Fixes: e09c487b97 ("test: Add unit tests for the BayerFormat class")
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-05 10:32:33 +02:00
Umang Jain
08f7469617 src: android: Rectify internal header's #include path
libcamera internal headers are not installed system-wide. Hence, any
inclusion of internal headers should follow the #include directive
form:
	#include "libcamera/internal/header.h"

This was not the case for a few of the class in android HAL. Fix them.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-05 10:30:32 +02:00
Sebastian Fricke
093b71b24a pipeline: rkisp1: Add check for non-existent frame info
Add a check, that makes sure that the given FrameBuffer is associated
to a RkISP1FrameInfo instance. The current code tries to access the
frame info without checking if it actually exists.

Fixes: 0eb65e14e ("libcamera: pipeline: rkisp1: Attach to an IPA")

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-05-03 13:31:25 +01:00
Kieran Bingham
3a1f67a803 src: meson: Define system paths
Define libcamera specific system paths for use within the library code
base. These can be used to identify system configuration files and
shared data.

Also, make use of the new system path variables and map the ipa paths
upon the libcamera system path, making use of the new shorter syntax for
join_paths().

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-30 11:53:09 +01:00
Kieran Bingham
7065ad84f0 libcamera: internal: log: Report function on asserts
Report the function which fails an assertion as well as the actual
assertion.

This now reports as:

[30:08:53.218816270] [226567] FATAL default request.cpp:150 assertion "d" failed in reuse()
rather than:
[30:11:05.271888926] [228531] FATAL default request.cpp:150 assertion "d" failed

Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-27 22:50:23 +01:00
Paul Elder
0f2189ba30 ipa: mojom: Put core.mojom in the libcamera namespace
Put core.mojom in the libcamera namespace, as all structs that are
defined in core.mojom are meant to be in that namespace. Fix the structs
that are used in the other mojom files accordingly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-27 17:34:58 +09:00
Paul Elder
078fbff8f4 utils: ipc: Use the proper namespace for mojom structs
Structs defined in mojom previously used the namespace of the mojom file
that was being used as the source. This is obviously not the correct
namespace for structs that are defined in core.mojom. Fix the jinja
function for getting the element type including namespace, and use it.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-27 17:34:58 +09:00
Paul Elder
17e8f6f71c utils: ipc: Include instead of forward-declare CameraSensorInfo
For structs defined in core.mojom that have the skipHeader tag, if
they're only used in function parameters (in a mojom file) then a
forward-declaration is sufficient. However, if the struct is used in
another struct in a mojom file, then the forward-declaration is
insufficient, and the definition needs to be included. Do so for
CameraSensorInfo, which is the only forward-declared struct in
ipa_interface.h, and update the documentation comment.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-27 17:34:55 +09:00
Sebastian Fricke
446cb01d14 ipa: cam_helper: Correct a wrong choice of term
Sensors provide embedded data buffers and not metadata buffers,
replace the incorrect term with the correct one.

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
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>
2021-04-27 09:54:25 +03:00
Sebastian Fricke
2d95f773ab ipa: cam_helper_imx219: Rework comment
Fix two typos and improve the sentence.

Signed-off-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-27 09:54:13 +03:00
Hirokazu Honda
c3ab0fa0ce libcamera: V4L2Device: Use Span in updateControls()
V4L2Device::updateControls() takes two arguments, raw array and
its size, for the v4l2_ext_control values. This replaces it with
libcamera::Span.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
2021-04-26 16:40:13 +03:00
Hirokazu Honda
3c0e99e034 libcamera: V4L2Device: Replace VLA with std::vector in setControls()
The original code uses Variable-Length-Array, which is not
officially supported in C++. This replaces the array with
std::vector.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
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>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
2021-04-26 16:40:10 +03:00
Hirokazu Honda
3252631fbd libcamera: V4L2Device: Replace VLA with std::vector in getControls()
The original code uses Variable-Length-Array, which is not officially
supported in C++. This replaces the array with std::vector.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
2021-04-26 16:39:54 +03:00
Jean-Michel Hautbois
8a2fb73337 ipa: rkisp1: Move the IPA to the ipa::rkisp1 namespace
Simplify name-spacing of the RKISP1 components by placing it in the
ipa::rkisp1 namespace directly.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-04-26 10:24:11 +02:00
Kieran Bingham
883334135b libcamera: pipeline: ipu3: Cancel unused buffers
When the CIO2 returns a cancelled buffer, we will not queue buffers
to the IMGU.

These buffers should be explicitly marked as cancelled to ensure
the application knows there is no valid metadata or frame data
provided in the buffer.

Provide a cancel() method on the FrameBuffer to allow explicitly
cancelling a buffer.

Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-22 16:56:07 +01:00
Kieran Bingham
0abed64843 libcamera: pipeline: rkisp1: Fail RkISP1FrameInfo can't be found
The RkISP1FrameInfo structure associated data sent to the IPA and is
essential for handling events.

If it can not be found, this is a fatal error which must be fixed.

Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-22 16:56:07 +01:00
Kieran Bingham
47c12e2635 libcamera: pipeline: ipu3: frames: Fail if the FrameInfo can't be found
The FrameInfo structure associates the data sent to the IPA
and is essential for handling events.

If it can not be found, this is a fatal error which must be fixed.

While we're changing the line, also correct a spelling error for
'Information'.

Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-22 16:56:07 +01:00
Kieran Bingham
ec5d4acfca libcamera: camera: Assert pipelines complete all requests
When the camera manager calls stop on a pipeline, it is expected that
the pipeline handler guarantees all requests are returned back to the
application before the camera has stopped.

Ensure that this guarantee is met by providing an accessor on the
pipeline handler to validate that all pending requests are removed.

Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-22 16:56:07 +01:00
Jean-Michel Hautbois
7e0da7c349 ipa: ipu3: fix coverity issues in AWB
The BNR configuration structure has inconsistent initialisation of two
members.

This was picked up by Coverity, after merge.
While this code is still functional, fix them to be consistent with the
other initialisations within the struct.

Reported-by: Coverity CID=320056
Reported-by: Coverity CID=320058
Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-22 16:56:06 +01:00