Commit graph

2984 commits

Author SHA1 Message Date
Paul Elder
e45bddeb93 tests: Remove IPA wrappers test
Since we will soon no longer use IPA wrappers, remove the test for it.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-02-16 19:21:49 +09:00
Paul Elder
e6722b86ee meson: ipa, proxy: Generate headers and proxy with mojo
Run mojo from meson to generate the header, serializer, and proxy files
for every pipeline's mojom data definition file.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-02-16 19:21:39 +09:00
Paul Elder
4000ed4d8d ipa: Add core.mojom
Add a base mojom file to contain empty mojom definitions of libcamera
objects, as well as documentation for the IPA interfaces that need to be
defined in the mojom files.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-16 19:21:35 +09:00
Paul Elder
21f1b555b7 libcamera: Add IPCPipe implementation based on unix socket
Add an implementation of IPCPipe using unix socket.

[Original patch]
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Error fix from Niklas]
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-02-16 19:21:29 +09:00
Paul Elder
e1ccded833 libcamera: Add IPCPipe
Create a virtual IPCPipe class that models an IPC/RPC system. IPA proxies
and proxy workers will call into the IPCPipe, rather than implementing
the IPC themselves.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-16 19:21:25 +09:00
Paul Elder
13f7d58569 libcamera: Add IPADataSerializer
Add an IPADataSerializer which implements (de)serialization of built-in
(PODs, vector, map, string) and libcamera data structures. This is
intended to be used by the proxy and the proxy worker in the IPC layer.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-02-16 19:21:18 +09:00
Paul Elder
c6d4303b0b Documentation: skip generating documentation for generated code
Specify in doxygen to not generate code for the generated headers and
proxy source code files.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-02-16 19:21:14 +09:00
Paul Elder
6072ca395a utils: ipc: add parser script
On some systems, python2 might still be the default python. Enforce
python3 by wrapping the mojo parser script in a python3 script. This
also has the benefit of not modifying mojo.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-02-16 19:21:11 +09:00
Paul Elder
2ad8768fd6 utils: ipc: add generator script
We want to avoid changing our copy of mojo to make updates easier. Some
parameters in the mojo generator script needs to be changed though; add
a wrapper script that sets these parameters.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-02-16 19:21:07 +09:00
Paul Elder
7832e19a59 utils: ipc: add templates for code generation for IPC mechanism
Add templates to mojo to generate code for the IPC mechanism. These
templates generate:
- module header
- module serializer
- IPA proxy cpp, header, and worker

Given an input data definition mojom file for a pipeline.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-16 19:21:00 +09:00
Paul Elder
892c0f4c19 libcamera: control_serializer: Save serialized ControlInfoMap in a cache
The ControlSerializer saves all ControlInfoMaps that it has already
(de)serialized, in order to (de)serialize ControlLists that contain the
ControlInfoMaps. Leverage this to cache ControlInfoMaps, such that the
ControlSerializer will not re-(de)serialize a ControlInfoMap that it has
previously (de)serialized.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-16 19:20:57 +09:00
Dafna Hirschfeld
a119d75530 libcamera: pipeline: rkisp1: configure IPA from configure method instead of start method
Currently the call to the configure method of rkisp1 IPA
is called upon the 'start' of the pipeline. This should be done
in the 'configure' method instead.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-02-16 19:20:52 +09:00
Kieran Bingham
f9c0cf2a3a libcamera: MappedBuffer: Disable copy and assignment
MappedBuffers have a custom move constructor and assignment operator to
ensure that memory is not unmapped during object manipulation.

Because of the user-defined move constructor, the implicitly-declared
copy-constructor will already be deleted, however delete it explicitly
to help readability of the code, and make it clear that the object can
not be copied.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-12 14:35:21 +00:00
Kieran Bingham
640f48d603 libcamera: Utilise LIBCAMERA_DISABLE_COPY
Replace existing use cases where the copy constructor and copy
assignment operator are deleted with the LIBCAMERA_DISABLE_COPY
statement

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-12 14:35:20 +00:00
Kieran Bingham
83c5a2a7aa libcamera: controls: Utilise LIBCAMERA_DISABLE_COPY_AND_MOVE
The ControlId and Control classes disable the copy constructor and
assignment operator, but they should also prevent move construction and
assignment.

Utilise LIBCAMERA_DISABLE_COPY_AND_MOVE to fully disable these
functions.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-12 14:35:17 +00:00
Kieran Bingham
234ee71517 libcamera: media_object: Utilise LIBCAMERA_DISABLE_COPY_AND_MOVE
Convert MediaLink, MediaPad, and MediaEntity to declare
LIBCAMERA_DISABLE_COPY_AND_MOVE. These classes already deleted their
copy constructor but not the assignment operator.

