Commit graph

2203 commits

Author SHA1 Message Date
Hirokazu Honda
9109bcf22c subprojects: Add libyuv and built if -Dandroid=enabled
Android HAL adaptation layer may need image processing, for
example, scaling and format conversion. Libyuv is a general image
processing. This adds libyuv to subprojects, so that it is forked
locally and can be used with Android HAL implementation code.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-04 05:03:53 +02:00
Helen Koike
5b568b7e41 libcamera: v4l2_videodevice: remove confusing memory MMAP assignment before QUERYBUF
QUERYBUF doesn't require the memory field to be pre-filled.
Also, V4L2VideoDevice::createBuffer uses dmabuf file descriptors, thus
using V4L2_MEMORY_MMAP makes things confusing, so remove it.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-02-04 01:45:44 +02:00
Hirokazu Honda
fb9051ff74 android: post_processor: Change the type destination in process()
The type of the destination buffer in PostProcessor::process() is
libcamera::Span. libcamera::Span is used for one dimension buffer
(e.g. blob buffer). The destination can be multiple dimensions
buffer (e.g. yuv frame). Therefore, this changes the type of the
destination buffer to MappedFrameBuffer.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-02 19:14:14 +01:00
Jacopo Mondi
bc6440792b libcamera: Improve Request life cycle tracking
The current logging to track the status of a Request when running the
Android camera HAL provide the following information:

When a Request is queued to libcamera:
HAL camera_device.cpp:1776 '\_SB_.PCI0.I2C2.CAM0': Queueing Request to libcamera with 1 HAL streams

When a Request completes:
Request request.cpp:268 Request has completed - cookie: 138508601719648

The queueing of a Request reports the number of streams it contains
while the completion of a Request reports the address of the associated
cookie.

This makes very hard to keep track of what Requests have completed, as
the logging associated with a queue/complete event does not allow to identify
a Request easily.

Add two more printouts to make it easier to track a Request life cycle.
To make it possible to print the Request cookie in the CameraDevice
class add a method to access it from the CameraRequest class.

The result looks like the following trace:

Request request.cpp:92 Created request - cookie: 140701719392768
HAL camera_device.cpp:1710 '\_SB_.PCI0.I2C2.CAM0': Queueing request 140701719392768 with 1 streams
HAL camera_device.cpp:1747 '\_SB_.PCI0.I2C2.CAM0': 0 - (4160x3104)[0x00000023] -> (4160x3104)[NV12] (direct)
...
Request request.cpp:268 Request has completed - cookie: 140701719392768
HAL camera_device.cpp:1800 '\_SB_.PCI0.I2C2.CAM0': Request 140701719392768 completed with 1 streams..

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-02 18:50:03 +01:00
Jacopo Mondi
3e952cfb0f libcamera: ipu3: cio2: Fix line break
The function declaration fits on one line.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-02 18:48:46 +01:00
David Plowman
a2fec12667 ipa: raspberrypi: alsc: Fix copy-paste error in debug statement
Reported-by: Coverity CID=309689
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-02 17:18:18 +00:00
David Plowman
49bae441ed ipa: raspberrypi: Warn when control algorithms are missing; do not fail
Users are free to avoid loading certain control algorithms from the
json tuning file if they wish, and this could mean that some libcamera
controls will therefore not be available. Currently we don't have a
good means of indicating which these are, therefore failing completely
when an application tries to use one is unhelpful - it is better just
to issue a warning.

Note that once we can indicate this properly, applications should
check for supported controls as this change may be reverted.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-02 17:13:35 +00:00
Jacopo Mondi
94d42ce014 android: camera_device: Use reference to settings
In preparation to use the keys part of a capture request to
fill in the result metadata, create a reference to
descriptor_->settings_.

While at it, move the 'ret' variable declaration to the beginning of
the function and rename it in 'found', as it will be used in many
places and move the \todo comment up as it applies to all metadata
whose value is copied from settings.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-02 13:09:51 +01:00
Jacopo Mondi
da4b325f41 android: camera_device: Add missing request keys
The Camera HAL does not report all the Request keys which are
mandatory for the advertised BACKWARD_COMPATIBLE capabilities
level. Add them.

