Commit graph

2870 commits

Author SHA1 Message Date
Laurent Pinchart
a48a000a33 libcamera: Rename 'method' to 'function'
Usage of 'method' to refer to member functions comes from Java. The C++
standard uses the term 'function' only. Replace 'method' with 'function'
or 'member function' through the whole code base and documentation.
While at it, fix two typos (s/backeng/backend/).

The BoundMethod and Object::invokeMethod() are left as-is here, and will
be addressed separately.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-09 15:40:32 +03:00
Umang Jain
0536a9aa71 ipu3: Disallow raw only camera configuration
To capture raw frames, the ImgU isn't needed. However, to implement
auto-exposure, we do need to configure the IPA since it shall setup
the sensor controls (exposure, vblank and so on) for the capture.
One cannot simply configure the IPA, without the ImgU as the
parameters and statistics buffer passed to the IPA are actually
managed by the ImgU.

Until we prepare and setup the ImgU to run an internal queue for
raw-only camera configuration, disallow this configuration and
report it as invalid.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-09 11:02:14 +05:30
Hirokazu Honda
36b10b93b1 android: mm: cros_camera_buffer: Fix unused parameter
cameraBuffer function in private constructor is unused.
Mark it as such.

Fixes: 33dd4fab9d39("libcamera: base: class: Don't pass Extensible pointer to Private constructor")
Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.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>
2021-08-06 12:12:11 +01:00
Hirokazu Honda
4c61c5d223 android: camera_device: Propagate the requested test pattern mode
Propagate the requested test pattern mode to libcamera::Camera
through libcamera::Request and also set the android metadata to
the test pattern mode contained by the complete Request.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-06 11:29:36 +01:00
David Plowman
abaa45d627 ipa: raspberrypi: AGC: handle modes with different sensitivities
When the sensor is switched to a mode with a different sensitivity,
the target exposure values need to be adjusted proportionately to
maintain the same image brightness.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-05 16:49:33 +01:00
David Plowman
d0c429c34c ipa: raspberrypi: Add sensitivity field to camera mode
We use the CamHelper class to initialise it to the usual value of 1.

The CamHelper's GetModeSensitivity method can be redefined to
implement a different behaviour for sensors that require it.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-05 16:49:33 +01:00
Laurent Pinchart
2288550f7d cam: Add support for viewfinder through DRM/KMS
Use the KMSSink class to display the viewfinder stream, if any, through
DRM/KMS. The output connector is selected through the new -D/--display
argument.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-05 16:23:11 +03:00
Laurent Pinchart
063c9969f5 cam: kms_sink: Enable display on first frame
Not all display controllers support enabling the display without any
active plane. Delay display enabling to the first frame.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-05 16:23:11 +03:00
Laurent Pinchart
6d7ddace52 cam: Add KMS sink class
Add a KMSSink class to display framebuffers through the DRM/KMS API.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-05 16:23:11 +03:00
Laurent Pinchart
910b5253cb cam: Add DRM helper classes
To prepare for viewfinder operation through the DRM/KMS API, add a set
of helper classes that encapsulate the libdrm functions.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-05 16:23:11 +03:00
Laurent Pinchart
ab623b4738 cam: Rename BufferWriter to FileSink
Rename the BufferWriter class to FileSink to establish a common naming
scheme for all sinks.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-08-05 16:23:11 +03:00
Laurent Pinchart
02001fecb0 cam: Turn BufferWriter into a FrameSink
Make the BufferWriter class inherit from FrameSink, and use the
FrameSink API to manage it. This makes the code more generic, and will
allow usage of other sinks.

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>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-08-05 16:23:10 +03:00
Laurent Pinchart
f929a2890c cam: Add FrameSink base class
The FrameSink class serves as a base to implement components that
consume frames. This allows handling frame sinks in a generic way,
independent of their nature. The BufferWrite class will be ported to
FrameSink in a second step.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-08-05 16:23:10 +03:00
Laurent Pinchart
cb45af8a9e cam: event_loop: Add support for file descriptor events
Extend the EventLoop class to support watching file descriptors for
read and write events.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-08-05 16:23:10 +03:00
Kieran Bingham
2c18ebb859 utils: ipc: Initialise ThreadProxy
The ThreadProxy IPA template does not implement a constructor and the
default compiler generated constructor does not initialise the private
ipa_ pointer.

Whilst this should not be expected to be used while uninitialised, it
does get caught by static analysis for every IPA module constructed, so
lets be clean and fix it.

