Commit graph

1738 commits

Author SHA1 Message Date
Chris Chinchilla
33fe27741b Documentation: Guides: Pipeline Handler Writer's Guide
Introduce a pipeline-handler writers guide to provide a walk through of
the steps and concepts required to implement a new Pipeline Handler.

Signed-off-by: Chris Chinchilla <chris@gregariousmammal.com>
[Reflow/Rework, update to mainline API]
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
[Further reworks and review]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-20 16:56:13 +01:00
Chris Chinchilla
b704efeb86 Documentation: Guides: Application Writer's Guide
Provide a tutorial and walk through guide for writing an applications
with libcamera.

Signed-off-by: Chris Chinchilla <chris@gregariousmammal.com>
[Reflow/Rework, update to mainline API]
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
[Further reworks and review]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-20 16:56:13 +01:00
Chris Chinchilla
7b1516210b Documentation: Guides: Developer's Guide to libcamera
Create an introduction and overview for new developers to libcamera.

Provide an overview of the Camera Stack, and Architecture of libcamera
and introduce the main concepts of libcamera.

Signed-off-by: Chris Chinchilla <chris@gregariousmammal.com>
[Kieran: Rework/Reflow, add diagrams, licensing]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-20 16:56:07 +01:00
Niklas Söderlund
54ca46968a libcamera: camera: Mark controls() and properties() as const operations
Reading the controls and properties does not modify the camera's state
and can be marked as const operations.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-16 13:50:03 +02:00
Niklas Söderlund
0b9d8eb265 libcamera: pipeline_handler: Mark controls() and properties() as const operations
Reading the controls and properties does not modify the pipeline's state
and can be marked as const operations.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-16 13:50:03 +02:00
Niklas Söderlund
ef5f5c4db0 libcamera: pipeline_handler: Add const version of cameraData()
Add a version of cameraData() that returns a const pointer and mark it
as a const operation. The assert in the non-const version of the
function already enforces that a std::map::at() operation would always
succeed so there is no change in operation from the non-const version.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-16 13:49:07 +02:00
Niklas Söderlund
27869c5f64 libcamera: request: Make Stream pointer const
The Stream pointer just acts as a key in the Request object. There is no
good use-case to modify a stream from a pointer retrieved from the
Request, make it const. This allows pipeline handlers to better express
that the Stream pointer is retrieved in a Request should just be treated
as a key.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-14 13:19:15 +02:00
Niklas Söderlund
dac8e9552c libcamera: request: Declare a using directive for map of buffers
Declare a using directive for the map of Stream to FrameBuffer. Update
all users of Request::buffers() to use the new usage directive.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-14 13:19:15 +02:00
Umang Jain
02018a7d02 test: ipc: unixsocket: Close open fds on error paths
Reported-by: Coverity CID=279099
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-13 11:05:58 +01:00
Niklas Söderlund
6b88163343 cam: Rename cameraName variable
When converting Camera::name() to Camera::id() one variable in cam was
left unnoticed, rename it to cameraId.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-10 17:38:56 +02:00
Niklas Söderlund
c29ee8ef73 libcamera: pipeline: rkisp1: Fix array size of formats
When switching from V4L2 to DRM pixel formats V4L2_PIX_FMT_GREY was
dropped form the list of supported formats but the arrays size was never
decreased, fix this.

Fixes: 448716d8f7 ("libcamera: Switch PixelFormat to DRM FourCC values")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-10 17:38:54 +02:00
Kieran Bingham
83ae84eb13 android: camera_device: Support MJPEG stream construction
MJPEG streams must be created referencing a libcamera stream.
This stream may already be provided by the request configuration,
in which case the existing stream is utilised.

If no compatible stream is available to encode, a new stream is requested
from the libcamera configuration.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 15:46:25 +01:00
Kieran Bingham
998f4de65e android: Introduce JPEG encoding
Provide an encoder interface and implement a JPEG encoder using libjpeg.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 15:46:02 +01:00
Kieran Bingham
c09aee4ccb android: camera_device: Generate ResultMetadata earlier
Generate the ResultMetadata before performing JPEG compression so that
JPEG specific metadata can be added to the metadata when it has been
processed.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 15:44:02 +01:00
Kieran Bingham
9f07aebde8 android: camera_device: Report configuration changes from validate()
When we call validate on a configuration, if there are any adjustments
on the configuration, we fail without showing why.

