Commit graph

261 commits

Author SHA1 Message Date
Jacopo Mondi
021752924b libcamera: camera_sensor: Make V4L2_CID_EXPOSURE mandatory
Add the V4L2_CID_EXPOSURE control to the list of mandatory controls the
sensor driver has to report and document this new requirement.

While at it, re-sort the mandatory V4L2 controls in alphabetical
order in the CameraSensor class and remove the above comment as
the usage of the controls is better reported in the documentation.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-25 14:54:04 +01:00
Jacopo Mondi
dce1568a8a Documentation: sensor-driver: Correct camera rotation
The description of the V4L2_CID_CAMERA_SENSOR_ROTATION control
usage wrongly mentioned the camera "orientation" while it actually
reports the camera rotation.

Fix it by using the right term.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reported-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-20 10:42:03 +01:00
Jacopo Mondi
fc28358881 Documentation: sensor-drivers: Reorder introduction
Reorder the introductory section of the sensor driver requirements
document to match the expected English language syntax.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2021-01-20 10:41:59 +01:00
Jacopo Mondi
1b4997ef08 libcamera: Document sensor driver requirements
Document the feature an image sensor driver has to provide to be
fully libcamera-compliant.

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>
2021-01-18 10:39:13 +01:00
Laurent Pinchart
b7704820f4 utils: checkstyle.py: Drop astyle support
Formatting code using astyle doesn't lead to results as good as with
clang-format, and doesn't receive much test coverage as most developers
use clang-format. The code is thus bitrotting. Drop it.

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>
2020-12-29 16:45:36 +02:00
Niklas Söderlund
8992b3ffbb libcamera: pipeline_handler: Remove Camera argument from request handling
There is no need to pass the Camera pointer to queueRequest(),
completeBuffer() and completeRequest() as the Request also passed
contains the same information. Remove the Camera argument to avoid
situations where the information in the Request and the argument differ.

There is no functional change and no public API change as the interface
is only used between the Camera and PipelineHandler.

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>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-12-28 14:02:13 +01:00
Laurent Pinchart
67bf6bc459 Documentation: Fix Doxygen exclusion of details namespaces
The details namespaces in libcamera are used to hide implementation
details, and should thus be excluded from documentation generation. This
is done incorrectly by specifying the exclusion pattern "*::details::*"
which will ignore all namespaces and types in any details namespace, but
won't ignore functions. Fix it by removing the trailing "::*", causing
Doxygen to ignore the namespace itself, and thus all its contents.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-12-27 12:29:26 +02:00
Laurent Pinchart
dd1473d763 Documentation: Restore alphabetical order of sources in meson.build
Sort the docs_sources variable in Documentation/meson.build to ease
maintenance.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-12-27 12:29:12 +02:00
Sebastian Fricke
3fde82d849 Documentation: Add descriptions for environment variables
Describe the environment variables used in libcamera, excluded
variables are `LIBCAMERA_IPA_FORCE_C_API` and `LIBCAMERA_IPA_PROXY_PATH`,
the former because it is likely to be removed and the later because
it has no current use-case.

Add a brief explanation for the IPA configuration and IPA modules.
List all the available Log levels and categories and add a short guide
on how to use them for debugging.

Signed-off-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
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-12-27 12:29:05 +02:00
Laurent Pinchart
489a861f17 Documentation: Drop deprecated Doxygen COLS_IN_ALPHA_INDEX option
The Doxygen COLS_IN_ALPHA_INDEX option is deprecated, and generates a
warning with the Doxygen's master branch. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Umang Jain <email@uajain.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-12-27 12:28:24 +02:00
Naushir Patuck
a62b35b8c0 libcamera: pipeline: Pass libcamera controls into pipeline_handler::start()
Applications now have the ability to pass in controls that need to be
applied on startup, rather than doing it through Request where there might
be some frames of delay in getting the controls applied.

