Commit graph

2641 commits

Author SHA1 Message Date
Laurent Pinchart
1ac84feab8 android: Update Android headers
Import the latest version of the Android headers from Chrome OS (commit
a30340e77ec8 ("camera: Uprev Android camera headers")). This brings in
the Camera HAL v3.5 support.

The headers are imported verbatim, except for the addition of the SPDX
headers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
2021-05-31 19:26:59 +03:00
Laurent Pinchart
b602bbe811 android: Don't rely on indirect inclusion of unistd.h
The standard C library close() and lseek() functions require inclusion
of the unistd.h header. Include it explicitly where needed instead of
relying on indirect inclusion.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
2021-05-31 19:26:59 +03:00
Paul Elder
3370b6d0a0 utils: ipc: extract-docs: Extract the SPDX header
Take the SPDX header from the mojom file. Error out if the mojom file
has no SPDX header.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-05-31 13:20:19 +09:00
Laurent Pinchart
6b22a3657c libcamera is moving its IRC channel to OFTC (irc.oftc.net)
As reported by lwn.net in https://lwn.net/Articles/856543/ and
https://lwn.net/Articles/857140/, freenode, the largest IRC network and
the home of our IRC channel, is embroiled in a messy dispute. After
careful consideration, we have decided that it is not a suitable place
to host our community anymore.

Effective immediately, the #libcamera IRC channel is transferred to the
OFTC IRC network. We will continue our effort to make the channel a
welcoming place for everybody.

Usage of OFTC is governed by its network [1] and privacy [2] policies.
While we don't expect these to cause issues for anyone, please feel free
to contact OFTC or libcamera should you have any question or concern.

[1] https://www.oftc.net/Network_Policy/
[2] https://www.oftc.net/Privacy_Policy/

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>
2021-05-30 12:32:52 +03:00
Jacopo Mondi
d1d1939602 Revert "libcamera: ipu3: imgu: Add pipe calculation debug"
This reverts commit 5b015e96cc.

The ImgU pipe configuration debug is useful to test the correctness
of the parameters computation against the Intel Python script.

However, the number of debug messages which is printed out by the
configuration procedure is so high it floods the logs, up to the point
that starting the Android camera3 HAL, which tests several configurations
at startup, becomes so slow it is barely usable.

Revert the patch that adds the excessive debug statements, which are mostly
useful only when testing the configuration procedure.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-27 23:43:26 +02:00
Paul Elder
66f58fbf06 meson: ipa: Build documentation cpp files from mojom files
Plumb meson to build the cpp files from the mojom files for the purpose
of containing the documentation for the IPA interfaces.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-05-27 18:21:49 +09:00
Paul Elder
52f5f0125b meson: ipa: Pass core.mojom to the docs generator
We don't want to generate the same functional files for core.mojom as
the other mojom files, but we do want to generate the documentation cpp
files. Add core.mojom to the mojom files list after the main generation
is complete, so that the documentation generator can pick it up.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-05-27 18:21:47 +09:00
Paul Elder
c707eb533a ipa: core: Move documentation from cpp file back into the mojom file
Move the documentation back to the mojom file from the cpp file. While
at it, move the documentation for IPAInterface::init() and
IPAInterface::stop() to the IPA guide.

While at it, update the todo comment in all of the mojom files
accordingly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

[umang.jain@ideasonboard.com: Update todos]
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-05-27 18:20:35 +09:00
Paul Elder
e371805a03 meson: ipa: Use files() to locate the mojom files
Use meson's files() to list the mojom files instead of the file names
directly. This is so that we can still access the files from
src/libcamera/ipa/meson.build later for building documentation cpp
files from the mojom files.

While at it, fix some redundant string manipulation in building the
mojom modules.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-05-27 18:20:31 +09:00
Paul Elder
bd06b648fb utils: ipc: Add script to extract doxygen docs from mojom files
Add a script to extract doxygen documentation comments from mojom files.
It matches based on ^\/\*\*$ for start of block and ^ \*\/$ for end of
block, and simply copies the comments to the output file along with a
header and the libcamera namespace.

