Commit graph

534 commits

Author SHA1 Message Date
Laurent Pinchart
beed258a5a test: Include specific headers instead of libcamera.h
Let's only pull required headers, to avoid slowing compilation down.

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>
2020-09-21 13:50:42 +03:00
Laurent Pinchart
dbafe16da7 meson: Remove -Wno-unused-parameter
We build libcamera with -Wno-unused-parameter and this doesn't cause
much issue internally. However, it prevents catching unused parameters
in inline functions defined in public headers. This can lead to
compilation warnings for applications compiled without
-Wno-unused-parameter.

To catch those issues, remove -Wno-unused-parameter and fix all the
related warnings with [[maybe_unused]].

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-08-25 02:58:04 +03: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
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
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
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
Jacopo Mondi
dd0793ed1b libcamera: geometry: Add isNull() function to Rectangle class
It's common for code to check if a rectangle is null. Add a helper function
to do so and test the function in test/geometry.cpp

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>
2020-08-03 11:16:16 +02:00
Jacopo Mondi
d405d1fd5e libcamera: utils: Add alignUp and alignDown functions
Add to libcamera utils library two functions to round up or down a
value to an alignment and add a test in test/utils.cpp for the two
new functions.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
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>
2020-08-03 11:16:16 +02:00
Umang Jain
9c5f821396 tests: Add a test case for the Object::deleteLater() API, to verify
- the object is deleted from the correct thread
- multiple deleteLater() calls delete the object once only

Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-31 23:33:35 +03:00
Laurent Pinchart
624f6d54ff test: Remove list-cameras test
The list-cameras test case is the very first test case that has been
added to libcamera. It has served to start the development of the unit
tests infrastructure. Since then, libcamera has grown several tests that
cover the same API, and more. It's time for list-cameras to retire.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-07-28 01:27:30 +03:00
Laurent Pinchart
b52fcf9b0f test: process: Test Process::kill()
Add a test to ensure that Process::kill() on an unstarted process is
safe. This aims at ensuring we don't kill other processes unexpectedly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-07-27 22:30:07 +03:00
Niklas Söderlund
dcda73ec14 libcamera: v4l2_subdevice: Replace ImageFormats with a map
Replace the V4L2Subdevice usage of the ImageFormats class with a
std::map and the utils::map_keys() helper.

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>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-07-23 16:31:41 +02:00
Paul Elder
c3548a333f tests: v4l2_compat: Fix v4l2-compliance and v4l2-ctl version parsing
v4l2-compliance originally printed the SHA before the version, leading
to the indexing that was used previously. Now that the version is
printed before the SHA, the indexing is incorrect. Fix this.

Although v4l2-ctl doesn't suffer the same issue, it is more correct to
use the zeroth index like the v4l2-compliance version check now does, so
fix that as well.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-17 18:50:10 +09:00
Laurent Pinchart
72263c5203 libcamera: ipa_interface: Add support for custom IPA data to configure()
Add two new parameters, ipaConfig and result, to the
IPAInterface::configure() function to allow pipeline handlers to pass
custom data to their IPA, and receive data back. Wire this through the
code base. The C API interface will be addressed separately, likely
through automation of the C <-> C++ translation.

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>
2020-07-17 02:13:29 +03:00
Laurent Pinchart
aca22bc73a test: file: Add file creation test
Add a test to verify file creation with File::open(). The test is
expected to fail as the File::open() implementation is not correct.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-07-15 19:06:47 +03:00
Laurent Pinchart
7e1c153c22 test: file: Add read/write tests
Add tests for the File::read() and File::write() functions.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-07-15 19:06:47 +03:00
Laurent Pinchart
d5446e9f32 libcamera: geometry: Provide in-place versions of the Size helpers
Add alignDownTo(), alignUpTo(), boundTo() and expandTo() helper
functions to the Size class. These are in-place versions of the existing
alignedDownTo(), alignedUpTo(), boundedTo() and expandedTo() functions.

The new helpers return a reference to the size, to allow chaining the
functions. One can thus write

	size.alignDownTo(16, 16).alignUpTo(32, 32)
	    .boundTo({ 40, 80 }).expandTo({ 16, 80 });

