Commit graph

2984 commits

Author SHA1 Message Date
Jean-Michel Hautbois
9d44551404 libcamera: pipeline_handler: Hide implementation detail comment from doxygen
The comment is a implementation detail and does not belong to API
documentation. Move it inside the function.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-30 07:57:38 +02:00
Andrey Konovalov
43fd7d0fc8 qcam: viewfinder_gl: Add support for RAW8 Bayer formats
This integrates the vertex and the fragment shaders by Morgan McGuire
into qcam.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-30 04:09:10 +03:00
Andrey Konovalov
e4be72d0ca qcam: viewfinder_gl: Set the vertex shader file name in selectFormat()
In preparation to extend the supported formats, make it possible
to use different vertex fragment files depending on the format.
Make "identity.vert" the default choice.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-30 04:08:10 +03:00
Andrey Konovalov
babb5a4c8b qcam: viewfinder_gl: Use SPDX-License-Identifier in bayer_8.* shaders
bayer_8.* vertex and fragment shaders carry the copy of the 2-Clause
BSD License. Replace it with the SPDX-License-Identifier.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-30 04:08:04 +03:00
Andrey Konovalov
12ad227efa qcam: viewfinder_gl: Fix wrong comment in bayer_8.frag
Fetching into value[2] corresponds to E0, and fetching into value[3] - to
F0. The fetch()-es themselves are correct, but the comments were not.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-30 04:07:58 +03:00
Andrey Konovalov
831b3f8132 qcam: viewfinder_gl: Copy the shaders for RAW8 Bayer format from motmot
This commit copies the shaders from:

e36d515805

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Acked-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-30 04:07:58 +03:00
Andrey Konovalov
6424e86407 qcam: viewfinder_gl: Add support for RAW12 packed formats
All the four Bayer orders are supported.
The 4 LS bits of the 12-bit colour values are dropped as the RGBA
format we convert into has only 8 bits per colour.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-30 04:07:58 +03:00
Andrey Konovalov
c4259493dc qcam: viewfinder_gl: Add shader to render packed RAW10 formats
The shader supports all 4 packed RAW10 variants.
Simple bi-linear Bayer interpolation of nearest pixels is implemented.
The 2 LS bits of the 10-bit colour values are dropped as the RGBA
format we convert into has only 8 bits per colour.

The texture coordinates passed to the fragment shader are adjusted
to point to the nearest pixel in the image. This prevents artifacts
when the image is scaled from the frame resolution to the window size.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-30 04:07:58 +03:00
Andrey Konovalov
fa52c0f22f qcam: viewfinder_gl: Change uniform float tex_stepx to vec2 tex_step
In preparation to extend the supported formats, extend the tex_stepx
uniform to cover the steps between texels in both horizontal and
vertical directions.

Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-30 04:07:54 +03:00
Laurent Pinchart
12809ff171 libcamera: pipeline: simple: converter: Improve error message
When the configuration of the converter fails due to format mismatch,
the error messages only indicates that a failure occurred. Improve it to
ease debugging by printing the requested and obtained formats.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-29 00:43:46 +03:00
Laurent Pinchart
535820fe51 libcamera: pipeline: simple: Log pipeline topology
Log the topology for each valid discovered pipeline to aid debugging.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-29 00:43:46 +03:00
David Plowman
ec5d3142a9 libcamera: ipa: raspberrypi: Add support for ov9281 sensor
The necessary tuning file and CamHelper is added for the ov9281 sensor.

The ov9281 is a 1280x800 monochrome global shutter sensor. To enable
it, please add

dtoverlay=ov9281

to the /boot/config.txt file and reboot the Pi.

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-06-28 19:34:46 +03:00
David Plowman
87998e064d libcamera: ipa: raspberrypi: Demote warnings about lack of AWB results
Warnings about the lack of AWB status results are demoted to being
just "Debug". With monochrome sensors becoming more common this would
otherwise overwhelm the console output, and in practice nothing is
really lost as it is normally very evident if AWB is failing to run.

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-06-28 19:33:47 +03:00
David Plowman
bdf04cca08 libcamera: Add support for monochrome sensors
This commit adds support for monochrome (greyscale) raw sensors. These
are sensors that have no colour filter array, so all pixels are the
same and there are no distinct colour channels.