Reported-by: Coverity CID=350116
Reported-by: Coverity CID=350123
Reported-by: Coverity CID=350140
Reported-by: Coverity CID=350147
Fixes: 7832e19a59 ("utils: ipc: add templates for code generation for IPC mechanism")
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-05 14:13:30 +01:00
Vedant Paranjape
0e8d8fbd4e gstreamer: Update format specifier in Request Pad template
Change format specifier %s to %u in name template field of request pad
template.

Pad names are as follows, src_0, src_1, etc. So, instead of using string
format specifier, use unsigned integer format specifier.

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-08-05 14:32:02 +09:00
Umang Jain
5fd4bb0337 android: nautilus: Add camera HAL configuration
Nautilus has two in-built cameras, one UVC and one attached to IPU3.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-08-04 09:03:37 +05:30
Umang Jain
79abef2064 android: Override camera as "Internal" provided found in HAL config
Currently, all UVC cameras are reported with CameraLocationExternal [1]
by libcamera-core since there is no universal information or standard,
to know the location of these cameras. However, in the libcamera HAL
layer, we can make an informed decision whether it's external or
internal, simply by checking its presence in the HAL configuration
file.

The CameraHalManager will now assign the numerical id of the camera
accordingly when initializing the CameraDevice, based on the camera
facing value set in the HAL config file.

[1] 76809320bb ("libcamera: pipeline: uvcvideo: Treat all UVC cameras
                   as external")

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-08-04 09:03:33 +05:30
Umang Jain
f65fad5a4d android: Disallow external location in HAL config
Error out on any camera's location if set to "external", in the HAL
configuration file. The HAL configuration file is meant to override the
location property, and overriding an internal camera location to
external doesn't make sense.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-08-04 09:03:29 +05:30
Umang Jain
cc0a50cddf android: Instantiate CameraDevice after checking HAL config validity
Currently CameraDevice wrapper is created first and then HAL config
validity is checked. If the validity checks fail, the code path will
simply return, in which case, creating CameraDevice seems a futile
exercise.

This patch defers the creation of CameraDevice wrapper until the HAL
config validity is checked for internal cameras. This will also enable
us to infer a few things beforehand, by reading the config file before
creating the CameraDevice wrapper.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-08-04 09:03:23 +05:30
Laurent Pinchart
c615807bc4 qcam: Support OpenGL ES 2.0
The GL_RG and GL_RED texture formats are not supported in OpenGL ES
prior to 3.0. In order to be compatible with OpenGL ES 2.0, use
GL_LUMINANCE_ALPHA and GL_LUMINANCE instead. The shader code needs to be
updated accordingly for GL_RG, as the second component is now stored in
the alpha component instead of the green component. Usage of the red
component is fine, the luminance value is stored in the red, green and
blue components.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org>
2021-08-03 23:37:39 +03:00
Laurent Pinchart
86eac92fcf libcamera: camera: Make Camera::Private members private
To prepare for the Camera::Private structure being used by pipeline
handlers, turn all its members to private. Members that are useful for
pipeline handlers will be made public again, or will be exposed through
accessor functions, on a case-by-case basis.

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-08-03 23:05:09 +03:00
Laurent Pinchart
a0143dc893 libcamera: camera: Move Camera::Private to header file
The Camera::Private class is defined in camera.cpp. To prepare for
allowing it to be subclassed by pipeline handlers, move it to a new
internal/camera.h header.

The \file comment block in camera.cpp now needs to explicitly tell which
camera.h file it refers to.

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-08-03 23:05:09 +03:00
Laurent Pinchart
c46f82fd1b Documentation: Doxygen: Don't exclude Private classes
Some of the libcamera Private classes are part of the internal API
exposed to pipeline handlers, and should thus be documented as such.
Drop the wildcard exclusion, and exclude fully private classes
explicitly instead.

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-08-03 23:05:09 +03:00
Laurent Pinchart
5694a6791f libcamera: frame_buffer: Document the FrameBuffer::Private class
The FrameBuffer::Private class is exposed to pipeline handlers, and is
thus part of the internal libcamera API. As such, it should be
documented.

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-08-03 23:05:09 +03:00
Laurent Pinchart
33dd4fab9d libcamera: base: class: Don't pass Extensible pointer to Private constructor
The Extensible and Extensible::Private classes contain pointers to each
other. These pointers are initialized in the respective class's
constructor, by passing a pointer to the other class to each
constructor. This particular construct reduces the flexibility of the
Extensible pattern, as the Private class instance has to be allocated
and constructed in the members initializer list of the Extensible
class's constructor. It is thus impossible to perform any operation on
the Private class between its construction and the construction of the
Extensible class, or to subclass the Private class without subclassing
the Extensible class.

To make the design pattern more flexible, don't pass the pointer to the
Extensible class to the Private class's constructor, but initialize the
pointer manually in the Extensible class's constructor. This requires a
const_cast as the o_ member of the Private class is const.

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-08-03 23:05:08 +03:00
Laurent Pinchart
49334e1f24 libcamera: base: class: Link LIBCAMERA_O_PTR to Extensible documentation
The LIBCAMERA_O_PTR macro is part of the Extensible class
infrastructure, but doesn't link to it. This makes the generated
documentation unclear. Fix it.

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-08-03 23:05:08 +03:00
Laurent Pinchart
960b1b2e87 libcamera: base: class: Document Extensible::_d() functions
The Extensible::_d() functions are meant to be called by users of the
class. Document them.

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-08-03 23:05:08 +03:00
Laurent Pinchart
6a8582dc20 libcamera: file: Turn MapFlag and OpenModeFlag into enum class
Add type safety by turning the MapFlag and OpenModeFlag enum into enum
class.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-08-03 10:55:33 +03:00
Laurent Pinchart
91d06ae2fc libcamera: file: Use Flags<> class for open flags
Use the newly introduced Flags<> class to store a bitfield of
File::OpenMode in a type-safe way. The existing File::OpenMode enum is
renamed to File::OpenModeFlag to free the File::OpenMode for the Flags<>
type alias.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-08-03 10:55:30 +03:00
Laurent Pinchart
49862904f6 libcamera: file: Use Flags<> class for map flags
Use the newly introduced Flags<> class to store a bitfield of
File::MapFlag in a type-safe way.

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-08-03 10:55:26 +03:00
Laurent Pinchart
f7c6b1228b test: Add tests for the Flags class
Add tests that exercise the whole API of the Flags class.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-08-03 10:55:21 +03:00
Laurent Pinchart
87c18aab8c libcamera: flags: Add type-safe enum-based flags
Add a Flags template class that provide type-safe bitwise operators on
enum values. This allows using enum types for bit fields, without giving
away type-safety as usually done when storing combined flags in integer
variables.

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-08-03 10:55:20 +03:00
David Plowman
a792512496 utils: raspberrypi: ctt: Fix namespace for sklearn NearestCentroid function
Starting in version 0.22, the NearestCentroid function is only available
in the sklearn.neighbors namespace, when it was previously available in
both the sklearn.neighbors.nearest_centroid and sklearn.neighbors
namespaces. Use sklearn.neighbors as it works on all versions of
sklearn.

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-08-03 10:54:26 +03:00
Paul Elder
e9288e2ee5 meson: Update min clang version to 9
__builtin_FILE and __builtin_LINE are first defined in clang 9. With
clang of any version less than that we have the following compilation
errors:

../../include/libcamera/base/log.h:94:27: error: use of undeclared identifier '__builtin_FILE'
                        const char *fileName = __builtin_FILE(),
                                               ^
../../include/libcamera/base/log.h:95:24: error: use of undeclared identifier '__builtin_LINE'
                        unsigned int line = __builtin_LINE()) const;
                                            ^