They should also not be movable, so expand to fully disable both copying
and moving.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-12 14:35:12 +00:00
Kieran Bingham
74f103486c libcamera: buffer: Utilise LIBCAMERA_DISABLE_COPY_AND_MOVE
Convert the existing copy, move and assignment operators to use the new
macros.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-12 14:34:18 +00:00
Kieran Bingham
41b6d83e6a libcamera: class: Provide move and copy disablers
It can be difficult to correctly parse the syntax for copy/move and the
associated assignment operators.

Provide helpers as syntactic sugar to facilitate disabling either the
copy constructor, and copy assignment operator, and the move constructor
and move assignment operator in a way which is explicit and clear.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-12 14:34:04 +00:00
Kieran Bingham
1473add188 libcamera: Move extensible to class
The Extensible concept is a generic Class helper. To prepare for
further class helper additions, move the specific extensible
implementation and header to a more generic class header and source.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-12 11:56:00 +00:00
David Plowman
db55e09b42 ipa: raspberrypi: AWB: Fix race condition setting manual gains
Applying the manual_r_ and manual_b_ values is entirely removed from
the asynchronous thread where their use constituted a race hazard. The
main thread now deals with them entirely, involving the following
changes.

1. SetManualGains() applies the new values directly to the
"sync_results", meaning that Prepare() will jump to the new values
immediately (which is a better behaviour).

2. Process() does not restart the asynchronous thread when manual
gains are in force.

3. The asynchronous thread might be running when manual gains are set,
so we ignore the results produced in this case.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-11 19:14:39 +02:00
Laurent Pinchart
e36a6f4043 libcamera: Drop unneeded depend_files from meson custom targets
The meson custom_target() function accepts a 'depend_files' argument to
list additional dependency files. Files already listed in the 'command'
argument are handled automatically, and don't need to be added manually.
Drop them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-11 18:20:49 +02:00
Laurent Pinchart
db27029ce4 meson: Fix coding style when declaring arrays
The meson.build files mix array declarations with and without a space
after the opening and before the closing square bracket. The vast
majority of cases don't use spaces, so standardize on that.

While it it, fix indentation in a few places.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-11 18:20:22 +02:00
David Plowman
9e369da993 ipa: raspberrypi: AWB: Remove unecessary frame count variable
The variable frame_count2_ is not needed as Prepare() and Process()
always run in lock step one after the other.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-10 19:23:18 +02:00
Naushir Patuck
8a05d35ba5 ipa: raspberrypi: Handle control::NoiseReductionMode in the controller
The application provided noise reduction mode gets passed into the
denoise controller. The denoise controller in turn returns the mode to
the IPA which now sets up the colour denoise processing appropriately.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-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>
2021-02-09 13:23:40 +02:00
Naushir Patuck
c9e1ef7bd2 ipa: raspberrypi: Add a DenoiseAlgorithm class to the Controller
This denoise algorithm class will be used to pass in the user requested
denoise operating mode to the controller. The existing Denoise
controller will derive from this new DenoiseAlgorithm class.

Add a denoise mode field in the denoise status metadata object for the
IPA to use when configuring the ISP.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-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>
2021-02-09 13:23:39 +02:00
Naushir Patuck
44ea5b65c8 ipa: raspberrypi: Rename SdnStatus to DenoiseStatus
This change is in anticipation of the addition of a DenoiseAlgorithm
base class which the SDN class will derive from. We want to match the
metadata object name with the base class algorithm name.

This renames:
- SdnStatus metadata object to DenoiseStatus
- "sdn.status" metadata string key to "denoise.status"
- sdn_status.h header file to denoise_status.h

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-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>
2021-02-09 13:23:39 +02:00
Naushir Patuck
1c362b7855 uapi: raspberrypi: Update the bcm2835-isp header definition
Update the bcm2835-isp.h file with the latest version available in the
downstream Raspberry Pi linux repo at commit:
68878170d8a98afd6d519a3a2c909080c19de4ce

This change adds support for colour denoise processing, and the
following downstream kernel changes must be available:
https://github.com/raspberrypi/linux/pull/4069
https://github.com/raspberrypi/linux/pull/4083

The Raspberry Pi image must also be running the latest firmware,
obtained by running rpi-update.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Acked-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-02-09 13:23:39 +02:00
Naushir Patuck
68b992e72e pipeline: raspberrypi: Set the ISP Output1 to 1/4 resolution if unused
In preparation for fast colour denoise, set the low resolution ISP
output stream (Output1) to a 1/4 resolution of the application requested
stream (Output0). This only happens if the application has not requested
an additional YUV or RGB stream.