This fixes the CTS test:
android.hardware.camera2.cts.StaticMetadataTest#testCapabilities

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-02 13:09:50 +01:00
Jacopo Mondi
6741ab8919 android: camera_device: Alphabetically sort keys
The vectors of available characteristics, request and result keys
are not sorted. This makes more complex than necessary spotting
duplication of keys.

Re-sort the vectors initializer lists alphabetically.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-02-02 13:09:50 +01:00
Laurent Pinchart
040a6dcfbc libcamera: formats: Add RGB565_BE format
This new format corresponds to the V4L2 V4L2_PIX_FMT_RGB565X format, and
is the big-endian version of the DRM_FORMAT_RGB565 format.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-02-01 22:34:13 +02:00
Laurent Pinchart
7c496f1c54 utils: gen-formats: Support big-endian DRM formats
DRM 4CCs are defined in little-endian, and can be declined in a
big-endian version by setting bit 31 (DRM_FORMAT_BIG_ENDIAN) in the 4CC
value.

Add support for such formats in the gen-formats.py script.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-02-01 22:33:55 +02:00
Paul Elder
78f49d5e34 android: camera_device: Fix exposure time tag in exif and android
The ExposureTime libcamera control is in microseconds while android and
our exif component use nanoseconds. Convert it appropriately.

CTS also expects the ExposureTime exif tag to match the ExposureTime set
in the android result metadata. Fix it.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-02-01 09:41:40 +09:00
Jean-Michel Hautbois
c763ae023d Revert "libcamera: Use helper variable template for type traits"
Some applications may not be compliant with C++17 (Chromium, as an
example). Keep the C++17 features for libcamera internals, and C++14
compliance for public API.

This reverts commit 6cbdc28599.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-01-31 17:52:17 +02:00
Jean-Michel Hautbois
33bfe7b7ef Revert "libcamera: span: Provide and use helper variable templates for type traits"
Some applications may not be compliant with C++17 (Chromium, as an
example). Keep the C++17 features for libcamera internals, and C++14
compliance for public API.

This reverts commit 8e42c2feb7.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-01-31 17:52:07 +02:00
Niklas Söderlund
3809fd7746 libcamera: pipeline: rkisp1: Avoid race when processing parameter buffers
When moving the pipeline away from the Timeline design it was discovered
that the design of queuing the buffers to the device as soon as possible
was not the best idea. The parameter buffers were queued to the device
before the IPA had processed them and this violates the V4L2 API.

Fix this by waiting to queue any buffer to the device until the IPA has
filled in the parameters buffer.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Tested-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-01-29 15:35:28 +01:00
Niklas Söderlund
2b57d712a2 libcamera: pipeline: rkisp1: Remove Timeline
There are no users left of the Timeline and there is no longer a need to
keep emulating a start of exposure event as the CSI-2 resciver reports
it. Remove the Timeline helper and what's left of it's integration in
the pipeline.

There is no functional change as nothing i the pipeline uses the
Timeline.

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-01-29 15:35:28 +01:00
Niklas Söderlund
ea8b576a8c libcamera: pipeline: rkisp1: Use SOF event to warn about late parameters
In the Timeline approach the idea was to delay queuing buffers to the
device until the IPA had a chance to prepare the parameters buffer. A
check was still added to warn if the IPA queued buffers before the
parameters buffer was filled in.

This check happened much sooner then needed as the parameter buffers
does not have to be ready when the buffer is queued but just before it's
consumed. As the pipeline now has true knowledge of each SOF we can move
the check there and remove the delaying of queuing of buffers.

This change really speeds up the IPA reactions as the delays used in the
Timeline where approximated while with this change they are driven by
events reported by the device.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-29 15:35:28 +01:00
Niklas Söderlund
e174210d7e libcamera: pipeline: rkisp1: Use delayed controls
Instead of setting controls using the RkISP1 local Timeline helper use
the DelayedControls. The result is the same, the controls are applied
with a delay.