Display the stream configuration after the validate stage to aid
debugging stream startup failures.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 15:44:02 +01:00
Kieran Bingham
6bc652ee1c android: camera_device: Query plane length
Use lseek to query the length of planes where possible rather than leaving
the plane.length as zero, which prevents mapping buffers for software
processing.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 15:44:02 +01:00
Kieran Bingham
f4c65be7b3 android: camera_device: Only construct required planes
The camera3buffer describes the number of filedescriptors given.
Don't try to construct more planes than that.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 15:44:02 +01:00
Kieran Bingham
8ad1b9ca22 android: camera_device: Report an error in notifyError()
If an error is generated, try to be verbose about it in the libcamera logs.

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 15:44:01 +01:00
Kieran Bingham
98986e0b57 android: camera_device: Fix trivial spelling
Fix the spelling of 'successfully' reported in an error message.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 15:44:01 +01:00
Kieran Bingham
ca6ae87af4 libcamera: buffer: Convert copyFrom to use MappedFrameBuffer
Utilise the new MappedFrameBuffer helper to handle all mapping and
unmapping of the copyFrom helper function.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 15:44:00 +01:00
Kieran Bingham
e5b829ee53 test: mapped-buffers: Provide MappedBuffer test
Provide initial testing framework for the MappedBuffer component.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 15:44:00 +01:00
Kieran Bingham
b3383da79f libcamera: buffer: Create a MappedBuffer
Provide a MappedFrameBuffer helper class which will map
all of the Planes within a FrameBuffer and provide CPU addressable
pointers for those planes.

The MappedFrameBuffer implements the interface of the MappedBuffer
allowing other buffer types to be constructed of the same form, with a
common interface and cleanup.

This allows MappedBuffer instances to be created from Camera3Buffer types.

Mappings are removed upon destruction.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 15:43:59 +01:00
Kieran Bingham
38ca814e97 libcamera: formats: add numPlanes helper
Determine the number of planes used by a format by counting the number
of PixelFormatPlaneInfo entries with a valid entry.

Reviewed-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>
2020-08-06 15:43:59 +01:00
Kieran Bingham
000257a707 libcamera: buffer: Correct FrameBuffer references
Update the remaining (capitalised) Buffer references to the new FrameBuffer
object that they refer to.

Lower-case 'buffer' terms are kept, as a generic reference to a buffer
rather than the specific type 'FrameBuffer'.

Reviewed-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>
2020-08-06 15:43:59 +01:00
Niklas Söderlund
f32261f257 libcamera: Add build time to version string for dirty builds
Having the build time in the version string is useful when building from
a dirty worktree and deploying to targets as a quick way to identify the
binary has been deployed successfully.

Before this change the version string is reported as

    libcamera v0.0.0+1692-aaff196a-dirty

While with this change the version string is reported as

    libcamera v0.0.0+1692-aaff196a-dirty (2020-08-05T22:42:18+02:00)

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 16:20:15 +02:00
Umang Jain
035ee23910 android: camera_device: Initialize 'id_' field in constructor
A 'id' is passed when a new CameraDevice is constructed in order for
unique identification. Failing to initialize it,  will lead to the
issue of garbage return value via CameraDevice::id().

Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 12:57:06 +01:00
Umang Jain
af28a80647 android: camera_ops: Fix a documentation spelling typo
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 12:56:42 +01:00
Umang Jain
aea5ace7c3 android: camera_hal_manager: Remove unused getStaticMetadata() method
The CameraHalManager::getStaticMethod() method isn't used, remove it.

Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-06 12:56:16 +01:00
Niklas Söderlund
673201c4d5 libcamera: camera_manager: Enforce unique camera IDs
The camera ID is documented that it should be unique but it's not
enforced. Change this by refusing to add cameras to the CameraManager
that would create two cameras with the exact same ID.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-05 20:07:13 +02:00
Niklas Söderlund
2e7c80a4f9 libcamera: camera: Rename name() to id()
Rename Camera::name() to camera::id() to better describe what it
represents, a unique and stable ID for the camera. While at it improve
the documentation for the camera ID to describe it needs to be stable
for a camera between resets of the system.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-05 20:07:13 +02:00
Niklas Söderlund
53d38b19ed libcamera: pipeline: uvcvideo: Generate unique camera names
Generate camera names that are unique and persistent between system
resets. The name is constructed from the USB device information as well
as the USB controller on the host.