Also add it to the meson file so it is usable by other meson files.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-27 17:07:04 +09:00
Paul Elder
6c5f3fe6ce ipa: ipu3: Set output frame duration metadata
The sensor frame duration should be set by the IPA. Hardcode it for now.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-05-27 17:05:29 +09:00
Paul Elder
3beb1accac android: camera_device: Fix sensor frame duration
The sensor frame duration should be set by IPA. Get the information for
the result metadata from libcamera.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-05-27 17:05:29 +09:00
Paul Elder
19772ffe10 controls: Split FrameDurations into FrameDuration and FrameDurationLimits
We need a separate control to report the nominal frame duration, but
it's also useful to report the min/max frame duration values that will
be used. Split the FrameDurations control into FrameDuration and
FrameDurationLimits respectively to support both of these.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-27 17:05:25 +09:00
Laurent Pinchart
c0a9768a9b meson: Print summary boolean options in colours
Boolean options in the summary are printed as 'True' or 'False' by
default. Enable the bool_yn option, which prints them as 'YES' or 'NO',
in green and red respectively. This makes the summary more readable.

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-05-27 05:32:15 +03:00
Hirokazu Honda
459b3bc6a9 android: CameraHalManager: Create a static object dynamically
Originally CameraHalManager is created in the libcamera start up
and destroyed in the libcamera termination. However,
CameraHalManager destructor can access  other static objects that
has been destroyed.
Avoid this issue by destroying CameraHalManager when tear_down() is
called in ChromeOS or leaking it in other platforms.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-26 23:41:43 +03:00
Laurent Pinchart
a8c9fce109 test: v4l2_videodevice: controls: Test 64-bit controls
The recent merge (and revert) of commit 34bee5e84e ("libcamera:
V4L2Device: Remove the controls order assumption in updateControls()")
showed that 64-bit controls were missing from unit tests.

Fix this by testing the VIVID_CID_INTEGER64 control in the V4L2 video
device controls test.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-05-26 20:46:22 +03:00
Umang Jain
c43c12a24b ipa: ipu3: Provide frame timestamps through IPU3Event
Pass in frame timestamps from IPU3 pipeline handler to IPU3 IPA via
IPU3Event. Frame timestamps are helpful to IPA algorithms to
convergence, by setting them via IPA stats.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-26 19:15:28 +03:00
Umang Jain
abbc4bd11b libcamera: pipeline: ipu3: Fix mis-aligned comment
Fixes: 2fac95b400 ("libcamera: pipeline: ipu3: Ensure that IPU3Frames::info is not used after delete")
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-26 19:15:28 +03:00
Umang Jain
258c74819a ipa: ipu3: Rectify ControlInfoMap matching in IPAConfigInfo
The ControlInfoMap of entityControls member in IPAConfigInfo struct,
was not able to correctly match to the ControlInfoMap defined in
core.mojom. This resulted in a FATAL breakage when IPU3 IPA is meant to
run:

 FATAL IPADataSerializer ipa_data_serializer.cpp:437 ControlSerializer
 not provided for serialization of ControlInfoMap

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-26 15:47:44 +03:00
Laurent Pinchart
9fd172f496 android: Fix file system library usage on gcc 7 and 8
On gcc versions older than 9, the file system library, used by the
Android camera HAL configuration file parser, is implemented in a
separate static library. Furthermore, on gcc 7, it's provided in the
std::experimental namespace. This breaks compilation of the HAL on gcc
7, and linking on gcc 8.

Fix the compilation issue by conditionally including
<experimental/filesystem> and creating a namespace alias in std, and the
link issue by linking to libstdc++fs on gcc versions older than 9.

The inclusion of <experimental/filesystem> is a bit of a hack, and when
we'll start using the file system library in another compilation unit,
we should then move all this to an internal helper to abstract the
compiler version.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-05-26 14:52:56 +03:00
Laurent Pinchart
bdee8833e2 android: camera_hal_config: Move include <filesystem> to .cpp file
The <filesystem> header isn't needed in camera_hal_config.h, move its
inclusion to camera_hal_config.cpp.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-05-26 14:52:33 +03:00
Niklas Söderlund
017f629fc7 test: byte-stream-buffer: Initialize data array
Fix compiler warning about variable use before being initialized that
appears with gcc 11.1.0.

    test/byte-stream-buffer.cpp:31:63: error: ‘data’ may be used uninitialized [-Werror=maybe-uninitialized]

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-26 10:24:15 +02:00
Paul Elder
139d885574 utils: ipc: Update mojo
Update mojo from the Chromium repository. The commit from which this was
taken is:

9c138d992bfc1fb8f4f7bcf58d00bf19c219e4e2 "Updating trunk VERSION from
4523.0 to 4524.0"

The update-mojo.sh script was used for this update.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=34
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-26 13:03:27 +09:00
Paul Elder
a7ded8e8f5 utils: update-mojo.sh: Add script for updating mojo
Add a script to ease updating mojo from a chromium source tree.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-26 13:03:12 +09:00
Paul Elder
9b006872cd android: camera_metadata: Add functions for instrumenting resizing
Add utility functions to CameraMetadata to check if it has been resized,
and for outputting the actual entry and data count. This is meant to be
used to output information on resizing, to assist developers in
choosing proper initial sizes to avoid resizing. Also make CameraDevice
use these functions for static and result metadata.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-05-26 13:03:10 +09:00
Jacopo Mondi
2a84728dab android: soraka: Add camera HAL configuration
Add camera HAL configuration file for IPU3 Soraka.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-05-25 15:22:21 +02:00
Jacopo Mondi
9133c5b2cc android: camera_device: Get properties from configuration
Open the HAL configuration file in the Camera HAL manager and get
the camera properties for each created CameraDevice and initialize it
with them.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-05-25 15:22:10 +02:00
Jacopo Mondi
07c2a4257d android: Add CameraHalConfig class
Add a CameraHalConfig class to the Android Camera3 HAL layer.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-05-25 15:21:59 +02:00
Jacopo Mondi
6570f85454 libcamera: List dependency for Android Camera3 HAL
Add to the README.rst file the list of depdendencies for the
Android Camera3 HAL.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-05-25 15:21:46 +02:00
Paul Elder
77c6ac0ae7 android: CameraDevice: Report proper min and max frame durations
The HAL layer was getting the min and max frame durations from the
camera, then rounding it to fps to report as available fps ranges. The
same min and max frame durations were then being reported as min and max
frame durations. Since the fps are integer values while the frame
durations are in ns, this caused a rounding error making it seem like we
were reporting an available max fps that was higher than what was
allowed by the minimum frame duration.

An example is if the minimum frame duration is reported as 33366700ns.
The HAL layer would then convert it to fps, which is 29.97, but it would
be rounded and reported as 30 fps. When 30 fps is converted to a frame
duration it is 33333333ns, which is less than the minimum frame duration
that we report. Thus the minimum frame duration that we report
contradicts the fps range that we report.

Fix this by recalculating the frame durations based on the rounded fps
values.

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

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-25 18:20:55 +09:00
Jean-Michel Hautbois
63c3c54592 libcamera: add OV5693 sensor properties
The new sensor database has introduced several sensors, but ov5693 is
missing.
It is used on most MS Surface tablets, add it to the database.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-05-25 11:19:16 +02:00
Laurent Pinchart
67a83e126b Revert "libcamera: V4L2Device: Remove the controls order assumption in updateControls()"
This reverts commit 34bee5e84e.

The commit introduced a breakage in the master branch, reported by
linux-surface users already. Let's revert it while discussing the
propert fix.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Tested-by: Umang Jain <umang.jain@ideasonboard.com>
2021-05-25 12:11:14 +03:00
Phi-Bang Nguyen
a25a611bb3 pipeline: simple: Rework the supportedDevices list
The supportedDevices may contain entries which have the same driver
but different converters. For example, if we add these two entries:

{ "mtk-seninf", "mtk-mdp", 3 },
{ "mtk-seninf", "mtk-mdp3", 3 },

the simple pipeline handler will always take the first one where it
can acquire the driver and skip the rest.

So, make the changes to support this usecase.

Signed-off-by: Phi-Bang Nguyen <pnguyen@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-25 04:56:32 +03:00
Hirokazu Honda
34bee5e84e libcamera: V4L2Device: Remove the controls order assumption in updateControls()
The original updateControls() has the assumption that ctrls and
v4l2Ctrls lists are in the same order. It is dependent on the
caller implementation though. This changes updateControls()
implementation so that it works without the assumption.

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-05-25 02:54:16 +03:00
Laurent Pinchart
7de2daf653 android: camera_worker: Process all queued requests when stopping
When stopping the camera worker, queuedRequest() calls may have queued
asynchronous function invocation messages to the worker thread, and some
of those messages may not have been processed yet. The messages will
stay in the thread's queue until the camera worker is restarted (when
the camera service will start a new capture session). At that point,
they will be dispatched, which will cause a crash due to the
CaptureRequest passed to processRequest() having been deleted by
CameraDevice::stop() calling descriptors_.clear().