The values of the delays are however different between the two methods.
The values used in the Timeline solution were chosen after some
experimentation and the values used in DelayedControls are taken from a
generic sensor. None of the two are a perfect match as the delays can be
different for different sensors used with the pipeline.

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-01-29 15:35:28 +01:00
Niklas Söderlund
d8595ebf20 libcamera: camera_sensor: Expose the camera device
Expose the device backing the CameraSensor instance.

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-01-29 15:35:28 +01:00
Niklas Söderlund
82eb3f7e6d libcamera: raspberrypi: Remove StaggeredCtrl
There are no users left, remove it.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2021-01-29 15:35:28 +01:00
Niklas Söderlund
85f2a5c134 libcamera: raspberrypi: Switch to DelayedControls
Use the libcamera core helper DelayedControls instead of the local
StaggeredCtrl. The new helper is modeled after the StaggeredCtrl
implementation and behaves the same.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-01-29 15:35:28 +01:00
Niklas Söderlund
5023ad293d test: delayed_controls: Add test case for DelayedControls
Add a test case for DelayedControls that exercises the setting of
controls and reading back what controls were used for a particular
frame. Also exercise corner cases such as a V4L2 device that does not
reset its sequence number to 0 at stream on and sequence number wrapping
around the uint32_t value space.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-29 15:35:28 +01:00
Niklas Söderlund
3d4b7b0059 libcamera: delayed_controls: Add helper for controls that apply with a delay
Some sensor controls take effect with a delay as the sensor needs time
to adjust, for example exposure. Add an optional helper DelayedControls
to help pipelines deal with such controls.

The idea is to provide a queue of controls towards the V4L2 device and
apply individual controls with the specified delay with the aim to get
predictable and retrievable control values for any given frame. To do
this the queue of controls needs to be at least as deep as the control
with the largest delay.

The DelayedControls needs to be informed of every start of exposure.
This can be emulated but the helper is designed to be used with this
event being provide by the kernel through V4L2 events.

This helper is based on StaggeredCtrl from the Raspberry Pi pipeline
handler but expands on its API. This helpers aims to replace the
Raspberry Pi implementations and mimics it behavior perfectly.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2021-01-29 15:35:28 +01:00
Paul Elder
958c80a4f1 android: camera_device: Set AE precapture trigger according to request
Set the AE precapture triggler tag in the android result metadata
according to what was passed in the request metadata.

This allows the following CTS test to pass:
- android.hardware.camera2.cts.StillCaptureTest#testAePrecaptureTriggerCancelJpegCapture

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-29 19:30:19 +09:00
Paul Elder
ab72e6641c android: jpeg: Set thumbnail and JPEG quality based on request
Set the thumbnail quality and the JPEG quality based on the android
request metadata.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-27 12:07:21 +09:00
Paul Elder
a6de3f0203 android: camera_device: Cache request metadata
The settings in an android capture request may be null, in which case
the settings from the most recently submitted capture request should be
used. Cache the request settings to achieve this.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-27 12:07:17 +09:00
Paul Elder
1264628d3c android: jpeg: Configure thumbnailer based on request metadata
Configure the thumbnailer based on the thumbnail parameters given by the
android request metadata. Only the thumbnail encoder needs to be
configured, and since it is only used at post-processing time, move the
configuration out of the post-processor constructor and into the
processing step.

Also set the following android result metadata tags:
- ANDROID_JPEG_THUMBNAIL_SIZE
- ANDROID_JPEG_THUMBNAIL_QUALITY

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-01-27 12:07:14 +09:00
Paul Elder
abfabdd6e7 android: Set result metadata and EXIF fields based on request metadata
Set the following android result metadata:
- ANDROID_LENS_FOCAL_LENGTH
- ANDROID_LENS_APERTURE
- ANDROID_JPEG_GPS_TIMESTAMP
- ANDROID_JPEG_GPS_COORDINATES
- ANDROID_JPEG_GPS_PROCESSING_METHOD