This commit adds the ability to pass in a set of libcamera controls into
the pipeline handlers through the pipeline_handler::start() method. These
controls are provided by the application through the camera::start()
public API.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-12-08 14:28:51 +02:00
Laurent Pinchart
f4fae10b47 Documentation: Fix doxygen warning
Recent doxygen versions don't appreciate unquoted PROJECT_NUMBER values
that contain spaces. Fix this by quoting the string.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-12-01 15:15:01 +02:00
Paul Elder
00cab9cb56 Documentation: tracing: Add tracing guide
Add guide for tracepoints, including how to define and use them.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-11-03 11:35:16 +09:00
Paul Elder
fcc6d4bd76 libcamera: tracing: Implement tracing infrastructure
Implement tracing infrastructure in libcamera. It takes .tp files, as
required by lttng, and generates a tracepoint header and C file, as lttng
requires. meson is updated accordingly to get it to compile with the
rest of libcamera. Update the documentation accordingly.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-11-03 11:07:21 +09:00
Sebastian Fricke
5e738eb4d5 Documentation: Fix typo in pipeline handler guide
s/Start and the stop the image acquisition/
 /Start and stop the image acquisition/

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com>
2020-10-26 17:52:54 +01:00
Hirokazu Honda
e04bd18589 libcamera: Omit extra semicolons
The end semicolons with LOG_DEFINE_CATEGORY,
LOG_DECLARE_CATEGORY and REGISTER_PIPELINE_HANDLER are
unnecessary.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-20 13:15:52 +03:00
Paul Elder
7e59bccb35 Documentation: coding-style: Document global variable guidelines
Document the issue related to global variable dependencies and how to
avoid them.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-10-07 19:17:31 +09:00
Umang Jain
b83ee94fe2 Documentation: guides: pipeline-handler: Update clamp() namespace
Update the sample code using utils::clamp() to std::clamp().

Fixes: f2734ff3ab ("libcamera: Replace utils::clamp() with std::clamp()")
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-09-30 09:35:49 +01:00
Ricardo Ribalda
aba567338b Documentation: Move all dependencies into features
This way if the user enables the documentation and the dependencies are
missing the configure fails.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-24 21:08:30 +03:00
Ricardo Ribalda
4e998cea15 Documentation: Search for dot binary
Doxygen depends on dot to generate the documentation. Make this
dependency explicit on the meson file.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-09-24 21:08:27 +03:00
Laurent Pinchart
e390f9f618 Documentation: Adjust guidelines regarding math.h header
While libcamera prefers usage of the C standard library headers (xxx.h)
over the C++ version (cxxx), we make an exception for cmath as the
overloaded versions of the math functions are convenient. Document this,
and adjust checkstyle.py accordingly.

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:55:02 +03:00
Laurent Pinchart
b869d4463e meson: Switch to C++17
Due to popular request, move from C++14 to C++17. This will allow
dropping some custom constructs (such as a custom utils::clamp),
benefiting from new language features, and dropping gcc 5 and 6 from the
compilation tests.

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:03:09 +03:00
Chris Chinchilla
33fe27741b Documentation: Guides: Pipeline Handler Writer's Guide
Introduce a pipeline-handler writers guide to provide a walk through of
the steps and concepts required to implement a new Pipeline Handler.

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

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

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

Signed-off-by: Chris Chinchilla <chris@gregariousmammal.com>
[Kieran: Rework/Reflow, add diagrams, licensing]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-08-20 16:56:07 +01:00
Laurent Pinchart
9d4fb49dbc Documentation: Drop TCL_SUBST tag from Doxyfile.in
The TCL_SUBST tag is deprecated and causes doxygen 1.18.8 to generate a
warning. Drop it from Doxyfile.in.

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-16 05:33:09 +03:00
Laurent Pinchart
91b6634819 licenses: Add SPDX headers to the website builder and theme
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-06-09 23:26:12 +03:00
Marvin Schmidt
46b3402b59 docs: Markup LD_PRELOAD as code
LD_PRELOAD is an environment variable, use code markup to reflect that
semantic

Signed-off-by: Marvin Schmidt <marvin.schmidt1987@gmail.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-05 09:29:40 +01:00
Marvin Schmidt
c3c0afd94b docs: coding-style: Change full stop to colon
Signed-off-by: Marvin Schmidt <marvin.schmidt1987@gmail.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-05 09:29:40 +01:00
Marvin Schmidt
e18c7a14a3 docs: Remove trailing whitespace
Signed-off-by: Marvin Schmidt <marvin.schmidt1987@gmail.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-05 09:29:40 +01:00
Marvin Schmidt
90c7ce6ad2 docs: Remove stray HTML tags
Signed-off-by: Marvin Schmidt <marvin.schmidt1987@gmail.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-05 09:29:40 +01:00
Laurent Pinchart
aa7e7175c7 meson: Rename variables storing headers lists
The list of public, IPA and internal header files are stored in three
meson variables, named libcamera_api, libcamera_ipa_api and
libcamera_headers respectively. The lack of uniformity is a bit
confusing. Fix it by renaming those variables to
libcamera_public_headers, libcamera_ipa_headers and
libcamera_internal_headers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-05-18 12:56:20 +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
cfc9e14874 Documentation: coding-style: Fix ordered lists
The syntax used for ordered lists is incorrect. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-11 00:30:14 +03:00
Laurent Pinchart
2155a9b74e licenses: Add SPDX headers to Doxygen configuration
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-15 19:51:56 +03:00
Laurent Pinchart
ca9ee2127f licenses: Add SPDX headers to RST documentation
The documentation files are licensed under CC-BY-SA-4.0, but this has
never been specified explicitly. Add corresponding SPDX headers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-15 19:51:56 +03:00
Laurent Pinchart
5bbc607c9f licenses: Move developer's certificate of origin to Documentation/
The developer's certificate of origin isn't a license, move it from
LICENSES/ to Documentation/ by incorporating it in contributing.rst.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-15 19:51:56 +03:00
Laurent Pinchart
300f6e4434 libcamera: controls: Add templates to convert a type T to a ControlType
These will be used to implement ControlValue::get() and set() as
template functions.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-06 18:10:21 +02:00
Jacopo Mondi
09ab21b85a libcamera: Add a C++20-compliant std::span<> implementation
C++20 will contain a std::span<> class that provides view over a
contiguous sequence of objects, the storage of which is owned by some
other object.