../../include/libcamera/base/log.h:99:26: error: use of undeclared identifier '__builtin_FILE'
                const char *fileName = __builtin_FILE(),
                                       ^
../../include/libcamera/base/log.h💯23: error: use of undeclared identifier '__builtin_LINE'
                unsigned int line = __builtin_LINE());

Enforce clang version of at least 9 in the main meson file.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-03 12:07:00 +09:00
Paul Elder
f0a427d4b7 android, controls: Add and plumb MaxLatency control
Add a MaxLatency control, and plumb it into the HAL accordingly.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=50
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-08-02 18:07:38 +09:00
Paul Elder
719ac76338 android: Add skeletal still and manual request templates
Add skeletal still and manual request templates so that we can expand
them for FULL support.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-02 18:07:35 +09:00
Paul Elder
822d9e61fa android: capabilities: Make keys list into set and member variable
We need to be able to add additional characteristics/request/result keys
into the corresponding list in the static metadata based on libcamera
camera capabilities. We also need to be able to easily check if the
lists have specific keys, for populating templates and result metadata.

Turn the characteristics, requests, and results keys vectors into sets,
and move them to member variables to achieve this.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-02 18:07:33 +09:00
Paul Elder
6b444acf46 android: Add helpers for setting android metadata from libcamera controls
Add helpers for setting android metadata from libcamera controls.