We also constrain this 1/4 resolution to at most 1200 pixels in the
largest dimension to avoid being too taxing on memory usage and system
bandwidth.

Also switch the default StreamRole::VideoRecording to YUV420 to allow
fast colour denoise to run.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-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>
2021-02-09 13:23:39 +02:00
Naushir Patuck
64e3aa23ff pipeline: raspberrypi: Refactor stream configuration routine
Refactor the high/low resolution stream format and output selection
routine. This change is in preparation of adding 1/4 resolution output
for fast colour denoise.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-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>
2021-02-09 13:23:39 +02:00
Niklas Söderlund
03def6e947 libcamera: ipu3: Get request from information structure instead of buffer
Buffers dequeued from the ImgU may not be associated with a Request as
they are internal (statistics, parameters and some RAW buffers). Fetch
the request they are used for from the frame information instead.

Fixes: 9708f49fec ("libcamera: ipu3: Share parameter and statistic buffers with IPA")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-08 20:13:57 +01:00
David Plowman
4625132b90 ipa: raspberrypi: Remove atomic variable from Algorithm class
Pause() and Resume() are only called synchronously so paused_ does not
need to be atomic.

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-02-08 19:30:12 +02:00
Jacopo Mondi
756fcbaaf2 android: camera_device: Calculate MAX_JPEG_SIZE
Calculate the JPEG maximum size using the maximum preview format size
multiplied by a 1.5 factor.

The same multiplication factor is used in the existing HAL
implementations in ChromeOS.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-08 11:04:21 +01:00
David Plowman
7fab304719 ipa: raspberrypi: lux: Supply missing method and remove atomic variable
Supply the missing SetCurrentAperture() method (even though no one is
calling it). If we did call it, it would be called synchronously so
the atomic variable is not required.

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-02-07 16:09:02 +02:00
David Plowman
ef3ce74b26 ipa: raspberrypi: noise: Remove unnecessary atomic variable
mode_factor_ does not need to be atomic - it is set by SwitchMode()
which runs synchronously.

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-02-07 16:08:06 +02:00
David Plowman
7a8150c5b9 ipa: rasberrypi: contrast: Remove unnecessary atomic variables
SetBrightness() and SetContrast() are only called synchronously so
there is no need for brightness_ and contrast_ to be atomic.

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-02-07 16:06:51 +02:00
David Plowman
df3a86ace3 ipa: raspberrypi: ccm: Remove unnecessary atomic variable
SetSaturation() gets called synchronously so there is no need for
saturation_ to be atomic.

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-02-07 16:05:46 +02:00
David Plowman
a03cd6af11 ipa: raspberrypi: AWB: Improve locking
Fix a couple of places where notify_one() was called with the lock
held. Also restartAsync doesn't need the lock for its entire duration.