These sensors still require many of an ISP's processing stages, such
as denoise, tone mapping, but not those that involve colours (such as
demosaic, or colour matrices).

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-06-28 19:33:42 +03:00
Jean-Michel Hautbois
8738d539f4 ipa: ipu3: Initialize CameraSensorHelper at IPU3 init stage
In order for the CameraSensorHelper to be instantiated, we need to find
its factory using the camera sensor model name stored in
IPASettings::sensorModel. As we don't need to do it at each configure
call (the sensor is not changing in-between), implement the init call in
IPAIPU3 to do that.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-28 10:54:43 +02:00
Jean-Michel Hautbois
32677e1220 ipa: Create a camera sensor helper class
For various sensor operations, it may be needed to do sensor specific
computations, like analogue gain or vertical blanking.

This commit introduces a new camera sensor helper in libipa which aims
to solve this specific issue.
It is based on the MIPI alliance Specification for Camera Command Set
and implements, for now, only the analogue "Global gain" mode.
Setting analogue gain for a specific sensor is not a straightforward
operation, as one needs to know how the gain is calculated for it.

Three helpers are created in this patch: imx219, ov5670 and ov5693.

Adding a new sensor is pretty straightforward as one only needs to
implement the sub-class for it and register that class to the
CameraSensorHelperFactory.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-06-28 10:48:33 +02:00
Laurent Pinchart
1684c3f930 android: camera_device: Fix null pointer dereference
Commit 7532caa2c7 ("android: camera_device: Reset config_ if
Camera::configure() fails") reworked the configuration sequence to
ensure that the CameraConfiguration pointers gets reset when
configuration fails. This inadvertently causes a null pointer
dereference, as the CameraStream constructor accesses the camera
configuration through CameraDevice::cameraConfiguration() before the
internal config_ pointer is set.

Fix this by passing the configuration pointer explicitly to the
CameraStream constructor.

Fixes: 7532caa2c7 ("android: camera_device: Reset config_ if Camera::configure() fails")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-06-28 10:51:57 +03:00
Laurent Pinchart
d3fef99844 libcamera: utils: Only enable utils::hex() for integer arguments
The utils::hex() function is defined as a function template that has
implementations for integer arguments only. When given a different
argument type, the compiler will not catch the issue, but linking will
fail:

src/libcamera/libcamera.so.p/camera_sensor.cpp.o: in function `libcamera::CameraSensor::validateSensorDriver()':
camera_sensor.cpp:(.text+0x1e6b): undefined reference to `libcamera::utils::_hex libcamera::utils::hex<libcamera::ControlId const*>(libcamera::ControlId const*, unsigned int)'

Move the failure to compilation time by enabling the function for
integer arguments only. This provides better diagnostics:

../../src/libcamera/camera_sensor.cpp: In member function ‘int libcamera::CameraSensor::validateSensorDriver()’:
../../src/libcamera/camera_sensor.cpp:199:77: error: no matching function for call to ‘hex(const libcamera::ControlId*&)’

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-28 08:07:51 +03:00
Laurent Pinchart
9fcef36be6 libcamera: device_enumerator: Fix include order for internal headers
The device_enumerator_sysfs.h and device_enumerator_udev.h internal
headers are not at the correct location. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-28 08:07:35 +03:00
Hirokazu Honda
b8732a80fe android: camera_device: Check if a request is configured on processCaptureRequest()
Add a check on processCaptureRequest() if a given capture
request contains a camera stream that has been configured.

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-06-28 07:51:36 +03:00
Laurent Pinchart
4510638e5d android: mm: cros_camera_buffer: Drop undefined functions
The CameraBuffer::Private::planeAddr() functions are declared but not
defined (and of course not used). Drop them.

Fixes: d8d6a78f22 ("android: Introduce Chromium OS buffer manager")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-06-28 07:45:52 +03:00
Laurent Pinchart
7532caa2c7 android: camera_device: Reset config_ if Camera::configure() fails
The config_ pointer is reset in all error paths of the
CameraDevice::configureStreams() function, except when
Camera::configure() fails. Fix it by using a local unique pointer to
store the configuration until the end of the function, to avoid similar
issues in the future.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-06-28 07:02:44 +03:00
Hirokazu Honda
c11cc6f20b libcamera: CameraSensorProperties: Add test pattern mode of IMX258
Add supported test pattern modes of IMX258 in CameraSensorProperties.

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-06-26 01:07:38 +03:00
Kieran Bingham
fc9b226d19 test: Ensure LIBCAMERA_BASE_PRIVATE isn't public
If LIBCAMERA_BASE_PRIVATE is ever exposed on the libcamera public dependencies,
then the private.h header protection will be circumvented.

Provide a test which will fail (at compile time) if the LIBCAMERA_BASE_PRIVATE
define ever leaks to the public dependencies.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:11 +01:00
Kieran Bingham
5c01d54120 libcamera: rename public libcamera dependency
Now that we have a libcamera_private, make the public only dependency
libcamera_public so that it is clear which interface is being linked.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:11 +01:00
Kieran Bingham
ff7832d2cd libcamera: Move generated headers to private dep
The libcamera_generated_ipa_headers are only a dependency to internal
components, and should not form part of the public API.

Now that we have a private dependency, move the generated headers there.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:11 +01:00
Kieran Bingham
e228c290c9 libcamera/base: Validate internal headers as private
Headers which must not be exposed as part of the public libcamera API
should include base/private.h.

Any interface which includes the private.h header will only be able to
build if the libcamera_private dependency is used (or the
libcamera_base_private dependency directly).

Build targets which are intended to use the private API's will use the
libcamera_private to handle the automatic definition of the inclusion
guard.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:11 +01:00
Kieran Bingham
b71e8c2f39 libcamera/base: Move span to base library
Move span, and adjust the Doxygen exclusion as well.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:11 +01:00
Kieran Bingham
f9ee724307 libcamera/base: Move event_notifier to base
Move the event notifier, and associated header updates.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:10 +01:00
Kieran Bingham
b304bc013e libcamera/base: Move File to base library
The File abstraction is a base helper and not part of the libcamera
API. Move it to to allow usage by users of the base library.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Paul Elder  <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:10 +01:00
Kieran Bingham
27aff949fb libcamera/base: Move extended base functionality
Move the functionality for the following components to the new
base support library:

 - BoundMethod
 - EventDispatcher
 - EventDispatcherPoll
 - Log
 - Message
 - Object
 - Signal
 - Semaphore
 - Thread
 - Timer

While it would be preferable to see these split to move one component
per commit, these components are all interdependent upon each other,
which leaves us with one big change performing the move for all of them.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:08 +01:00
Kieran Bingham
6410d1d37c libcamera/base: Move class helpers to the base library
Move the class support infrastructure to the base library.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:03 +01:00
Kieran Bingham
cbdc93e9d1 libcamera/base: Move utils to the base library
Move the utils functionality to the libcamera/base library.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:02 +01:00
Kieran Bingham
86eaa6c5e1 libcamera/base: Introduce new base library
The libcamera-base.so will feature internal support functionality
that is utilised by libcamera, and can be shared in other places.

This new library provides a layer beneath libcamera which provides
common abstractions to internal objects.

A pkg-config file is generated and named libcamera-base.pc which allows
components such as external IPA modules to link directly to this library
if they need. Normal applications will reference this library through
the Requires: statement provided by the libcamera.pc package
configuration, and linkage will be handled automatically through the
pkg-config mechanisms.

No code is moved to this library yet, this patch only introduces the
framework, construction and linkage.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:10:58 +01:00
Kieran Bingham
b96ab21cdb libcamera: Separate source and build path helpers
The libcameraSourcePath and libcameraBuildPath helper functions are
internal and specific to libcamera needs while operating with the meson
build system.

In preparation for the upcoming move of utils to a common library, move
these helpers out of utils and into their own build unit.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Hirokazu Honda<hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:10:53 +01:00
Kieran Bingham
ec7afef665 libcamera: Rename libcamera pkg-config generation
The libcamera library is moved to the first positional argument of the
pkg-config generator to automatically populate the name and filebase
values for the package.

As part of this, the shared library name is adjusted to the full library
name 'libcamera', without relying upon the automatic 'lib' prefix which
better represents the component and naming of the library.

As a result of this, the pkgconfig file is now named 'libcamera.pc' as
opposed to 'camera.pc', and applications desiring to reference libcamera
will need to search for 'libcamera' as a dependency rather than
'camera'.

The library itself is still created and installed as 'libcamera.so'.

An example meson.build file would need to be adjusted as the following:

-      dependency('camera', required : true),
+      dependency('libcamera', required : true),

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:09:46 +01:00
Kieran Bingham
bdca9ab14e libcamera: Move libcamera.so pkg-config file generation
The pkg-config file for the main libcamera.so is generated
at the top level meson.build.

Move this to the actual core libcamera build structure to be
consistent and keep it next to the library construction.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:09:46 +01:00
Kieran Bingham
1ad25efa60 android: cros: Simplify integration
The ChromeOS specific Android HAL support was overly-complex to support
linking an additional library, and then passing the built object into
the libcamera.so build.

Now that it has its own distinct libcamera-hal.so, simplify the CrOS
integration to build directly into that library.

The removal of the -Wno-shadow here is intentional, as it is not
required for compilation of the camera3_hal.o object.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:09:46 +01:00
Kieran Bingham
63c4687537 android: Split HAL to its own shared library
The libcamera Android HAL implementation should not be an integral part
of libcamera, but a support library that utilises the libcamera public
API.

Move the implementation to its own distinct library.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:09:46 +01:00
Vedant Paranjape
53a0d80af0 gstreamer: Added virtual functions needed to support request pads
This patch adds support for using request pads in libcamerasrc Gst
Element. It allows a user to request multiple streams if the platform
supports multistream output using libcamera.

This was tested on Raspberry Pi 4B+ with a camera connected to CSI port.
It can be tested by running the following command

gst-launch-1.0 libcamerasrc camera-name="<camera-name-here>" name=src src.src ! queue ! videoconvert ! autovideosink src.src_0 ! queue ! videoconvert ! autovideosink

Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-25 20:03:49 +09:00
Hirokazu Honda
e4e3af642e android: mm: cros_camera_buffer: Fix wrong indexing in plane()
CameraBuffer::plane() should be accessed in zero based index.
Fix the wrong indexing in CameraBuffer::plane() in
cros_camera_buffer.cpp.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-25 18:14:26 +09:00
Umang Jain
750019bf55 ipa: ipu3: Use libcamera::utils::Duration helper class for durations
std::chrono::Duration is provided quite conveniently by
libcamera::utils::Duration wrapper. Port IPAIPU3 to use that
for duration-type entities (such as exposure time), such that
it becomes consistent with rest of the codebase.

The commit doesn't introduce any functional changes.

Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2021-06-24 10:27:49 +05:30
Naushir Patuck
d372aaa10d pipeline: raspberrypi: Simplify RPiCameraData::clearIncompleteRequests()
With the addition of FrameBuffer::cancel(), the logic to clear and return
pending requests can be simplified by not having to queue all the request
buffers to the device before calling streamOff().

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-06-23 16:20:48 +02:00
Jacopo Mondi
4bb81dfcc4 android: Introduce CameraCapabilties class
The camera_device.cpp has grown a little too much, and it has quickly
become hard to maintain. Break out the handling of the static
information collected at camera initialization time to a new
CameraCapabilities class.

Break out from the camera_device.cpp file all the functions related to:
- Initialization of supported stream configurations
- Initialization of static metadata
- Initialization of request templates

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-06-23 09:04:15 +02:00
Jacopo Mondi
d7041114d3 android: Sort source files alphabetically
Sort the list of the Android HAL source file alphabetically.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-23 09:04:15 +02:00
Vedant Paranjape
1d134197c7 libcamera: Add OV5647 sensor properties
Brief specifications available at
https://cdn.sparkfun.com/datasheets/Dev/RaspberryPi/ov5647_full.pdf

> pixel size: 1.4 μm x 1.4 μm

Change in this patch is referenced from Page 5: key specifications
section of the above linked pdf

Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-06-23 12:19:53 +09:00
Naushir Patuck
a4b876e97f ipa: raspberrypi: Fix possible buffer overrun in metadata parsing
The SMIA metadata parser could possibly read one byte past the end of the
buffer as the buffer size test ran after the read operation. Fix this.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.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-06-22 13:48:01 +03:00
Laurent Pinchart
969da31894 libcamera: utils: Support systems that lack secure_getenv and issetugid
Android provides neither secure_getenv() nor issetugid(). Enable
compilation on that platform by using a plain getenv(), as that seems to
be the best we can do.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-19 16:52:33 +03:00
Laurent Pinchart
73b823b220 libcamera: pipeline: simple: Fix crash when storing timestamp in metadata
Commit 922833f774 ("libcamera: simple: Report sensor timestamp")
unconditionally tries to access the request through the capture buffer
to store the capture timestamp in the metadata. This causes a null
pointer dereference when using a converter, as the capture buffers are
free-wheeling in that case, and not associated with a request.

Fix this by getting the request from the user-facing buffer, which can
be the capture buffer when no converter is used.

Fixes: 922833f774 ("libcamera: simple: Report sensor timestamp")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-06-17 12:37:23 +03:00
Paul Elder
b4c3db4c01 android: camera_device: Simplify leftover CameraMetadata calls
There were some CameraMetadata calls that were left in the old version.
Update them.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-06-17 15:24:10 +09:00