Fix this by forcing dispatching of all function invocation messages when
stopping the camera worker thread. Note that this is inherently racy, as
more queueRequest() calls may arrive from the camera service while we're
stopping. This race condition will be addressed by a subsequent patch
series.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-24 15:06:05 +03:00
Umang Jain
e8924f30f7 meson: Add a configuration option to build IPAs
There can be multiple IPAs per pipeline-handler or platform.
They can live in-tree or externally linked. It is up to the vendor
whether to use in-tree IPA for a platform or provide it externally.
In the case of IPAs being external, building in-tree IPAs might be
futile hence, provide a clear and explicit mechanism to choose whether
to build the in-tree IPA for the platform or not.

By default, all in-tree IPAs are built when a matching Pipeline handler
is also enabled.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-24 14:27:29 +03:00
Umang Jain
c76ca01323 ipa: ipu3: Introduce IPAConfigInfo in IPC
IPAConfigInfo is a consolidated data structure passed from IPU3
pipeline-handler to IPU3 IPA. The structure can be extended with
additional parameters to accommodate the requirements of multiple
IPU3 IPA modules.

Adapt the in-tree IPU3 IPA to use IPAConfigInfo as well.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
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-05-24 14:13:37 +03:00
Umang Jain
231d93557d ipa: meson: Install mojom generated headers to include paths
Generated IPA headers from mojom files need to be installed to
$INCLUDE_PATH in order to be available system-wide. Without this,
out-of-tree IPAs won't be able to link and build themselves.

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: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-24 14:13:35 +03:00
Umang Jain
378f572e7f ipa: ipc: Rename CameraSensorInfo to IPACameraSensorInfo
This matches the naming convention for IPA IPC.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Acked-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.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-05-24 14:13:32 +03:00
Umang Jain
6449590b63 ipa: mojom: Move CameraSensorInfo struct exclusively to IPA IPC
CameraSensorInfo structure is designed to pass in camera sensor related
information from pipeline-handler to IPA. Since the pipeline-handler
and IPA are connected via mojom IPC IPA interface, the interface
itself provides a more suitable placement of CameraSensorInfo,
instead of camera_sensor.h (which is a libcamera internal header
ultimately, at this point).