This change exactly matches commit db552b0b92 ("libcamera: ipa:
raspberrypi: ALSC: Improve locking in a few places") where we do the
same for ALSC (the asynchronous thread arrangement there is identical).

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-02-07 16:01:49 +02:00
David Plowman
3a1b50876c ipa: raspberrypi: AWB: Remove unnecessary locking for AWB settings
AWB settings get updated synchronously with the main thread, so the
settings_mutex_ and associated locking can be removed.

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-02-07 16:01:29 +02:00
Jacopo Mondi
b2839ed68a libcamera: ipu3: Fix RAW sizes selection
Commit 7208e70211 ("libcamera: ipu3: Always use sensor full frame size")
changed the CIO2 configuration procedure to always select the full
sensor resolution to work around an ImgU configuration issue, as
reported in the todo item introduced in said commit.

When capturing a RAW stream only and the ImgU is not involved, the CIO2
has to be configured with the requested stream size to avoid adjusting
the stream to the sensor resolution.

As an example, capturing a raw frame smaller than the sensor resolution
with this patch applied results in the stream configuration to be
correctly assigned.

$ cam -c1 -swidth=1056,height=784,role=raw
ipu3.cpp:207 CIO2 configuration: 1056x784-SGRBG10_IPU3
ipu3.cpp:222 Validating stream: 1056x784-SGRBG10_IPU3
ipu3.cpp:233 Assigned 1056x784-SGRBG10_IPU3 to the raw stream

Without this patch the same operation results in the stream resolution
to be adjusted to the sensor resolution.

$ cam -c1 -swidth=1056,height=784,role=raw
ipu3.cpp:201 CIO2 configuration: 4224x3136-SGRBG10_IPU3
ipu3.cpp:216 Validating stream: 1056x784-SGRBG10_IPU3
ipu3.cpp:227 Assigned 4224x3136-SGRBG10_IPU3 to the raw stream
ipu3.cpp:297 Stream 0 configuration adjusted to 4224x3136-SGRBG10_IPU3
Camera configuration adjusted

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-02-05 14:22:15 +01:00
Jacopo Mondi
f29601efc4 android: camera_device: Report HOT_PIXEL_MAP_MODE as OFF
The CaptureResultTest#testCameraCaptureResultAllKeys enforces the
presence of the ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE result
metadata.

Report ANDROID_STATISTICS_HOT_PIXEL_MAP_MODE_OFF as the Camera HAL
does not support the generation of an hot pixel correction map.

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-02-05 13:25:30 +01:00
Jacopo Mondi
5360d807b4 android: camera_device: Report sensor test pattern mode
The CaptureResultTest#testCameraCaptureResultAllKeys enforces the
presence of the ANDROID_SENSOR_TEST_PATTERN_MODE result metadata.

Report the only supported value of ANDROID_SENSOR_TEST_PATTERN_MODE_OFF.

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-02-05 13:24:22 +01:00
Jacopo Mondi
d77233be82 libcamera: ipu3: Always report crop region
Report the crop region for every completed request.

The crop region is initialized as the sensor's analogue crop
rectangle and updated when a Request with a new region completes.

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-02-05 13:22:51 +01:00
Jacopo Mondi
9690d082ec android: camera_device: Report AF_MODE_OFF in template
The CaptureResultTest#testCameraCaptureResultAllKeys CTS test
enforces the presence of the auto focus mode in the preview
request template.

Add the only supported mode AF_MODE_OFF in the generated template.

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-02-05 13:08:01 +01:00
Jacopo Mondi
f266c0eb9c android: camera_device: Use AF_MODE_OFF in scene override
The camera HAL does currently list AF_MODE_OFF as the only supported
auto-focus mode in the ANDROID_CONTROL_AF_AVAILABLE_MODES static
metadata. For this reason reporting AF_MODE_AUTO as scene override
is wrong.

At the moment scene override is disabled in the Camera HAL, but this
is worth a fix nonetheless.

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-02-05 13:07:05 +01:00
Jacopo Mondi
e9c2875aea android: camera_device: Report AE_EXPOSURE_COMPENSATION
The CaptureResultTest#testCameraCaptureResultAllKeys enforces the
presence of the ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION result
metadata.

Report 0 as the current value for
ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION in the result metadata
pack.

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-02-05 13:06:45 +01:00
Jacopo Mondi
520c3664bc android: camera_device: Report COLOR_CORRECTION_ABERRATION_MODE
The CaptureResultTest#testCameraCaptureResultAllKeys enforces the
presence of the ANDROID_COLOR_CORRECTION_ABERRATION_MODE result
metadata.

Report the only supported value of
ANDROID_COLOR_CORRECTION_ABERRATION_MODE_OFF.

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-02-05 13:03:36 +01:00
Niklas Söderlund
a3c75bba84 cam: Only queue the exact number of requests asked for
The cam option --capture=N is suppose to only capture N requests. But if
the processing done for each request is large (such as writing it to a
slow disk) the current implementation could queue more than N requests
before the exit condition is detected and capturing stopped.

Solve this by only queueing N requests while still waiting for N
requests to complete before exiting.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05 11:10:29 +01:00
Niklas Söderlund
5b60b689c1 cam: event_loop: Execute events in the libevent loop
Cam uses libevent to deal with threads and idle loop while still
implementing its own event queue. This creates issues when the event
loop is terminated as it might get stuck in the idle loop if exit() is
called while the thread is busy with dispatchCalls().

Solve this by removing the custom event execution and instead injecting
the calls as events to the base event loop.

Reported-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05 11:10:29 +01:00
Niklas Söderlund
297c9c3fa0 cam: event_loop: Rename event_ to base_
The 'event' variable name is usually used for events added to the base
event loop, not the loop itself. Rename the struct event_base member to
base_ as a preparation for future work adding events to the loop.

There is no functional change.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05 11:10:29 +01:00
Niklas Söderlund
9708f49fec libcamera: ipu3: Share parameter and statistic buffers with IPA
Use the IPU3Frames helper to share parameters and statistics buffers
with the IPA. Track which parameter and statistic buffer is used for
which request and make sure the parameter buffers is filled in by the
IPA before it's needed and that the statistic buffer is consumed and
meta data generated before completing the request.

With this change the IPU3 pipeline is prepared to fully operate with an
IPA component.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-05 01:20:32 +01:00