Before this change example of camera names:

Venus USB2.0 Camera: Venus USB2
Logitech Webcam C930e

After this change the same cameras are:

\_SB_.PCI0.RP05.PXSX-2.1.1:1.0-0ac8:3420
\_SB_.PCI0.RP05.PXSX-2.4:1.0-046d:0843

On OF-based system:

/base/soc/usb@7e980000/usb-port@1-1.2:1.0-0ac8:3420

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-05 20:07:13 +02:00
Niklas Söderlund
75a9aebee5 libcamera: pipelines: Use sensor ID as camera name
Use the CameraSensor ID as the camera name in pipelines that uses a
CameraSensors, this is done in preparation of turning the camera name
into an ID. The CameraSensor ID meets the requirements that will be put
on camera ID.

Before this change example of camera names:

* OF based systems
    ov5695 7-0036
    ov2685 7-003c

* ACPI based systems
    ov13858 8-0010
    ov5670 10-0036

* VIMC
    VIMC Sensor B

After this change the same cameras are:

* OF based systems
    /base/i2c@ff160000/camera@36
    /base/i2c@ff160000/camera@36

* ACPI based systems
    \_SB_.PCI0.I2C2.CAM0
    \_SB_.PCI0.I2C4.CAM1

* VIMC
    platform/vimc.0 Sensor B

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-05 20:07:13 +02:00
Niklas Söderlund
082a5b2dfe libcamera: camera_sensor: Add accessors for sensor ID
Add an accessors so that the sensor ID can be used outside CameraSensor.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-05 20:07:13 +02:00
Niklas Söderlund
f23e6127ad libcamera: camera_sensor: Generate a sensor ID
The ID is generated from information in the firmware description of the
sensor if available or from module and model information if the sensor
is virtual (for example VIMC).

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>
2020-08-05 20:07:13 +02:00
Niklas Söderlund
1869d1b312 libcamera: v4l2_device: Add method to lookup device path
Add a method to lookup a V4L2 devices path in sysfs.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-05 20:07:13 +02:00
Niklas Söderlund
39efe73774 libcamera: sysfs: Add helper to lookup device firmware node path
A system's firmware description is recorded differently in sysfs
depending if the system uses DT or ACPI. Add a helper to abstract
this, allowing users not to care which of the two are used.

For DT-based systems, the path is the full name of the DT node that
represents the device. For ACPI-based systems, the path is the absolute
namespace path to the ACPI object that represents the device. In both
cases, the path is guaranteed to be unique and persistent as long as the
system firmware is not modified.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-05 20:07:13 +02:00
Niklas Söderlund
6ad3258cd3 libcamera: sysfs: Add helper to lookup sysfs path of a character device
Add a helper function to lookup the sysfs path of a character device.
Store the function in a new libcamera::sysfs namespace as there is not
class to host it.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-05 20:07:13 +02:00
David Plowman
79a834f24c libcamera: ipa: raspberrypi: ALSC: Improve behaviour when camera mode changes
Now that we stop the asynchronous thread on a SwitchMode, we would do
better to regenerate all the tables if the new camera mode crops in a
significantly different way to the old one. A few minor tweaks make
sense along with this:

* Reset the lambda values when we reset everything. It wouldn't make
  sense to re-start with the old mode's values.

* Use the last recorded colour temperature to generate new tables rather
  than any default value.