instead of

	size.alignDownTo(16, 16);
	size.alignUpTo(32, 32);
	size.boundTo({ 40, 80 });
	size.expandTo({ 16, 80 });

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-07-15 17:33:54 +03:00
Laurent Pinchart
6c0afb8b33 libcamera: geometry: Add helper functions to the Size class
Pipeline handlers commonly have to calculate the minimum or maximum of
multiple sizes, or align a size's width and height. Add helper functions
to the Size class to perform those tasks.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-07-15 00:27:26 +03:00
Paul Elder
74c8b50833 tests: v4l2_compat: Check v4l2-compliance and v4l2-ctl versions
v4l2-compliance and v4l2-ctl with version 1.20 and before will fail with
v4l2-compat. Check the versions of v4l2-compliance and v4l2-ctl before
continuing.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-13 19:46:24 +09:00
Paul Elder
ce32ca4918 tests: v4l2_compat: Prettify failure output
When a test is being run on a video device, there is output like so:

Testing /dev/video0 with uvcvideo driver...

and when it succeeds, "success" is appended:

Testing /dev/video0 with uvcvideo driver... success

On failure, however, the output of v4l2-compliance is printed before
"failure" is printed, resulting in the first line of the v4l2-compliance
output to be printed on the same line as the message:

Testing /dev/video2 with uvcvideo driver... v4l2-compliance SHA: not available, 64 bits
<v4l2-compliance output>
failure

