summaryrefslogtreecommitdiff
path: root/src/libcamera/meson.build
AgeCommit message (Collapse)Author
2020-08-06android: Introduce JPEG encodingKieran Bingham
Provide an encoder interface and implement a JPEG encoder using libjpeg. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-08-05libcamera: sysfs: Add helper to lookup sysfs path of a character deviceNiklas Söderlund
Add a helper function to lookup the sysfs path of a character device. Store the function in a new libcamera::sysfs namespace as there is not class to host it. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2020-06-18libcamera: Define constants for pixel formats in the public APILaurent Pinchart
libcamera uses pixel format FourCC and modifier values from DRM. This requires inclusion of drm_fourcc.h, creating a dependency on a header that is packaged differently between distributions, and causing possible issues with third-party applications. Define constants for the supported pixel formats in the new formats.h public API header, in order to remove the dependency on drm_fourcc.h. The header is generated by a Python script from a list of supported formats. The numerical values for the FourCC and modifier are extracted from drm_fourcc.h by the script, ensuring that numerical values are not inadvertently modified and preserving the direct interoperability. The pixel formats constants can't be generated solely from drm_fourcc.h, as that header defines FourCC values and modifier values, but doesn't list the valid combinations. The supported formats are thus stored in a YAML file, which contains the FourCC and optional modifier for each supported format. We may later extend the YAML file to include formats documentation, and possibly formats metadata to populate the pixelFormatInfo map (in formats.cpp) automatically. Now that two formats.h header are present (one in include/libcamera/ and one in include/libcamera/internal/), we need to explicitly qualify the Doxygen \file directive with a path. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-06-06libcamera: Rename pixelformats.{cpp,h} to pixel_format.{cpp,h}Laurent Pinchart
The libcamera source files are named after class names, using snake_case. pixelformats.h and pixelformats.cpp don't comply with that rule. Fix them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-05-18meson: Rename variables storing headers listsLaurent Pinchart
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-16libcamera: Move internal headers to include/libcamera/internal/Laurent Pinchart
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-13licenses: License all meson files under CC0-1.0Laurent Pinchart
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-04-30libcamera: v4l2_pixelformat: Move V4L2PixelFormat to a new fileLaurent Pinchart
Move the V4L2PixelFormat class to a new file to prepare for additional changes that will make it grow. No functional modification is included. 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-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: Make IPA module signing optionalLaurent Pinchart
The IPA module signing mechanism relies on openssl to generate keys and sign the module. If openssl is not found on the system, the build will fail. Make the dependency optional by detecting openssl, and skip generation of signatures if openssl isn't found. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2020-04-14libcamera: ipa_manager: Embed IPA module signing public keyLaurent Pinchart
In preparation for verifying the signature of IPA modules, generate a public key from the private signing key and embed it in the IPAManager class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-04-14libcamera: Add PubKey classLaurent Pinchart
Add a new PubKey class to handle public key signature verification. The implementation is based on the gnutls library, which is added as an optional dependency. If gnutls is not found, signature verification will unconditionally fail. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-04-14libcamera: Add File helper classLaurent Pinchart
The File helper class is a RAII wrapper for a file to manage the file handle and memory-mapped regions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-08libcamera: meson: Make libatomic and libdl dependencies reusableLaurent Pinchart
libcamera.so links against libatomic and libdl, and handles those dependencies directly in the shared_object() call. More components within libcamera will need those dependencies, extract them to named variables to make them reusable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2020-03-08include: libcamera: meson: Add libcamera.h to the libcamera_api arrayLaurent Pinchart
The libcamera_api array is meant to contain all the headers from the libcamera public API, for the purpose of generating documentation and creating the libcamera_dep dependency. libcamera.h is part of the libcamera public API, add it to the array. 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-02-24libcamera: ipa_manager: Search for IPA libraries in build treeKieran Bingham
When libcamera is built and tested (or used at all) before installing to the configured prefix path, it will be unable to locate the IPA binaries, or IPA binaries previously installed in the system paths may be incorrect to load. Utilise the build_rpath dynamic tag which is stripped out by meson at install time to determine at runtime if the library currently executing has been installed or not. When not installed and running from a build tree, identify the location of that tree by finding the path of the active libcamera.so itself, and from that point add a relative path to be able to load the most recently built IPA modules. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-02-14libcamera: properties: Add location propertyJacopo Mondi
Re-use the Control generation infrastructure to generate libcamera properties and define the first 'Location' property. Introduce three additional files: - include/libcamera/property_ids.h Defines the properties ids - src/libcamera/property_ids.cpp Defines the properties Control<> instances - src/libcamera/property_ids.yaml Provide the first 'Location' property definition. Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2020-01-12libcamera: allocator: Add FrameBufferAllocator to help applications allocate ↵Niklas Söderlund
buffers The FrameBuffer interface is based on the idea that all buffers are allocated externally to libcamera and are only used by it. This is meant to create a simpler API centered around usage of buffers, regardless of where they come from. Linux however lacks a centralized allocator at the moment, and not all users of libcamera are expected to use another device that could provide suitable buffers for the camera. This patch thus adds a helper class to allocate buffers internally in libcamera, in a way that matches the needs of the FrameBuffer-based API. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2020-01-12libcamera: Add FileDescriptor to help pass numerical fds aroundNiklas Söderlund
Add a helper to make it easier to pass file descriptors around. The helper class duplicates the fd which decouples it from the original fd which could be closed by its owner while the new FileDescriptor remains valid. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-20ipa: Switch to the plain C APIJacopo Mondi
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-20libcamera: Add controls serializerLaurent Pinchart
Add a new ControlSerializer helper to serialize and deserialize ControlInfoMap and ControlList instances. This will be used to implement the C IPA protocol and the communication with IPA through IPC. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-11-20libcamera: Add ByteStreamBufferJacopo Mondi
The ByteStreamBuffer class wraps a memory area, expected to be allocated by the user of the class and provides operations to perform sequential access in read and write modes. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-11-20ipa: Define serialized controlsJacopo Mondi
Define data structures to be used during interaction between IPA modules and pipeline handlers to serialize control lists and control info maps. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> 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>
2019-10-28libcamera: Add Semaphore classLaurent Pinchart
Add a general-purpose counting semaphore class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-28libcamera: Define a PixelFormat type for application-facing formatsJacopo Mondi
Define a PixelFormat type as a simple typedef to an uint32_t. The usage of a dedicated type creates a cleaner and more self-described API. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-10-05libcamera: Add ControlValidator implementation for CameraLaurent Pinchart
Add a new CameraControlValidator class that implements the ControlValidator interface for a Camera object. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-10-05libcamera: Add ControlValidatorLaurent Pinchart
The new abstract ControlValidator class defines an interface that will be used by the ControlList class to validate controls. This will allow controls to the validated against different object types, such as Camera and V4L2Device. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
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-10-04libcamera: controls: Improve the API towards applicationsLaurent Pinchart
Rework the control-related classes to improve the API towards applications. The goal is to enable writing code similar to Request *req = ...; ControlList &controls = req->controls(); controls->set(controls::AwbEnable, false); controls->set(controls::ManualExposure, 1000); ... int32_t exposure = controls->get(controls::ManualExposure); with the get and set operations ensuring type safety for the control values. This is achieved by creating the following classes: - Control defines controls and is the main way to reference a control. It is a template class to allow methods using it to refer to the control type. - ControlId is the base class of Control. It stores the control ID, name and type, and can be used in contexts where a control needs to be referenced regardless of its type (for instance in lists of controls). This class replaces ControlIdentifier. - ControlValue is kept as-is. The ControlList class now exposes two template get() and set() methods that replace the operator[]. They ensure type safety by infering the value type from the Control reference that they receive. The main way to refer to a control is now through the Control class, and optionally through its base ControlId class. The ControlId enumeration is removed, replaced by a list of global Control instances. Numerical control IDs are turned into macros, and are still exposed as they are required to communicate with IPAs (especially to deserialise control lists). They should however not be used by applications. Auto-generation of header and source files is removed for now to keep the change simple. It will be added back in the future in a more elaborate form. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-09-15libcamera: Move list of private headers to src/libcamera/include/meson.buildLaurent Pinchart
The libcamera private headers are listed in src/libcamera/meson.build, while they are located in src/libcamera/include/. The lack of a meson.build in src/libcamera/include/ increases the risk of forgetting to add new headers to the libcamera_headers array. Fix it by moving it to src/libcamera/include/meson.build, and add the missing v4l2_controls.h entry. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-09-15libcamera: Move ipa includes to the same level as libcameraLaurent Pinchart
The ipa includes are located in include/libcamera/ipa/. This gives an incorrect impression that they are a sub-part of the rest of the libcamera API, while they are the API towards the IPA the same way that include/libcamera/ contains the API towards applications. To clarify this, move them to include/ipa/. The IPA headers are however still part of libcamera, so installing them to ${prefix}/include/ipa/ would make little sense. To fix this, move the application facing API to ${prefix}/include/libcamera/libcamera/ when installed, and the IPA to ${prefix}/include/libcamera/ipa/. When major versions of libcamera will be released, they could then be installed side by side in ${prefix}/include/libcamera-${version}/. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-09-09src/libcamera/meson.build: link with atomic when neededFabrice Fontaine
On some architectures, atomic binutils are provided by the libatomic library from gcc. Linking with libatomic is therefore necessary, otherwise the build fails with: src/libcamera/4ab8042@@camera@sha/message.cpp.o: In function `libcamera::Message::registerMessageType()': message.cpp:(.text+0x178): undefined reference to `__atomic_fetch_add_4' collect2: error: ld returned 1 exit status This is often for example the case on sparc v8 32 bits. Fixes: - http://autobuild.buildroot.org/results/1f0b8338f5f39aa86b9d432598dae2f53c5f7c84 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com> [Kieran: Updated commit message to refer to build failure on current master, rather than the old code currently built by buildroot] Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-08-17libcamera: signal: Split Slot implementation to reusable classesLaurent Pinchart
Move the Slot* classes to bound_method.{h,cpp} and rename them to Bound*Method*. They will be reused to implement asynchronous method invocation similar to cross-thread signal delivery. This is only a move and rename, no functional changes are included. 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>
2019-08-12android: hal: Add Camera3 HALJacopo Mondi
Add libcamera Android Camera HALv3 implementation. The initial camera HAL implementation supports the LIMITED hardware level and uses statically defined metadata and camera characteristics. Add a build option named 'android' and adjust the build system to selectively compile the Android camera HAL and link it against the required Android libraries. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2019-07-12libcamera: proxy: add default linux IPA proxyPaul Elder
Add a skeletal default linux IPA proxy. It currently lacks the IPA proxy protocol itself. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-12libcamera: add IPA proxyPaul Elder
Add an IPAProxy class whose implementations will act as a proxy between a pipeline handler and an isolated IPA interface. Also add an IPAProxyFactory that will construct the IPAProxy implementations as necessary. Update Doxygen to ignore the directory where IPAProxy implementations will reside. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-12libcamera: Add Process and ProcessManager classesPaul Elder
Add a Process class to abstract a process, and a ProcessManager singleton to monitor and manage the processes. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-11libcamera: thread: Add a messaging passing APILaurent Pinchart
Create a new Message class to model a message that can be passed to an object living in another thread. Only an invalid message type is currently defined, more messages will be added in the future. The Thread class is extended with a messages queue, and the Object class with thread affinity. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-07-11libcamera: Add thread supportLaurent Pinchart
The new Thread class wraps std::thread in order to integrate it with the Object, Signal and EventDispatcher classes. By default new threads run an internal event loop, and their run() method can be overloaded to provide a custom thread loop. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-07-11libcamera: skip auto version generation when building for Chromium OSPaul Elder
Commit b817bcec6b53 ("libcamera: Auto generate version information") causes the build to fail in the Chromium OS build environment, because git update-index tries to take a lock (ie. write) in the git repo that is outside of the build directory. The solution is to simply skip git update-index if we are building in the Chromium OS build environment, and this decision is made if the build directory is not a subdirectory of the source directory. 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>
2019-07-09libcamera: Rework automatic version generation to avoid rebuildsLaurent Pinchart
Commit b817bcec6b53 ("libcamera: Auto generate version information") generates version information in order to automatically include it various locations (Sphinx and Doxygen documentation, libcamera::version variable available at runtime, and version.h available at compile time). Unfortunately this causes lots of unnecessary rebuilds when modifying the git tree state, which hinders development. The problem is caused by the generated version.h being listed as a dependency for the whole libcamera. This is required as meson (to the best of my knowledge) doesn't provide a way to explicitly specify the dependency of a single object file (camera_manager.o in this case, as camera_manager.cpp is the only consumer of the generated version string) on the custom target used to generate version.h. The dependency can't be automatically detected at build time, like dependencies on normal headers that are generated by parsing the source, because the version.h header may not exist yet. The build could then fail in a racy way. This change attempts at solving the issue by generating a version.cpp instead of a version.h to set the git-based version. This minimises the number of files that need to be rebuild when then git tree state changes, while retaining the main purpose of the original automatic version generation, the ability to access the git-based version string at runtime. We however lose the ability to access git-based version information at build time in an application building against libcamera, but there is no expected use case for this. The version string is moved from the libcamera namespace to the CameraManager class in order to avoid including version.h inside libcamera (in version.cpp and in camera_manager.cpp), which would create dependencies causing more rebuild steps, as described above. On the other hand, major, minor and patch level version numbers are useful at build time. This commit changes the generation of version.h in order to add three macros named LIBCAMERA_VERSION_MAJOR, LIBCAMERA_VERSION_MINOR and LIBCAMERA_VERSION_PATCH for this purpose. version.h is not included by any other libcamera header or source file, and thus doesn't force a rebuild of the library. The Sphinx and Doxygen documentation keep their git-based version information, which is set during the configuration of the build and then doesn't track git commits. We may want to investigate how to improve this, but given that git-based version for the documentation has very few use cases outside of tagging nightly builds, this isn't considered an issue at the moment. The documentation install directory now uses the base version string, in order to avoid increasing the number of documentation directories needlessly. This shouldn't cause any issue as the API should not change without a change to the version number. The version number generation and handling code now also standardises the version variables to not start with a 'v' prefix in meson, in order to simplify their handling. The prefix is added when generating the relevant files. Note that we go back to specifying the fallback version in the main meson.build, in the call to the project() function. For the time being I believe this should be a good compromise to avoid unnecessary recompilation, and moving the fallback version to a different file for tarball releases can be built on top of this. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-04libcamera: Auto generate version informationKieran Bingham
Generate a version string, and provide a global string object which allows applications to interrogate the current libcamera version information. The version header is automatically updated by meson on each build. The string roughly follows the semver [0] conventions of major.minor.patch-label as a value. [0] https://semver.org/ A script (utils/gen-version.sh) is provided which is modelled upon the processing from autoconf's git-version-gen. The gen-version.sh script will look for tags in the form vX.Y as starting points for the version string. While the repository does not have any matching tags, v0.0 will be assumed, resulting in versions with both major and minor being set to '0', and the patch count resulting from the number of patches in the history to that point. Finally, a uniquely identifying shortened hash is provided from git: v0.0.509+0ec0edf7 Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-07-02libcamera: controls: Introduce control-related data typesKieran Bingham
Add a set of data types to support controls: - ControlValue stores a control type and value in a generic way - ControlId enumerates all the control identifiers - ControlIdentifier declares the types of a control and map their names - ControlInfo stores runtime information for controls - ControlList contains a set of control info and value pairs The control definitions map is generated from the controls documentation to ensure that the two will always be synchronised. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> 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>
2019-07-02libcamera: ipc: unix: Add a IPC mechanism based on Unix socketsNiklas Söderlund
To be able to isolate an IPA component in a separate process an IPC mechanism is needed to communicate with it. Add an IPC mechanism based on Unix sockets which allows users to pass both data and file descriptors to and from the IPA process. The implementation allows users to send both data and file descriptors in the same message. This allows users to more easily implement serialization and deserialization of objects as all elements belonging to an object can be sent in one message. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-25libcamera: Add V4L2ControlsJacopo Mondi
Add libcamera V4L2 control support, implemented using the V4L2 Extended Control APIs. This patch defines the types used to create and manage controls. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19libcamera: Introduce V4L2Device base classJacopo Mondi
The V4L2 devices and subdevices share a few common operations,like opening and closing a device node, and perform IOCTLs on the device. With the forthcoming introduction of support for V4L2 controls, the quantity of shared code will increase, as the control support implementation is identical for the two derived classes. To maximize code re-use and avoid duplications, provide a V4L2Device base class which groups the common operations and members. The newly introduced base class provides methods to open/close a device node, access the file descriptor, and perform IOCTLs on the device. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-19libcamera: Rename V4L2Device to V4L2VideoDeviceJacopo Mondi
In preparation of creating a new V4L2Device base class, rename V4L2Device to V4L2VideoDevice. This is a project wide rename without any intended functional change. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-08libcamera: Use dependency instead of link_args to link against libdlLaurent Pinchart
Instead of specifying the link arguments directly, which may be compiler-specific, use a dependency object provided by find_library(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Tested-by: Paul Elder <paul.elder@ideasonboard.com>
2019-06-05libcamera: ipa_manager: implement class for managing IPA modulesPaul Elder
IPAManager is a class that will search in given directories for IPA modules, and will load them into a list. It also provides an interface for pipeline handlers to acquire an IPA. A meson build file for the IPAs is added, which also specifies a hard-coded path for where to load the IPAs from in the installation directory. More paths can be specified with the environment variable LIBCAMERA_IPA_MODULE_PATH, with the same syntax as the regular PATH environment variable. Make the test framework set this environment variable. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-06-05libcamera: ipa_module: allow instantiation of IPAInterfacePaul Elder
Add functions for loading the IPAInterface factory function from an IPA module shared object, and for creating an instance of an IPAInterface. These functions will be used by IPAManager, from which a PipelineHandler will request an IPAInterface. Also update meson to add the "-ldl" linker argument, to allow loading of the factory function from a shared object. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>