* Set the frame "phase" counter to ensure the adaptive procedure will
  run asap.

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>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2020-08-05 17:49:00 +03:00
David Plowman
7f6b9121cc libcamera: ipa: raspberrypi: ALSC: Resample luminance table
This fixes a bug where the luminance correction table was not being
resampled according to the camera mode, in the same way as the colour
tables. This could be noticeable if any camera modes crop
aggressively.

This resampling can be done "up front" in the SwitchMode, as we have
only a single fixed luminance table. In order to protect the
recalculation of the table from the asynchronous thread (which reads
it) I've elected to wait for that thread to go idle (though I doubt it
would have mattered much). As a by-product of stopping the thread, it
no longer needs its own copy of the camera mode (async_camera_mode_).

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>
2020-08-05 17:48:55 +03:00
David Plowman
db552b0b92 libcamera: ipa: raspberrypi: ALSC: Improve locking in a few places
Fix up a few locations where we call notify_one() with the lock
held. In particular, restartAsync does not need to be called with the
lock held for its entire duration.

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>
2020-08-05 17:48:55 +03:00
David Plowman
3a680a667f libcamera: ipa: raspberrypi: ALSC: Camera mode does not need to be atomic
In the libcamera framework, SwitchMode (which overwrites the
camera_mode) cannot run concurrently with Prepare (which uses it).

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>
2020-08-05 17:48:55 +03:00
Jacopo Mondi
09b1d0fced android: camera_device: Fix preview template
Add 5 controls to the generate preview template to comply with the
camera3 specification.

This change fixes CTS 9.0.r12 test:
android.hardware.camera2.cts.CameraDeviceTest#testCameraDevicePreviewTemplate

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-05 14:36:44 +02:00
Jacopo Mondi
8a02d4451c android: camera_device: Break-out request template
Currently the request template returned from
CameraDevice::constructDefaultRequestSettings() is the same for all
the supported template types.

To prepare to adjust the template depending on the use case, break out
the template generation to a dedicated function that supports the
PREVIEW use case. All the other template types use the
requestTemplatePreview() function and just update the capture intent
property.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-05 14:33:52 +02:00
Jacopo Mondi
29b59a9146 android: camera_metadata: Add method to update an entry
Add a method to update an existing metadata tag entry, by wrapping
the update_metadata_entry() function provided by the Android
metadata library.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-05 14:33:52 +02:00
Jacopo Mondi
3efc7e8834 andrdid: camera_device: Store const templates
The request capture templates stored in the
CameraDevice::requestTemplates_ should not be modified once created.

Store a const pointer to the request templates in the class member
map.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-05 14:33:52 +02:00
Jacopo Mondi
f2d19266a4 android: camera_metadata: Add const version of get()
Add a const version of the CameraMetadata::get() method to retrieve
a const pointer to the camera metadata wrapped by the class instance.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-05 14:33:52 +02:00
Jacopo Mondi
17a21b095a android: camera_metadata: Mark isValid() as const
The CameraMetadata::isValid() method does not modify the object state
and can be called on const instances of the CameraMetadata class.

Mark the method as const to allow that.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-05 14:33:52 +02:00
Niklas Söderlund
1074604c9e cam: Use the common cleanup function on failure
The different error paths in init() are out of sync. Instead of fixing
them switch to using the cleanup() function which does the right thing
for all cases.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2020-08-05 13:01:13 +02:00
Jacopo Mondi
375fef72f8 libcamera: ipu3: Fix compilation issues with gcc5
GCC5 does not provide prototypes for the math library functions defined
in the math.h header for the std:: namespace.

Include the C++ <cmath> header in place of <math.h> as it defines
overloads for the std::abs and std::fmod function.

This goes intentionally against the libcamera coding guidelines, and
is reported as warning by checkpatch.py.

Fixes: 968ab9bad0 ("libcamera: ipu3: imgu: Calculate ImgU pipe configuration")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-05 09:10:53 +02:00
Niklas Söderlund
7876d631d9 android: camera_device: Report RAW capability if supported
Probe the libcamera Camera for RAW support and if supported report RAW
capability in the static metadata reported to Android.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-08-03 23:44:09 +02:00