Add a compatible implementation to the utils namespace. This will be
used to implement array controls.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-03-06 18:08:37 +02:00
Laurent Pinchart
31a05b70aa libcamera: utils: Add string splitter utility function
Add a utils::split() function that splits a string for the purpose of
iterating over substrings. It returns an object of unspecified type that
can be used in range-based for loops.

Signed-off-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-02-13 16:47:56 +00:00
Laurent Pinchart
fcfa11177f libcamera: Define the threading model
Document the design of libcamera's threading support, and prepare to
document thread-safety of classes and functions with a doxygen alias
command.

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-02-13 12:34:28 +02:00
Kieran Bingham
4b44f61c53 Documentation: Add linkcheck target
Sphinx provides a run-target to verify external links specified in the
documentation. This requires an active connection to be able to validate
the links.

Add a meson target to integrate the linkcheck facility into our build
and test system.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-31 14:54:28 +00:00
Laurent Pinchart
b6467bd9c6 libcamera: camera_manager: Move private data members to private implementation
Use the d-pointer idiom ([1], [2]) to hide the private data members from
the CameraManager class interface. This will ease maintaining ABI
compatibility, and prepares for the implementation of the CameraManager
class threading model.

[1] https://wiki.qt.io/D-Pointer
[2] https://en.cppreference.com/w/cpp/language/pimpl

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-01-23 22:36:08 +02:00
Laurent Pinchart
9a61a13466 meson.build: Switch to C++14
C++14 is a minor release that doesn't introduce major new concepts or
paradigms compared to C++11, but brings two useful changes for us:

- std::make_unique allows dropping our custom implementation in utils.
- Functions returning constexpr are not assumed to be const anymore,
  which is needed to create a standard-conformant span implementation.

All the g++ and clang++ versions we support and test (g++-5 onwards and
clang++6 onwards) support C++14. However, due to a defect in the
original C++14 specification, solved in N4387 ([1]), compilation would
fail on g++-5 due to the use of std::map::emplace() with a non-copyable
value type. It turns out we can easily fix it by switching to the
explicit piecewise emplace() overload.

There is thus really nothing holding back the switch. Let's do it, and
update the coding style accordingly.

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4387

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-01-14 19:06:40 +02:00
Laurent Pinchart
dce6bb0e30 libcamera: bound_method: Rename Bound*Method to BoundMethod*
Most of the bound method classes are named with a BoundMethod prefix,
except for BoundMemberMethod and BoundStaticMethod. Rename them to
BoundMethodMember and BoundMethodStatic respectively to make the code
more coherent.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-07 22:29:38 +02:00
Laurent Pinchart
b0135a1522 libcamera: bound_method: Manage BoundMethodPack through std::shared_ptr
The bound method arguments pack will need to be accessed by the method
invoker in order to retrieve the method return value when using a
blocking connection type. We thus can't delete the pack unconditionally
in the bound method target thread. We also can't delete it
unconditionally in the invoker's thread, as for queued connections the
pack will be used in the target thread after the invoker completes.

This shows that ownership of the arguments pack is shared between two
contexts. As a result, manage it using std::shared_ptr<>.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-07 22:29:31 +02:00
Laurent Pinchart
257bea076c libcamera: bound_method: Store method arguments in a class
Create a new BoundMethodPack class to replace the PackType type alias.
This will allow adding additional fields to the arguments pack, when
adding support for propagation of bound method return values.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-01-07 22:29:29 +02:00
Jacopo Mondi
132d99bc8f ipa: Switch to the plain C API
Switch IPA communication to the plain C API. As the IPAInterface class
is easier to use for pipeline handlers than a plain C API, retain it and
add an IPAContextWrapper that translate between the C++ and the C APIs.

On the IPA module side usage of IPAInterface may be desired for IPAs
implemented in C++ that want to link to libcamera. For those IPAs, a new
IPAInterfaceWrapper helper class is introduced to wrap the IPAInterface
implemented internally by the IPA module into an ipa_context,
ipa_context_ops and ipa_callback_ops.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-20 21:48:00 +02:00