Refactor the code to make "failure" print before the output of the test,
to prettify the output upon failure.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-13 19:46:11 +09:00
Paul Elder
e37e72c61c tests: v4l2_compat: Add test for v4l2_compat
Test the V4L2 compatibility layer by running v4l2-compliance -s on every
/dev/video* device.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-07-10 16:11:53 +09:00
Laurent Pinchart
c58bec935c libcamera: utils: Add map_keys() function
Add a map_keys() function to the utils namespace to extract keys from a
map.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Niklas: change return type to std::vector instead of std::set]
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-07-09 16:15:12 +02:00
Laurent Pinchart
b5f6a2ce2f libcamera: Use Size::isNull()
Use the new Size::isNull() function through the code base to replace
manual checks. While the new code isn't equivalent, as isNull() checks
that both width and height are zero, it catches the same conditions in
practice.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-07-08 20:55:13 +03:00
Laurent Pinchart
7fc65e9680 libcamera: geometry: Add isNull() function to Size class
It's common for code to check if a size is null. Add a helper function
to do so.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-06-29 16:17:34 +02:00
Kaaira Gupta
2129117df9 libcamera: pixel_format: Replace hex with format names
Print format names defined in formats namespace instead of the hex
values in toString() as they are easier to comprehend. For this add
a property of 'name' in PixelFormatInfo' so as to map the formats
with their names. Print fourcc for formats which are not used in
libcamera.

Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
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>
2020-06-25 06:47:48 +03:00
Laurent Pinchart
98b05ba378 test: Replace explicit DRM FourCCs with libcamera formats
Use the new pixel format constants to replace usage of macros from
drm_fourcc.h.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-06-18 13:26:52 +03:00
Umang Jain
8960ef9715 tests: Introduce hotplug hot-unplug unit test
This test checks the code-paths for camera's hotplugged and
unplugged support. It is based on bind/unbind of a UVC device
from sysfs. Hence, this test requires root permissions to run
and should have at least one already bound UVC device present
in the system.

Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-06-17 00:27:59 +03:00
Umang Jain
313d65ca25 test: v4l2_subdevice: list_formats: Port to use utils::hex() output helper
The hex stream output helper was introduced in f391048a7b ("libcamera: utils:
Add hex stream output helper"). It simplifies writing hexadecimal values to an
ostream which can be used in this test too. As the helper doesn't modify the
stream configuration (refer to utils::hex() documentation), this eliminates the
need of restoring the stream's format state as pointed out by the coverity scan.

Reported-by: Coverity CID=279058
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-06-08 16:56:07 +01:00
Paul Elder
6e730695de libcamera: IPAManager: remove instance() and make createIPA() static
As the only usage of IPAManager::instance() is by the pipeline handlers
to call IPAManager::createIPA(), remove the former and make the latter
static. Update the pipeline handlers and tests accordingly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-06-08 17:11:26 +09:00
Paul Elder
46d544345c libcamera: IPAManager: make IPAManager lifetime explicitly managed
If any ipa_context instances are destroyed after the IPAManager is
destroyed, then a segfault will occur, since the modules have been
unloaded by the IPAManager and the context function pointers have been
freed.

Fix this by making the lifetime of the IPAManager explicit, and make the
CameraManager construct and deconstruct (automatically, via a unique
pointer) the IPAManager.

Also update the IPA interface test to do the construction and
deconstruction of the IPAManager, as it does not use the CameraManager.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-06-08 17:11:21 +09:00
Umang Jain
3706b716eb test: log: log_api: Close open fds on error paths
Reported-by: Coverity CID=279091
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-06-04 11:02:38 +01:00
Umang Jain
5bb6607933 test: log: log_process: Close open fds on error paths
Reported-by: Coverity CID=279097
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-06-04 11:02:38 +01:00
Madhavan Krishnan
5f2f9406ce test: Fixed the compilation issue
The return value of write() function is ignored, causing the following
compiler error|warning with gcc version 5.4

error: ignoring return value of 'ssize_t write(int, const void*, size_t)'

Fix this by storing the return value of write() and return a test error in
case of failure.

Reported-by: Coverity CID=284605
Signed-off-by: Madhavan Krishnan <madhavan.krishnan@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-06-02 23:40:48 +03:00
Laurent Pinchart
c7463138c6 test: file-descriptor: Add "fd move" constructor test
Add a test for the newly added "fd move" constructor.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-19 18:08:11 +03:00
Laurent Pinchart
f934fd1cb9 libcamera: Move IPA headers from include/ipa/ to include/libcamera/ipa/
The IPA headers are installed into $prefix/include/libcamera/ipa/, but
are located in the source tree in include/ipa/. This requires files
within libcamera to include them with

 #include <ipa/foo.h>

while a third party IPA would need to use

 #include <libcamera/ipa/foo.h>

Not only is this inconsistent, it can create issues later if IPA headers
need to include each other, as the first form of include directive
wouldn't be valid once the headers are installed.

Fix the problem by moving the IPA headers to include/libcamera/ipa/.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2020-05-16 03:38:47 +03:00
Laurent Pinchart
93e72b695e libcamera: Move internal headers to include/libcamera/internal/
The libcamera internal headers are located in src/libcamera/include/.
The directory is added to the compiler headers search path with a meson
include_directories() directive, and internal headers are included with
(e.g. for the internal semaphore.h header)

  #include "semaphore.h"

All was well, until libcxx decided to implement the C++20
synchronization library. The __threading_support header gained a

  #include <semaphore.h>

to include the pthread's semaphore support. As include_directories()
adds src/libcamera/include/ to the compiler search path with -I, the
internal semaphore.h is included instead of the pthread version.
Needless to say, the compiler isn't happy.

Three options have been considered to fix this issue:

- Use -iquote instead of -I. The -iquote option instructs gcc to only
  consider the header search path for headers included with the ""
  version. Meson unfortunately doesn't support this option.

- Rename the internal semaphore.h header. This was deemed to be the
  beginning of a long whack-a-mole game, where namespace clashes with
  system libraries would appear over time (possibly dependent on
  particular system configurations) and would need to be constantly
  fixed.

- Move the internal headers to another directory to create a unique
  namespace through path components. This causes lots of churn in all
  the existing source files through the all project.

The first option would be best, but isn't available to us due to missing
support in meson. Even if -iquote support was added, we would need to
fix the problem before a new version of meson containing the required
support would be released.

The third option is thus the only practical solution available. Bite the
bullet, and do it, moving headers to include/libcamera/internal/.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
2020-05-16 03:38:11 +03:00
Laurent Pinchart
7a653369cb licenses: License all meson files under CC0-1.0
In an attempt to clarify the license terms of all files in the libcamera
project, the build system files deserve particular attention. While they
describe how the binaries are created, they are not themselves
transformed into any part of binary distributions of the software, and
thus don't influence the copyright on the binary packages. They are
however subject to copyright, and thus influence the distribution terms
of the source packages.

Most of the meson.build files would not meet the threshold of
originality criteria required for copyright protection. Some of the more
complex meson.build files may be eligible for copyright protection. To
avoid any ambiguity and uncertainty, state our intent to not assert
copyrights on the build system files by putting them in the public
domain with the CC0-1.0 license.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Giulio Benetti <giulio.benetti@micronovasrl.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Naushir Patuck <naush@raspberrypi.com>
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Show Liu <show.liu@linaro.org>
2020-05-13 16:46:24 +03:00
Laurent Pinchart
2bc657f47b libcamera: v4l2_pixelformat: Move DRM/V4L2 format conversion
Move the DRM/V4L2 format conversion code from V4L2VideoDevice to
V4L2PixelFormat. This is a more natural home for the code.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-30 14:46:12 +03:00
Jacopo Mondi
fd554f9dba libcamera: ipa: Add support for CameraSensorInfo
Add support for camera sensor information in the libcamera IPA protocol.

Define a new 'struct ipa_sensor_info' structure in the IPA context and
use it to perform translation between the C and the C++ API.

Update the IPAInterface::configure() operation to accept a new
CameraSensorInfo parameter and port all users of that function to
the new interface.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28 22:25:23 +02:00
Laurent Pinchart
5c8570cf37 test: camera_sensor: Test the model() function
Verify that the sensor model matches the expected value. The whole model
extraction heuristic isn't fully tested as that would require being able
to inject different entity names. It is still useful as an initial step.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28 23:13:26 +03:00
Laurent Pinchart
79ab0e925a libcamera: v4l2_device: Simplify usage of getControls()
The V4L2Device::getControls() function takes a ControlList that needs to
be pre-populated with dummy entries for the controls that need to be
read. This is a cumbersome API, especially when reading a single
control. Make it nicer by passing the list of V4L2 controls as a vector
of control IDs, and returning a ControlList.

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>
2020-04-28 20:44:48 +03:00
Laurent Pinchart
32df46f0b6 test: ipa: ipa_interface: Pass configuration file to IPA init()
Pass the vimc IPA dummy configuration file to the IPA init() function.
This will be used by the IPA to validate the init() call.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-28 01:54:56 +03:00
Laurent Pinchart
a6de903089 ipa: Pass IPA initialization settings to IPAInterface::init()
Add a new IPASettings class to pass IPA initialization settings through
the IPAInterface::init() method. The settings currently only contain the
name of a configuration file, and are expected to be extended later.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-28 01:54:49 +03:00
Laurent Pinchart
6e1cd1394e ipa: Name IPA modules after their source directory
The IPAModuleInfo::name field is currently a free-formed string that has
little use. Tighten its usage rules to make it suitable for building
file system paths to IPA-specific resources by matching the directory
name of the IPA module.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-28 01:54:29 +03:00
Laurent Pinchart
256d0a4098 test: Use float values for brightness, contrast and saturation
Two tests use the brightness, contrast and saturation controls with
integer failures. They were not updated by commit eff4b1aa01 which
turned those controls into floats. This doesn't cause test failures as
the control API converts the value types. For correctness, update the
tests to use float values.

Fixes: eff4b1aa01 ("libcamera: controls: Reorder and update description of existing controls")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-04-27 23:38:34 +03:00
Umang Jain
04d6cd14c5 test: list-camera: Handle error on starting the CameraManager
Pointed out by Coverity DefectId=297074

Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-04-15 01:09:23 +03:00
Laurent Pinchart
79ce121b6b libcamera: utils: Add string join function
Add a utils::join() function to join elements of a container into a
string, with a separator and an optional conversion function if the
elements are not implicitly convertible to std::string.

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>
2020-04-15 01:07:24 +03:00
Laurent Pinchart
ebd0cae455 libcamera: ipa: Remove IPAModuleInfo license field
The IPAModuleInfo license field isn't needed anymore now that modules
are cryptographically signed. Remove it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-04-14 02:03:30 +03:00