summaryrefslogtreecommitdiff
path: root/README.rst
AgeCommit message (Collapse)Author
2022-08-09libcamera: Make IPA module signing recommended instead of mandatoryLaurent Pinchart
Commit b382f67c833d ("libcamera: Make IPA module signing mandatory for the meantime") made openssl and gnutls dependencies mandatory to work around the lack of proper IPA module isolation support, which broke operation without module signatures. This has now been fixed, so IPA module isolation isn't strictly required anymore. There are few use cases for disabling module signing completely, given that the openssl or gnutls dependencies are available on the vast majority of systems and the overheard introduced by isolating all IPA modules when signatures are not available is better avoided. Nonetheless, libcamera should operate properly with forced IPA module isolation, so we can support those use cases. Adopt a middle-ground approach to avoid unintentional isolation by documenting the dependencies as recommended, and warn at meson setup time if they are not found. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-08-09libcamera: pub_key: Support openssl as an alternative to gnutlsLaurent Pinchart
Support verify IPA signatures with openssl as an alternative to gnutls, to offer more flexibility in the selection of dependencies. Use gnutls by default, for no specific reason as both are equally well supported. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Eric Curtin <ecurtin@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-07-28cam: sdl_sink: Use libjpeg over SDL2_imageEric Curtin
We were using the libjpeg functionality of SDL2_image only, instead just use libjpeg directly to reduce our dependancy count, it is a more commonly available library. Signed-off-by: Eric Curtin <ecurtin@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-07-28ipa: raspberrypi: Use YamlParser to replace dependency on boostLaurent Pinchart
The Raspberry Pi IPA module depends on boost only to parse the JSON tuning data files. As libcamera depends on libyaml, use the YamlParser class to parse those files and drop the dependency on boost. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2022-06-27README: Add some extra optional dependencies for cam sinksEric Curtin
KMS sink requires some DRM libraries, SDL sink requires some SDL libraries. Suggested-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Eric Curtin <ecurtin@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-06-22README: Add short testing instructions with camLaurent Pinchart
The README.rst file contains the getting started instructions, but lacks a simple way to test libcamera. Add a short section about basic cam usage. Suggested-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-05-10meson: Require meson 0.56+Tomi Valkeinen
Ubuntu 22.04 LTS has been released with meson 0.61.2, and it is easy to install a recent version of meson with python-pip, so let's update the required meson version to get rid of the Android compilation limitation. Additionally, going to meson 0.55 gives the ability to have patch files for git-wraps which is useful for Python bindings. 0.56 brings meson.project_source_root() and meson.project_build_root(), allowing us to get rid of the deprecated meson.source_root() and meson.build_root(). So, let's update the required meson version to 0.56. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@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> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-05-10libcamera: Introduce YamlParser as a helper to parse yaml filesHan-Lin Chen
Introduce YamlParser as a helper to convert contents of a yaml file to a tree based structure for easier reading, and to avoid writing parser with raw yaml tokens. The class is based on libyaml, and only support reading but not writing a yaml file. The interface is inspired by Json::Value class from jsoncpp: http://jsoncpp.sourceforge.net/class_json_1_1_value.html Signed-off-by: Han-Lin Chen <hanlinchen@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-03-17README: Extend gstreamer examplesKieran Bingham
There have been many reports of facing difficulties with the gstreamer element and getting the libcamerasrc to successfully negotiate with other gstreamer elements. This is often due to the current limitations on colorimetry and frame rate support in the element, and can usually be worked around by specifying those explicitly in the caps. Provide a tested example to capture, encode, and stream images as jpeg to a remote device in the gstreamer section of the getting started readme. 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>
2022-01-03meson: reduce required version to 0.53Christian Rauch
Building the libcamera Android layer currently makes use of features from meson 0.55. The core libcamera framework in the default configuration without android enabled uses the 'summary' feature available in 0.53, and is the lowest supportable meson version if the Android HAL is excluded. Ubuntu 20.04 LTS currently provides meson 0.53 and represents an acceptable minimum version to support. Platforms utilising the Android component will have full control over their build environment and can ensure that they provide a more recent version of meson. Reduce the supported meson version for the project to 0.53 to facilitate building on more distributions without having to manually update the meson package. Meson will output a warning that features not available in 0.53 are used if the Android HAL is enabled. This is considered as an acceptable middleground to improve the experience on the latest Ubuntu LTS, until 22.04 LTS is released and provides a newer meson version. Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de> [Kieran: Add comment about the android meson requirements] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-12-27README: Convert tabs to spacesJohann Koenig
The initial commit a146cdbf20cb ("readme: Provide build requirements") used tabs for all the dependencies. The first time a line was edited in commit 2de78434ca71 ("meson: Bump required version to 0.47") tabs were not kept. This makes them all consistent. Signed-off-by: Johann Koenig <johannkoenig@google.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>
2021-11-15lc-compliance: Build with gtest in subprojectsHirokazu Honda
libgtest-dev is provided as a static library at least by Debian 10. The compiler and linker to create the static library might be different from ones used for libcamera. This causes a problem upon linking. This puts gtest code to subprojects, builds the code and link it for lc-compliance. However, libgtest is locally built as a library on ChromeOS and thus the used compiler and linker are the same as one used for libcamera. We don't do these on ChromeOS build environment. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Tested-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-10-19README: Document dependencies for backtrace generationLaurent Pinchart
libcamera now has the ability to use libdw and libunwind to generate backtraces, in addition to the glibc backtrace() function. libdw provides the most detailed output and is highly recommended, but is limited to parsing backtraces, it doesn't support capturing them. libunwind and backtrace() provide both features. If backtrace() is available, libunwind will not bring any improvement. 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-10-14README: Add documentation packageKieran Bingham
When building the documentaion with Doxygen, an error will be reported if latex can not find the extra packages provided by texlive-latex-extra. While this package is optional, document this requirement for Documentation. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-10-13README: Document GST_DEBUG values to debug libcamerasrcLaurent Pinchart
Problems with libcamerasrc are reported quite frequently. To help users diagnosing them, document how to obtain libcamerasrc debug messages through GST_DEBUG. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-10-07README: Add lc-compliance dependenciesHirokazu Honda
libevent-dev and libgtest-dev are required for lc-compliance. Write them into lc-compliance dependencies in README.rst. 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-09-24libcamera: Standardize URLs to git repositoriesLaurent Pinchart
When the libcamera project was started, we had no public git tree hosted on git.libcamera.org. The problem has been addressed a while ago, and the git.linuxtv.org libcamera repository is now a mirror of the main git tree. The mirror is useful to benefit from the linuxtv.org automated compile tests, but it can also confuse users who don't know where the official version is. To try and clarify this, use the git.libcamera.org URL consistently through the project. This doesn't void the validatity of the linuxtv.org repository which will continue to mirror the libcamera.org repository. 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-09-14README: Fix android dependenciesKieran Bingham
While the distribution is unspecified, The README.rst gives debian/ubuntu named dependencies for all except the android requirements. Update the android dependencies to match the others, by showing that the -dev package is required. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-25README.rst: Update gstreamer element guidanceKieran Bingham
The Gstreamer gstlibcamerasrc element operates better with the glimagesink, as it can perform direct renders or hardware accellerated image format conversion. Further extend the sample commands to demonstrate how to specify a fixed width and height parameter to the pipeline. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-05-25android: Add CameraHalConfig classJacopo Mondi
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-25libcamera: List dependency for Android Camera3 HALJacopo Mondi
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-04-05Add alternative meson install commandVedant Paranjape
While installing meson using pip3 install --user meson, due to python path issues, build.ninja can't be located by ninja. meson generates ninja files fine, but then when you run ninja, it is unable to find meson's build.ninja python module due to path issues. It gives the following error on ninja -C build install: ninja: Entering directory `build' ninja: error: loading 'build.ninja': No such file or directory After uninstalling meson using pip3 and installing it again using pip without --user argument solved the issue. Add a troubleshooting section to the readme to describe this issue and suggest possible solutions. Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
2021-03-19Documentation: Fix typos and wrong rST syntax for literalsNícolas F. R. A. Prado
Fix some typos and some literals using ` instead of ``. Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-03-08README: Update tracing dependenciesKieran Bingham
The packages required for tracing libcamera projects were incorrectly specified. Update with the correct prefix for the dev package on liblttng-ust-dev and also provide the lttng-tools package which provides the utilities required to handle tracing. Signed-off-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: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-02-04subprojects: Add libyuv and built if -Dandroid=enabledHirokazu Honda
Android HAL adaptation layer may need image processing, for example, scaling and format conversion. Libyuv is a general image processing. This adds libyuv to subprojects, so that it is forked locally and can be used with Android HAL implementation code. 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>
2020-11-15cam: Use libevent to implement event loopLaurent Pinchart
To prepare for removal of the EventDispatcher from the libcamera public API, switch to libevent to handle the event loop. 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-11-11README, meson: Add dependency on ply and jinja2 for IPA interface generationPaul Elder
Specify in the readme and meson file that we depend on python3-ply and python3-jinja2 for generating the IPA interface. 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> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-11-03libcamera: tracing: Implement tracing infrastructurePaul Elder
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-09-24meson: Bump meson version to 0.51Ricardo Ribalda
Version 0.51 allows, among others, checking for python modules, which is a required feature. It is also now easily accessible: it is in stable distros such as Debian testing, or in pip: https://tracker.debian.org/pkg/meson https://pypi.org/project/meson/ 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-24README: Add missing dependency for documentationRicardo Ribalda
Doxygen fails to create the documentation with this message: [145/276] Generating doxygen with a custom command sh: 1: dot: not found error: Problems running dot: exit code=127, command='dot', arguments='"/home/user/libcamera/build/Documentation/api-html/inline_dotgraph_1.dot" -Tpng -o "/home/user/libcamera/build/Documentation/api-html/dot_inline_dotgraph_1.png"' sh: 1: dot: not found error: Problems running dot: exit code=127, command='dot', arguments='"/home/user/libcamera/build/Documentation/api-html/inline_dotgraph_1.dot" -Tcmapx -o "/home/user/libcamera/build/Documentation/api-html/dot_inline_dotgraph_1.map"' [276/276] Linking target test/utils 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-24README: Add missing libtiff-dev package for qcamRicardo Ribalda
Without it: Run-time dependency libtiff-4 found: NO (tried pkgconfig and cmake) 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-24README: Add missing package for Qt5 toolsRicardo Ribalda
Without it: Program /usr/lib/x86_64-linux-gnu/qt5/bin/lrelease found: NO Program lrelease-qt5 found: NO Program lrelease found: NO found but need: '== 5.14.2' 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-24README: Move pkg-config to Meson sectionRicardo Ribalda
pkg-config it is not only used to detect libudev-dev, it is used for detecting gstreamer and others. So it is more correct to place it on the Meson Build system section. 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-24README: Add libboost to list of dependenciesRicardo Ribalda
Raspberry Pi IPA, which is enabled by default, requires libboost to compile. Specify in the documentation its dependencies and how to disable the IPA. Reviewed-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-24README: Move the required dependencies to the topRicardo Ribalda
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-24README: Unify dependency namesRicardo Ribalda
All the dependencies are for libcamera, so we should move all the packages under this paragraph, or make a paragraph for Meson, and a second one for python3-yaml. I think the later is more clear. 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-04-16libcamera: Make IPA module signing mandatory for the meantimeLaurent Pinchart
IPA module signing is optional, but when not available due to missing dependencies, we hit failures due to a non fully implemented IPA isolation. Make module signing mandatory until isolation is functional. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-16libcamera: Document dependencies for IPA module signingLaurent Pinchart
Document the dependency on libgnutls28-dev and openssl for IPA module signing int he README.rst file. While at it, sort the entries alphabetically. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-15licenses: Add SPDX headers to RST documentationLaurent Pinchart
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-03-07gst: Document dependencies and quick usageNicolas Dufresne
This is a quick startup guide allowing to build and use the GStreamer element from the libcamera source tree. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-17README: Remove duplicated lineLaurent Pinchart
The commit 2de78434ca71 ("meson: Bump required version to 0.47") included an extra duplicated line (my bad, the issue happened when applying). Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-01-17meson: Bump required version to 0.47Nicolas Dufresne
This is needed to use option type 'feature'. This is a tri-state (auto/enabled/disabled) which comes with utility to enable them all, or disabled them all to avoid any dynamic selection happening. It can also be used as value to any "required" field. This will be used in GStreamer support. If you don't have a recent enough meson in your distribution, you can always install or upgrade your version using pip3. pip3 install --user meson pip3 install --user --upgrade meson Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-18README: Simplify a bit the build instructionsEzequiel Garcia
Less typing for the same result. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-24Documentation: Add git clone information to Getting StartedLaurent Pinchart
As the Getting Started section is displayed on the website, it should contain commands related to cloning the repository. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-23Documentation: Hide the Getting Started informationLaurent Pinchart
The Getting Started information makes little sense on the generated documentation, as a developer with documentation compiled from a local libcamera source tree has already got started. We however want to keep the information in the top-level README.rst as it is useful there. In order to hide the Getting Started information from the front page while keeping it in README.rst, add comments to delimitate sections of README.rst, and include only a subset of the file in the front page. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-10-05libcamera: controls: Auto-generate control_ids.h and control_ids.cppLaurent Pinchart
Bring back auto-generation of control ids. In this version, both the header and the source files are generated from a single YAML file that stores all control definitions. This allows centralising controls in a single file, while the previous version required keeping both declarations (in a header) and documentation (in a the source) in sync manually. Using YAML as a format to store control definitions is a trade-off between ease of use (there are many YAML parsers available) and simplicity (XML was considered, but would have lead to more complex processing). A new build time dependency is added on python3-yaml, which should be available as a package in all distributions and build environments. The YAML format is likely to change over time as we improve documentation of controls, the first version simply copies the information currently available. Future improvements should also include a YAML schema to validate the YAML source file. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-08-16readme: Provide build requirementsKieran Bingham
Provide an initial list of build dependancies for Debian based systems. Other distributions will be added separately. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-08-16readme: Move index page content to READMEKieran Bingham
Move the introduction content from the index.rst to the README.rst so that it can also be found quickly from the top level. Include the README.rst directly into the index.rst to continue serving it as the front page material. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-08-16readme: Convert from Markdown to RSTKieran Bingham
The Documentation and top-level README both serve to provide information to new developers and users of libcamera. Currently our README.md is sparse, and should be expanded with more useful information such as build requirements as well as compilation directions. Any information provided in the README also serves a purpose in the main documentation and website and could be a cause of duplicated content. To allow direct integration of the top level README document into our sphinx documentation (and thus the libcamera.org website) convert the README.md into ReSTructured text format. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
"hl opt"><uint8_t>::const_iterator dataEnd, [[maybe_unused]] std::vector<SharedFD>::const_iterator fdsBegin, [[maybe_unused]] std::vector<SharedFD>::const_iterator fdsEnd, [[maybe_unused]] ControlSerializer *cs) { return { dataBegin, dataEnd }; } /* * ControlList is serialized as: * * 4 bytes - uint32_t Size of serialized ControlInfoMap, in bytes * 4 bytes - uint32_t Size of serialized ControlList, in bytes * X bytes - Serialized ControlInfoMap (using ControlSerializer) * X bytes - Serialized ControlList (using ControlSerializer) * * If data.infoMap() is nullptr, then the default controls::controls will * be used. The serialized ControlInfoMap will have zero length. */ template<> std::tuple<std::vector<uint8_t>, std::vector<SharedFD>> IPADataSerializer<ControlList>::serialize(const ControlList &data, ControlSerializer *cs) { if (!cs) LOG(IPADataSerializer, Fatal) << "ControlSerializer not provided for serialization of ControlList"; size_t size; std::vector<uint8_t> infoData; int ret; /* * \todo Revisit this opportunistic serialization of the * ControlInfoMap, as it could be fragile */ if (data.infoMap() && !cs->isCached(*data.infoMap())) { size = cs->binarySize(*data.infoMap()); infoData.resize(size); ByteStreamBuffer buffer(infoData.data(), infoData.size()); ret = cs->serialize(*data.infoMap(), buffer); if (ret < 0 || buffer.overflow()) { LOG(IPADataSerializer, Error) << "Failed to serialize ControlList's ControlInfoMap"; return { {}, {} }; } } size = cs->binarySize(data); std::vector<uint8_t> listData(size); ByteStreamBuffer buffer(listData.data(), listData.size()); ret = cs->serialize(data, buffer); if (ret < 0 || buffer.overflow()) { LOG(IPADataSerializer, Error) << "Failed to serialize ControlList"; return { {}, {} }; } std::vector<uint8_t> dataVec; dataVec.reserve(8 + infoData.size() + listData.size()); appendPOD<uint32_t>(dataVec, infoData.size()); appendPOD<uint32_t>(dataVec, listData.size()); dataVec.insert(dataVec.end(), infoData.begin(), infoData.end()); dataVec.insert(dataVec.end(), listData.begin(), listData.end()); return { dataVec, {} }; } template<> ControlList IPADataSerializer<ControlList>::deserialize(std::vector<uint8_t>::const_iterator dataBegin, std::vector<uint8_t>::const_iterator dataEnd, ControlSerializer *cs) { if (!cs) LOG(IPADataSerializer, Fatal) << "ControlSerializer not provided for deserialization of ControlList"; if (std::distance(dataBegin, dataEnd) < 8) return {}; uint32_t infoDataSize = readPOD<uint32_t>(dataBegin, 0, dataEnd); uint32_t listDataSize = readPOD<uint32_t>(dataBegin, 4, dataEnd); std::vector<uint8_t>::const_iterator it = dataBegin + 8; if (infoDataSize + listDataSize < infoDataSize || static_cast<uint32_t>(std::distance(it, dataEnd)) < infoDataSize + listDataSize) return {}; if (infoDataSize > 0) { ByteStreamBuffer buffer(&*it, infoDataSize); ControlInfoMap map = cs->deserialize<ControlInfoMap>(buffer); /* It's fine if map is empty. */ if (buffer.overflow()) { LOG(IPADataSerializer, Error) << "Failed to deserialize ControlLists's ControlInfoMap: buffer overflow"; return ControlList(); } } it += infoDataSize; ByteStreamBuffer buffer(&*it, listDataSize); ControlList list = cs->deserialize<ControlList>(buffer); if (buffer.overflow()) LOG(IPADataSerializer, Error) << "Failed to deserialize ControlList: buffer overflow"; return list; } template<> ControlList IPADataSerializer<ControlList>::deserialize(const std::vector<uint8_t> &data, ControlSerializer *cs) { return deserialize(data.cbegin(), data.end(), cs); } template<> ControlList IPADataSerializer<ControlList>::deserialize(const std::vector<uint8_t> &data, [[maybe_unused]] const std::vector<SharedFD> &fds, ControlSerializer *cs) { return deserialize(data.cbegin(), data.end(), cs); } template<> ControlList IPADataSerializer<ControlList>::deserialize(std::vector<uint8_t>::const_iterator dataBegin, std::vector<uint8_t>::const_iterator dataEnd, [[maybe_unused]] std::vector<SharedFD>::const_iterator fdsBegin, [[maybe_unused]] std::vector<SharedFD>::const_iterator fdsEnd, ControlSerializer *cs) { return deserialize(dataBegin, dataEnd, cs); } /* * const ControlInfoMap is serialized as: * * 4 bytes - uint32_t Size of serialized ControlInfoMap, in bytes * X bytes - Serialized ControlInfoMap (using ControlSerializer) */ template<> std::tuple<std::vector<uint8_t>, std::vector<SharedFD>> IPADataSerializer<ControlInfoMap>::serialize(const ControlInfoMap &map, ControlSerializer *cs) { if (!cs) LOG(IPADataSerializer, Fatal) << "ControlSerializer not provided for serialization of ControlInfoMap"; size_t size = cs->binarySize(map); std::vector<uint8_t> infoData(size); ByteStreamBuffer buffer(infoData.data(), infoData.size()); int ret = cs->serialize(map, buffer); if (ret < 0 || buffer.overflow()) { LOG(IPADataSerializer, Error) << "Failed to serialize ControlInfoMap"; return { {}, {} }; } std::vector<uint8_t> dataVec; appendPOD<uint32_t>(dataVec, infoData.size()); dataVec.insert(dataVec.end(), infoData.begin(), infoData.end()); return { dataVec, {} }; } template<> ControlInfoMap IPADataSerializer<ControlInfoMap>::deserialize(std::vector<uint8_t>::const_iterator dataBegin, std::vector<uint8_t>::const_iterator dataEnd, ControlSerializer *cs) { if (!cs) LOG(IPADataSerializer, Fatal) << "ControlSerializer not provided for deserialization of ControlInfoMap"; if (std::distance(dataBegin, dataEnd) < 4) return {}; uint32_t infoDataSize = readPOD<uint32_t>(dataBegin, 0, dataEnd); std::vector<uint8_t>::const_iterator it = dataBegin + 4; if (static_cast<uint32_t>(std::distance(it, dataEnd)) < infoDataSize) return {}; ByteStreamBuffer buffer(&*it, infoDataSize); ControlInfoMap map = cs->deserialize<ControlInfoMap>(buffer); return map; } template<> ControlInfoMap IPADataSerializer<ControlInfoMap>::deserialize(const std::vector<uint8_t> &data, ControlSerializer *cs) { return deserialize(data.cbegin(), data.end(), cs); } template<> ControlInfoMap IPADataSerializer<ControlInfoMap>::deserialize(const std::vector<uint8_t> &data, [[maybe_unused]] const std::vector<SharedFD> &fds, ControlSerializer *cs) { return deserialize(data.cbegin(), data.end(), cs); } template<> ControlInfoMap IPADataSerializer<ControlInfoMap>::deserialize(std::vector<uint8_t>::const_iterator dataBegin, std::vector<uint8_t>::const_iterator dataEnd, [[maybe_unused]] std::vector<SharedFD>::const_iterator fdsBegin, [[maybe_unused]] std::vector<SharedFD>::const_iterator fdsEnd, ControlSerializer *cs) { return deserialize(dataBegin, dataEnd, cs); } /* * SharedFD instances are serialized into four bytes that tells if the SharedFD * is valid or not. If it is valid, then for serialization the fd will be * written to the fd vector, or for deserialization the fd vector const_iterator * will be valid. * * This validity is necessary so that we don't send -1 fd over sendmsg(). It * also allows us to simply send the entire fd vector into the deserializer * and it will be recursively consumed as necessary. */ template<> std::tuple<std::vector<uint8_t>, std::vector<SharedFD>> IPADataSerializer<SharedFD>::serialize(const SharedFD &data, [[maybe_unused]] ControlSerializer *cs) { std::vector<uint8_t> dataVec; std::vector<SharedFD> fdVec; /* * Store as uint32_t to prepare for conversion from validity flag * to index, and for alignment. */ appendPOD<uint32_t>(dataVec, data.isValid()); if (data.isValid()) fdVec.push_back(data); return { dataVec, fdVec }; } template<> SharedFD IPADataSerializer<SharedFD>::deserialize([[maybe_unused]] std::vector<uint8_t>::const_iterator dataBegin, [[maybe_unused]] std::vector<uint8_t>::const_iterator dataEnd, std::vector<SharedFD>::const_iterator fdsBegin, std::vector<SharedFD>::const_iterator fdsEnd, [[maybe_unused]] ControlSerializer *cs) { ASSERT(std::distance(dataBegin, dataEnd) >= 4); uint32_t valid = readPOD<uint32_t>(dataBegin, 0, dataEnd); ASSERT(!(valid && std::distance(fdsBegin, fdsEnd) < 1)); return valid ? *fdsBegin : SharedFD(); } template<> SharedFD IPADataSerializer<SharedFD>::deserialize(const std::vector<uint8_t> &data, const std::vector<SharedFD> &fds, [[maybe_unused]] ControlSerializer *cs) { return deserialize(data.cbegin(), data.end(), fds.cbegin(), fds.end()); } /* * FrameBuffer::Plane is serialized as: * * 4 byte - SharedFD * 4 bytes - uint32_t Offset * 4 bytes - uint32_t Length */ template<> std::tuple<std::vector<uint8_t>, std::vector<SharedFD>> IPADataSerializer<FrameBuffer::Plane>::serialize(const FrameBuffer::Plane &data, [[maybe_unused]] ControlSerializer *cs) { std::vector<uint8_t> dataVec; std::vector<SharedFD> fdsVec; std::vector<uint8_t> fdBuf; std::vector<SharedFD> fdFds; std::tie(fdBuf, fdFds) = IPADataSerializer<SharedFD>::serialize(data.fd); dataVec.insert(dataVec.end(), fdBuf.begin(), fdBuf.end()); fdsVec.insert(fdsVec.end(), fdFds.begin(), fdFds.end()); appendPOD<uint32_t>(dataVec, data.offset); appendPOD<uint32_t>(dataVec, data.length); return { dataVec, fdsVec }; } template<> FrameBuffer::Plane IPADataSerializer<FrameBuffer::Plane>::deserialize(std::vector<uint8_t>::const_iterator dataBegin, std::vector<uint8_t>::const_iterator dataEnd, std::vector<SharedFD>::const_iterator fdsBegin, [[maybe_unused]] std::vector<SharedFD>::const_iterator fdsEnd, [[maybe_unused]] ControlSerializer *cs) { FrameBuffer::Plane ret; ret.fd = IPADataSerializer<SharedFD>::deserialize(dataBegin, dataBegin + 4, fdsBegin, fdsBegin + 1); ret.offset = readPOD<uint32_t>(dataBegin, 4, dataEnd); ret.length = readPOD<uint32_t>(dataBegin, 8, dataEnd); return ret; } template<> FrameBuffer::Plane IPADataSerializer<FrameBuffer::Plane>::deserialize(const std::vector<uint8_t> &data, const std::vector<SharedFD> &fds, ControlSerializer *cs) { return deserialize(data.cbegin(), data.end(), fds.cbegin(), fds.end(), cs); } #endif /* __DOXYGEN__ */ } /* namespace libcamera */