As CameraSensorInfo is already defined in core.mojom, it is just
a matter of removing [skipHeader] tag to allow code-generation
of CameraSensorInfo.

Finally, update header paths to include CameraSensorInfo definition
from IPA interfaces instead of "libcamera/internal/camera_sensor.h".

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.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-05-24 14:13:28 +03:00
Umang Jain
ff9276cc62 ipa: Move core IPA interface documentation to a .cpp file
Moving the core.mojom documentation to its corresponding .cpp file
(core_ipa_interface.cpp). This will allow Doxygen to generate the
documentation for IPABuffer, IPASettings and IPAStream structures.
Since the .mojom files are placed in include/ directory, the .cpp file
will live in $sourcedir/src/libcamera/ipa/ - which can also contain
documentation for other mojom generated IPA interfaces in subsequent
commit.

Also hide the constructors in generated IPA interface from doxygen,
via  #ifndef __DOXYGEN__. These constructors provide no major value in
documenting them, instead will spew out doxygen warnings during the
build.

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
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-05-24 14:13:01 +03:00
Laurent Pinchart
b9d55fe69e libcamera: thread: Document race condition at stop time
When a thread stops, messages may be left in its message queue. Document
this in details, with a way to force processing of pending messages when
the thread is stopped.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-24 13:33:48 +03:00
Laurent Pinchart
cccb748000 libcamera: thread: Drop doc of asynchronous signals delivery to applications
The asynchronous signal delivery mechanism can't be used by application,
as it requires libcamera to be aware of the application event loop,
which has been dropped a long time ago. Drop the corresponding
documentation paragraph.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-05-24 12:27:17 +03:00
Laurent Pinchart
6551bd39f0 libcamera: thread: Enforce dispatchMessages() call context with assert
The Thread::dispatchMessages() function is meant to be called from
within the thread only. Catch incorrect usage with an ASSERT().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-05-24 12:27:07 +03:00
Laurent Pinchart
95cda2905c libcamera: thread: Document dispatchMessages() thread-safety requirements
The Thread class is incorrectly documented as thread-safe, as the
dispatchMessages() function isn't thread-safe. Fix the documentation by
tagging individual functions as thread-safe as appropriate.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2021-05-24 12:26:40 +03:00
Hirokazu Honda
a5f8ab82df libcamera: V4L2Control: remove V4L2Control classes
V4L2ControlId and V4L2ControlInfo are just convenience classes to
create ControlId and ControlInfo from v4l2_query_ext_control.
Therefore, there is no need of being a class. It is used only
from V4L2Device. This removes the classes and put the equivalent
functions of creating ControlId and ControlInfo in
v4l2_device.cpp.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-24 07:21:02 +03:00
Hirokazu Honda
afb503fa34 libcamera: pipeline: Remove unnecessary v4l2_controls.h includes
v4l2_controls.h is included in some places in pipeline codes.
But V4l2Control classes are not used there. This removes the
redundant v4l2_controls.h includes.

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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-24 06:51:53 +03:00
Hirokazu Honda
5a9d19210f libcamera: pipeline: ipu3: Try queuing pending requests if a buffer is available
IPU3CameraData stores requests that have been failed due to a
buffer shortage. The requests should be retried once enough
buffers are available. This sets the retry function as signal to
CIO2Device and IPU3Frame, and invokes it from
CIO2Device::tryReturnBuffer() and IPU3Frame::remove().

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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-24 05:55:56 +03:00
Hirokazu Honda
89dae58449 libcamera: pipeline: ipu3: Store requests in the case a buffer shortage
PipelineHandlerIPU3 returns -ENOBUFS and -ENOMEM on queueing a
request when there are not sufficient buffers for the request.
Since the request will be successful if it is queued later when
enough buffers are available. The requests failed due to a buffer
shortage should be stored and retried later in the FIFO order.
This introduces the queue in IPU3CameraData to do that.

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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-24 05:55:42 +03:00
Laurent Pinchart
fd1cbe8447 libcamera: log: Hide value of the ASSERT() macro
ASSERT() is a function-like macro that expands to internal code. Hide
the expansion from the generated documentation, as it would only confuse
the reader.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2021-05-22 14:08:25 +03:00