There are two versions, for scalars and collections, both of which take
a default value to fill in the android control if the libcamera control
is not found. They both return the value that was set.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-02 18:07:30 +09:00
Paul Elder
1c8140ba02 android: Add infrastructure for determining capabilities and hardware level
Add the infrastructure for checking and reporting capabilities. Use
these capabilities to determine the hardware level as well.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=55
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-02 18:07:27 +09:00
Paul Elder
ad2105c2a7 android: jpeg: get ISO from SENSOR_SENSITIVITY
The data for the exif ISO tag needs to come from SENSOR_SENSITIVITY. Set
it.

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-08-02 18:07:24 +09:00
Paul Elder
c9e1f75791 android: metadata: Fix addEntry template type
Since we set entries with android tags directly, which are enums and not
arithmetic types, the addEntry template fails to match. Fix this by also
allowing enum values in addEntry.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-02 18:07:22 +09:00
Paul Elder
24f80f14af android: metadata: Add hasEntry and entryContains
Add convenience functions for checking if an entry is present in a
CameraMetadata instance, and to check if an array entry includes a
specific value.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-02 18:07:19 +09:00
Paul Elder
10cdc914da controls: Add boolean constructors for ControlInfo
It would be convenient to be able to iterate over available boolean
values, for example for controls that designate if some function can be
enabled/disabled. The current min/max/def constructor is insufficient,
as .values() is empty, so the values cannot be easily iterated over, and
creating a Span of booleans does not work for the values constructor.

Add new constructors to ControlInfo that takes a set of booleans (if
both booleans are valid values) plus a default, and another that takes
only one boolean (if only one boolean is a valid value).

Update the ControlInfo test accordingly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-08-02 18:07:16 +09:00
David Plowman
fba85e6901 ipa: raspberrypi: Add support for imx378 sensor
This commit adds a tuning file for the 12MP imx378 sensor. The sensor
actually shares the same driver (and CamHelper) as the imx477 so only
a new tuning file is required. The default choice of imx477.json can
be overridden by pointing LIBCAMERA_RPI_TUNING_FILE at a version of
the new imx378.json file.

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-08-02 03:44:31 +03:00
David Plowman
2d99cc53e2 utils: raspberrypi: ctt: Fix usage of findHomography function
The OpenCV findHomography function now raises an unhandled error if it
receives fewer than 4 points whereas previously the limit was 3. This
makes no material difference to the behaviour of the tuning tool as it
will continue to search for the Macbeth chart at different scales.

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-08-02 03:43:53 +03:00
Naushir Patuck
b40a8d4b45 ipa: raspberrypi: Return controls::FrameDuration from the IPA
Return controls::FrameDuration through the per-frame Request metadata.
The frame duration is obtained by either the value in DelayedControls,
or (preferably) the value parsed from the embedded data buffer.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-28 11:26:07 +03:00
Naushir Patuck
e87fb20f8f pipeline: raspberrypi: Fix a bug when clearing out Request buffers on stop
When RPiCameraData::clearIncompleteRequests() clears out the request
queue during a stop condition, it unconditionally calls completeBuffer()
on all buffers in each request.  This is wrong, as a buffer could have
already been completed as part of the current request, but the request
itself may not yet have completed.

Fix this by checking if the buffers in the request have been completed
before cancelling them.

Fixes: d372aaa10d ("pipeline: raspberrypi: Simplify RPiCameraData::clearIncompleteRequests()")
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-28 09:55:24 +03:00
Vedant Paranjape
f573198d3e gstreamer: Store group_id in GstLibcameraSrcState
This patch adds group_id in GstLibcameraSrcState, since group_id is
something which should be same for all the pads, it can be reused
later.

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-07-28 10:44:37 +09:00
Jacopo Mondi
804c52fce4 android: capabilities: Centralize RAW support check
The validation of RAW stream support is performed in two different
places:

- At initializeStreamConfigurations() time, by verifying that the
  libcamera format associated with HAL_PIXEL_FORMAT_BLOB is a Raw format
  and ensuring the Camera successfully validates it
- As initializeStaticMetadata() time by generating a CameraConfiguration
  for the Raw stream role and ensuring it is a Raw format with a 16 bit
  depth

The first check is used to build the list of supported Raw stream
resolutions. The latter is used to register the
ANDROID_REQUEST_AVAILABLE_CAPABILITIES_RAW capability.

As building the list of supported Raw streams doesn't serve any
purpose if the RAW capability is not registered, centralize the Raw
format support verification at initializeStreamConfigurations() time by
ensuring the supported format is a Raw one with a 16 bit depth.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-07-27 17:36:20 +02:00