And the following EXIF fields:
- GPSDatestamp
- GPSTimestamp
- GPSLocation
  - GPSLatitudeRef
  - GPSLatitude
  - GPSLongitudeRef
  - GPSLongitude
  - GPSAltitudeRef
  - GPSAltitude
- GPSProcessingMethod
- FocalLength
- ExposureTime
- FNumber
- ISO
- Flash
- WhiteBalance
- SubsecTime
- SubsecTimeOriginal
- SubsecTimeDigitized

Based on android request metadata.

This allows the following CTS tests to pass:
- android.hardware.camera2.cts.StillCaptureTest#testFocalLengths
- android.hardware.camera2.cts.StillCaptureTest#testJpegExif

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-27 12:07:08 +09:00
Paul Elder
229653a59b android: camera_device: Load make and model from platform settings
In ChromeOS the camera make and model is saved in
/var/cache/camera/camera.prop. Load and save these values at
construction time, if available.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-27 12:07:05 +09:00
Paul Elder
3a3f6ae22e android: jpeg: exif: Add functions for setting various values
Add functions for setting the following EXIF fields:

- GPSDatestamp
- GPSTimestamp
- GPSLocation
  - GPSLatitudeRef
  - GPSLatitude
  - GPSLongitudeRef
  - GPSLongitude
  - GPSAltitudeRef
  - GPSAltitude
- GPSProcessingMethod
- FocalLength
- ExposureTime
- FNumber
- ISO
- Flash
- WhiteBalance
- SubsecTime
- SubsecTimeOriginal
- SubsecTimeDigitized

These are in preparation for fixing the following CTS tests:

- android.hardware.camera2.cts.StillCaptureTest#testFocalLengths
- android.hardware.camera2.cts.StillCaptureTest#testJpegExif

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-27 12:06:59 +09:00
Paul Elder
e5b6774422 android: jpeg: exif: Fix setOrientation EXIF values
The input to setOrientation is angle clockwise from the sensor
orientation, while the EXIF output values were swapped for 90
and 270 degrees.

From the EXIF spec:

6 = The 0th row is the visual right-hand side of the image, and the
    0th column is the visual top.
8 = The 0th row is the visual left-hand side of the image, and the
    0th column is the visual bottom.

6 should be 90 degrees clockwise, while 8 should 270 degrees clockwise.
Fix this.

As Android defines the rotation as the clockwise angle by which the
image needs to be rotated to appear in the correct orientation on the
device screen, the previous values would be correct if the input angle
was from the camera orientation. Since the correct input should be the
requested JPEG orientation, these new values are the correct ones.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-27 12:06:55 +09:00
Paul Elder
d81e26d360 android: jpeg: exif: Expand setString to support different encodings
GPSProcessingMethod and UserComment in EXIF tags can be in UTF-16.
Expand setString to take an encoding when the field type is undefined.
Update callers accordingly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-27 12:06:51 +09:00
Naushir Patuck
34897234d1 ipa: raspberrypi: Cast FrameDurations limits to 64-bit integer
At startup, ControlInfoMap::generateIdmap() threw a log message warning
that the controls::FrameDurations had a type mismatch based on the
min/max values provided in libcamera::RPi::Controls initialiser.

Fix this warning by forcing the integer constants to be 64-bit wide by
using the INT64_C() macro.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
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>
2021-01-27 01:57:55 +02:00
David Plowman
a258aa4615 ipa: raspberrypi: Remove legacy Rasberry Pi logging
Signed-off-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-01-26 10:46:12 +02:00
David Plowman
d97b1bcd2a ipa: raspberrypi: Replace Raspberry Pi debug with libcamera debug
This commit deals with all the "small" algorithms (that is, not
Agc/Awb/Alsc). A few unnecessary debug messages have also been
removed.

Signed-off-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-01-26 10:46:10 +02:00
David Plowman
eb605eab5b ipa: raspberrypi: awb: Replace Raspberry Pi debug with libcamera debug
Signed-off-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-01-26 10:46:07 +02:00
David Plowman
b2186c2b89 ipa: raspberrypi: alsc: Replace Raspberry Pi debug with libcamera debug
Some unhelpful debug messages have been removed.

Signed-off-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-01-26 10:46:06 +02:00
David Plowman
15d3970c0c ipa: raspberrypi: controller: Replace Raspberry Pi debug with libcamera debug
Some unhelpful debug statements have been removed.

Signed-off-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-01-26 10:45:58 +02:00
Jacopo Mondi
3e979d7266 android: camera_device: Report the required dynamic metadata
The list of dynamic metadata reported by the Camera HAL is currently
very limited.

Augment the number of reported metadata in order to fix errors
reported by the android.hardware.camera2.cts.CaptureRequestTest test
module.

The test module still fails in 2 tests because of the missing
android.sensor.info.maxFrameDuration static metadata.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-25 15:20:36 +01:00
Jacopo Mondi
af088b88f5 android: camera_device: Support AWB_AUTO
Claim support for the AWB_AUTO mode in the
ANDROID_CONTROL_AWB_AVAILABLE_MODES static metadata.

This fixes the CTS test error:
android.hardware.camera2.cts.CaptureRequestTest#testAwbModeAndLock fail
The static info key 'android.control.awbAvailableModes'
All camera devices must support AUTO mode

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-01-25 15:20:36 +01:00
Jacopo Mondi
bb2b400638 android: camera_device: Handle SCALER_CROP_REGION
Handle the SCALER_CROP_REGION control and dynamic metadata by
translating it from the Android format to the associated libcamera
control when processing a request, and the other way around when
handling a request completion.

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-01-25 15:20:36 +01:00
Jacopo Mondi
953403288e libcamera: ipu3: Report ScalerCrop in metadata
Report in the Request metadata the scaler crop region as requested by
application through the request controls. No actual scaling is applied
in the pipeline at the moment.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-25 15:20:36 +01:00
Jacopo Mondi
31a1a628cd android: camera_device: Register MAX_DIGITAL_ZOOM
Register the ANDROID_SCALER_AVAILABLE_MAX_DIGITAL_ZOOM static metadata
inspecting the ScalerCrop control's limits.

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-01-25 15:20:36 +01:00
Jacopo Mondi
2cd841491e libcamera: ipu3: Register ScalerCrop control
Register the ScalerCrop control in the ImgU pipeline handler computed
by using the Viewfinder [1280x720] pipeline output configuration and
the sensor resolution as parameters.

The ScalerCrop control limits should be updated every time a new
configuration is applied to the sensor.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-25 15:20:36 +01:00
Jacopo Mondi
c9705a5e4b android: camera_device: Report EXPOSURE_TIME
Instead of reporting a fake value in the dynamic metadata for the
EXPOSURE_TIME control, use the value provided by the pipeline.

The metadata is only meaningfull in FULL mode.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-25 14:55:45 +01:00
Jacopo Mondi
753d7536b7 android: camera_device: Register EXPOSURE_TIME_RANGE
Register the EXPOSURE_TIME_RANGE static metadata inspecting the
ExposureTime control limits as reported by the camera.

If such information is not available, do not register the property.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-25 14:55:45 +01:00
Jacopo Mondi
bc79e06531 libcamera: ipu3: Register Exposure control
Calculate the controls::Exposure limits at camera registration time
and register it in the list of camera supported controls.

Cache the default exposure value to report it in the request metadata.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-25 14:55:43 +01:00
Jacopo Mondi
021752924b libcamera: camera_sensor: Make V4L2_CID_EXPOSURE mandatory
Add the V4L2_CID_EXPOSURE control to the list of mandatory controls the
sensor driver has to report and document this new requirement.

While at it, re-sort the mandatory V4L2 controls in alphabetical
order in the CameraSensor class and remove the above comment as
the usage of the controls is better reported in the documentation.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-25 14:54:04 +01:00
Jacopo Mondi
db19dcb75d libcamera: CameraSensor: Mention V4L2 in get/setControls()
The current CameraSensor interface for reading and writing controls
is currently based on V4L2 controls.

Mention that more clearly in the documentation and, while at it, re-sort
the documentation to match the methods declaration order.

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-01-25 14:53:16 +01:00