summaryrefslogtreecommitdiff
path: root/meson.build
AgeCommit message (Collapse)Author
2023-07-07libcamera: Add option to configure udev supportLaurent Pinchart
libcamera uses udev to support hotplug (and unplug) detection. This is an optional feature, which gets selected automatically if udev is available. Users may however want to build libcamera without hotplug detection, even if udev is available on the system. Add a new feature option to control udev support. The default value is auto, which retains the existing behaviour. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-07meson: Fix space around colon issuesLaurent Pinchart
The meson style, which libcamera follows, recommends a space before colons in function parameters. Fix the style violations through the project. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2023-07-05Documentation: Add predefined macros from config.h to DoxyfileLaurent Pinchart
libcamera creates a config.h file with predefined macros, and instructs the compiler to include it implicitly with the -include argument. Doxygen has no support for implicit inclusion of headers, but has a PREDEFINED configuration option for its preprocessor that lists predefined macros. Populate it with the values from the config_h configuration data object that is used for generate the config.h file, to ensure that documentation matches the configuration options libcamera has been built with. Bump the minimum meson version to 0.57 to use cfg_data.keys(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-04meson: Use x.y soname versioningKieran Bingham
Now that we identify ABI breakages, provide incremental releases which can support backwards compatible linkage across release points that have a compatible ABI. Introduction of this commit does not convey that libcamera now has a stable API, but that patch releases with a common minor number (0.minor.patch) may potentially be used by applications without recompilation and linkage against new releases. 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>
2023-05-04pipeline: ipa: raspberrypi: Refactor and move the Raspberry Pi codeNaushir Patuck
Split the Raspberry Pi pipeline handler and IPA source code into common and VC4/BCM2835 specific file structures. For the pipeline handler, the common code files now live in src/libcamera/pipeline/rpi/common/ and the VC4-specific files in src/libcamera/pipeline/rpi/vc4/. For the IPA, the common code files now live in src/ipa/rpi/{cam_helper,controller}/ and the vc4 specific files in src/ipa/rpi/vc4/. With this change, the camera tuning files are now installed under share/libcamera/ipa/rpi/vc4/. To build the pipeline and IPA, the meson configuration options have now changed from "raspberrypi" to "rpi/vc4": meson setup build -Dipas=rpi/vc4 -Dpipelines=rpi/vc4 Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-05-04ipa: meson: Allow nested IPA directory structuresNaushir Patuck
The current IPA build files require a flat directory structure for the IPAs. Modify the build files to remove this restriction and allow a directory structure such as: src/ipa |- raspberrypi |- common |- cam_helpers |- controller |- vc4 |- rkisp1 |- ipu3 where each subdir (e.g. raspberrypi/common, raspberrypi/cam_helper) has its own meson.build file. Such a directory structure will be introduced for the Raspberry Pi IPA in a future commit. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-05-01libcamera v0.0.5Kieran Bingham
Bugfixes: - meson: Ignore -Wredundant-move with gcc-13 and newer - cam: file_sink: Workaround gcc-13 dangling-reference false positive - libcamera: Open files with O_CLOEXEC - meson: Fix git version parsing - libcamera: camera_manager: Stop exponential explosive calls to createPipelineHandlers - py: cam: Fix demosaic overflow issue - libcamera: base: Make the registration of log categories atomic Core: - test: controls: control_info_map: Test default constructor - controls: guard ControlInfoMap against nullptr idmap_ - device_enumerator_udev: Use std::string_view - formats: Add 14-bits Bayer RAW formats - device_enumerator_udev: Remove devnum from dependency map - meson: libcamera: Report IPA signature method - meson: Align handling of build metadata - converter: Check converter validity - Keep using syslog for isolated IPA modules - utils: ipc: Update parser.py - utils: checkstyle.py: Don't run commit title checker on staged commits - framebuffer: Allow inheritance of FrameBuffer - Remove transform from V4L2SubdeviceFormat - libcamera: camera_sensor: Add tryFormat() - camera_sensor: Fix typo in comment - camera_sensor: Demote flip support message to Debug - internal: tracepoints: Use correct include directive - libcamera: camera: Ensure queued requests are invalid ipa: - doc: Clarify IPA acronym in its namespace description - rkisp1: Add tuning files for PinephonePro sensors - rkisp1: Add tuning files for Google DRU "Scarlet" sensors - rkisp1: lsc: Fix integer division error - libipa: Add OV2685 Camera Sensor Helper - libipa: Add OV5647 Camera Sensor Helper - raspberrypi: agc: Add "shadows" constraint mode - raspberrypi: generalise algorithms - raspberrypi: Fix default frame durations calculation - raspberrypi: Ensure shutter speed and gain are clipped in the AGC - raspberrypi: Use the new sensor limits fields in CameraMode - raspberrypi: Add sensor mode limits to CameraMode - raspberrypi: Fix crash under LTO - raspberrypi: imx296: Minor tuning updates - raspberrypi: agc: Fix overflow in Y value calculation - raspberrypi: Better heuristics for calculating Unicam timeout - raspberrypi: Generalise statistics - raspberrypi: Change Unicam timeout handling pipeline: - simple: Validate transform - imx8-isi: Remove mbusCode from formatsMap_ - imx8-isi: Automatically select media bus code - imx8-isi: Split Bayer/YUV config generation - imx8-isi: Break out RAW/YUV format selection - raspberrypi: Iterate over all Unicam instances in match() - raspberrypi: Add a Unicam timeout override config options - raspberrypi: Always use ColorSpace::Raw for raw streams - raspberrypi: Drop unused code - ipu3: Drop unused code apps: - cam: kms_sink: Drop unique_ptr<> from DRM::AtomicRequest - cam Return std::optional<> from StreamKeyValueParser::parseRole() - android: jpeg: Add JEA implementation ABI Compliance: * abi-compliance-checker reports 98.6% ABI and 100% API compatibility with with v0.0.4 Total binary compatibility problems: 1, warnings: 1 Total source compatibility problems: 0, warnings: 0 - First virtual method ~__dt ( ) has been added to this class. 1) The layout of type structure has been shifted by 8 bytes by the added v-table pointer. 2) Size of class has been increased by 8 bytes. affected symbols: 6 (1.4%) FrameBuffer::releaseFence ( ) FrameBuffer::setCookie ( uint64_t cookie ) FrameBuffer::cookie ( ) FrameBuffer::planes ( ) FrameBuffer::request ( ) FrameBuffer::metadata ( ) This ABI breakage was introduced by: 4843bfa66dc1 ("libcamera: framebuffer: Allow inheritance of FrameBuffer") Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-05-01meson: Ignore -Wredundant-move with gcc-13 and newerLaurent Pinchart
Starting from 13.1, gcc implements the C++23 version of automatic move from local variables in return statements (see https://en.cppreference.com/w/cpp/language/return). As a result, some previously required explicit `std::move()` in return statements generate warnings. This is the case when a function returns an object whose type is a class derived from the class type the function returns: struct U { }; struct T : U { }; U f() { T t; return t; } Up to C++20, the automatic move from local variables selects the move constructor of class U, which is not the move constructor of the expression. Overload resolution is then performed a second time, with t considered as an lvalue. An explicit `std::move(t)` is needed in the return statement to select the U move constructor. Starting from C++23, `t` is treated as an xvalue, and the U move constructor is selected without the need for an explicit `std::move(t)`. An explicit `std:move()` then generates a redundant-move warning, as in the valueOrTuple() function in src/py/libcamera/py_helpers.cpp. Omitting the `std::move()` silences the warning, but selects the copy constructor of U with older gcc versions and with clang, which negatively impacts performance. The easiest fix is to disable the warning. With -Wpessimizing-move enabled, the compiler will still warn of pessimizing moves, only the redundant but not pessimizing moves will be ignored. 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>
2023-04-05meson: Really fix git version parsingLaurent Pinchart
The previous attempt to fix git version parsing in commit d34cefad1791 ("meson: Fix git version parsing") was too naive, and didn't take into account cases where the libcamera git version contains no or multiple '+' signs. Fixing this is more complex than a one-liner change, as meson doesn't support Python-style slicing of arrays or a length method on strings. The simplest and most versatile option is to patch the version string in the gen-version.sh script. Do so, and clarify the comments related to version handling in meson.build. Fixes: d34cefad1791 ("meson: Fix git version parsing") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2023-03-21meson: Fix git version parsingLaurent Pinchart
When extracting the build metadata from the git version, we use the string strip() method to remove the version prefix. This is incorrect, as the strip() method takes a set of characters to be removed, not a literal string. Fix it by splitting the git version string on the '+' character and keeping the suffix. Fixes: 02518e598e8f ("meson: Rewrite .replace usage") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Michael Riesch <michael.riesch@wolfvision.net> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-03-09meson: Align handling of build metadataMichael Riesch
The build metadata is split off correctly from the version string obtained with utils/gen-version.sh, but for the meson project version this step is not carried out. However, since libcamera uses Semantic Versioning, it should be possible to add build metadata to the meson project version. Align the handling of the build metadata to resolve this mismatch. Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net> 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>
2023-02-01libcamera v0.0.4Kieran Bingham
Bugfixes: * libcamera: yaml_parser: Use C locale * libcamera: base: utils: Support C libraries lacking locale support * py: cam.py: Fix duplicate metadata output if more than one stream * libcamera: camera: Fix validateColorSpaces to choose main colour space * pipeline: raspberrypi: Fix handling of colour spaces Core: * test: Fix/Enable testing with ASan * test: Remove redundant pipeline tests * meson: Only build pipeline handlers needed in host architecture * meson: Add 'all' choice to pipelines option * utils: checkstyle.py: Add commit title checker * libcamera: ipa_module: Relax ipaModuleInfo symbol size check * pipeline: Support configuration file paths ipa: * camera_sensor: Improve h/v flip handling * camera_sensor: Add AR0521 Sensor support * camera_sensor: Add OV4689 Sensor support * camera_sensor: Add support for OmniVision OV8858 * raspberrypi: Support Autofocus with PDAF * raspberrypi: Support for the Sony IMX708 sensor * rkisp1: Raise maximum analogue gain pipeline: * raspberrypi: Support parameters from a configuration file * raspberrypi: Add a parameter to disable startup drop frames * libcamera: rkisp1: Add support for Transform apps: * gstreamer: Add bayer8 support to libcamerasrc * qcam: Show string representation of pixel format ABI Compliance: * abi-compliance-checker reports 100% ABI and API compatibility with with v0.0.3 Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30meson: Rework automatic pipeline selectionKieran Bingham
The supported pipelines are listed in three places: the meson_options.txt file, the defined array when a user selects -Dpipelines="all", and arrays defined when the default -Dpipelines="auto" is selected. This can be hard to maintain and error prone. Rework the definition of pipeline selection to a single table which specifies the architecture(s) that the pipeline handler supports and iterate it to handle the special cases for 'all', 'auto' and 'test'. The current behaviour such that 'all' takes precedence over 'auto' is maintained, and 'test' is now extended such that additional test pipeline handlers can easily be introduced. The existing implementation defines the i.MX8-ISI and RKISP1 pipeline handlers as only supported by 'aarch64'. This conversion changes the behaviour such that those pipeline handlers are now supported on both 'arm' and 'aarch64' as each of those platforms could support a 32-bit ARM build. Suggested-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-10libcamera: base: utils: Support C libraries lacking locale supportLaurent Pinchart
Not all C libraries include support for locale objects (locale_t) and the strto*_l() family of functions. A notable example is uClibc that can be compiled with a hardcoded "C" locale. Compilation then fails as the newlocale(), freelocale() and strtod_l() functions are not defined. Fix the compilation breakage by checking for the availability of the locale_t type, and fall back to strtod() when the type isn't available. This may not lead to the correct result if support for locale objects isn't available and the locale isn't hardcoded to "C", but that is such a corner case that we will likely never encounter it. Fixes: e8ae254970cf ("libcamera: yaml_parser: Use C locale") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2022-12-30meson: Add 'all' choice to pipelines optionPaul Elder
Add an 'all' choice to the pipelines option, for building all pipelines. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-12-24meson: Only build pipeline handlers needed in the host architectureJavier Martinez Canillas
By default all pipeline handlers are built, regardless on whether these are needed in the host architecture or not. It makes more sense to build only the pipeline handlers that will be used for the given architecture. Let's do that by default now, but still allow to build the other pipeline handlers if needed, by using the `pipelines` meson option. For example, on a x86-64 platform: $ meson build ... Configuration Enabled pipelines : ipu3 uvcvideo Enabled IPA modules : ipu3 ... $ meson build -Dpipelines="ipu3,raspberrypi,rkisp1" -Dtest=true ... Configuration Enabled pipelines : ipu3 raspberrypi rkisp1 vimc Enabled IPA modules : ipu3 raspberrypi rkisp1 vimc ... Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-20libcamera v0.0.3Kieran Bingham
Key bug fixes: * Segfault in the ContolInfo() constructor for an empty V4L2 menu Bug: https://bugs.libcamera.org/show_bug.cgi?id=167 Fix: libcamera: v4l2_device: Workaround faulty control menus This resolves and prevents crashes that have occured in Pipewire when users connect poorly implemented UVC devices. ABI Compliance: abi-compliance-checker reports 100% ABI and API compatibility with with v0.0.2, however 81e7689bb168 ("libcamera: stream: Turn StreamRole into scoped enumeration") modifies an enum into a class enum. This may need minor updates to applications, and didn't appear to be picked up by abi-compliance-checker. - See https://git.libcamera.org/libcamera/libcamera.git/commit/?id=81e7689bb168a for more details. Highlights: Core: * Fix tracing when built as a subproject * Avoid double map lookups in framebuffer_allocator * Workaround faulty control menus * controls: Change LensPosition units to dioptres * camera_sensor: Add IMX519 sensor properties * Documentation: contributing: Add commit message guidelines * Declare generic converter interface utils: * Add libtuning * Add initial libtuning script support for rkisp1 and raspberrypi. * checkstyle.py: Check new header file on new and renamed meson.build files ipa: * Move IPA sensor controls validation to CameraSensor (IPU3/RKISP1) rkisp1: * Support FrameDurationLimits control for FrameRate management * Support raw capture (IPA, configuration, and runtime) * Add support for manual gain and exposure * Fix stream size validation * Add additional default values to controls imx8-isi: * Enumerate supported stream formats * Set SensorTimestamp metadata Raspberry Pi: * Remove generic "pause" mechanism from Algorithm - Remove enum BuffferMask from the mojom interface - Fix digital gain calculations for manual mode - Fix bug in IPA frame drop logic - imx477: Update tuning file for the latest camera modules - Add a "scientific" tuning for the IMX477 Apps: - cam: kms: Avoid 'unused-parameter' warnings - cam: Support parsing array controls in capture scripts - gstreamer: Improve control id lookups - lc-compliance: simple_capture: Free Requests properly python: - Support controls that use an array of Rectangles - Expose the Request Sequence Number in Python Bindings test: - Validate CameraSensor Ancillary Devices (focusLens) - controls: control_info: Test default def() values Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-11-18libcamera v0.0.2Kieran Bingham
This release contains all the work merged to libcamera over the last 5 weeks, including the following summary highlights: Highlights: Core: * New pipeline handler for the IMX ISI * Fixed memory leak in the logging infrastructure * Fixed meson support for 0.56 * Additional Thread Safety annotations added throughout * Add a release method to pipeline handlers to support freeing resources when a camera is released, but not deleted. * Group test applications under src/apps * Make libdl optional to support Android builds Application layers: * Added DNG File output to cam * Fixes for building against Android * gstreamer framerate control and negotiation IPA: * Support setting metadata directly from (libipa) algorithms * Set AGC and AWB metadata for both RKISP1 and IPU3. * Support for enum serialization and Flags * Support multiple lens shading tables for different colour temperatures on RKISP1/i.MX8MP. Raspberry Pi IPA: * Full line length control * Better HBLANK synchronisation and full line length control * Support ov9281 as ov9281_mono * Update colour temperature whenever manual gains change abi-compliance-checker tells me that this release is 100% abi compatible with v0.0.1. Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-28meson: Rewrite .replace usageKieran Bingham
Meson introduces a .replace() method in version 0.58.0. However we aim to restrict ourselves to 0.56 meson features, as released by Debian stable. The recent introduction of release management infrastructure makes use of the .replace() method to fix up the version string when there is a mis-match between the release version and any (lack) of tags in the git version description. This breaks when built on systems with only meson 0.56. Refactor this to use a concatenation of the project version and a stripped git version to regenerate the full source version string that will be reported by libcamera. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-14libcamera v0.0.1Kieran Bingham
This patch release commences the package release procedures for the project. Initial releases will include a bump to the patch (0.0.x) version number, as well as a corresponding increment to the soname. Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-13meson: Shared Object version handlingKieran Bingham
The libcamera project is not yet ready to declare ABI nor API stability, but it will benefit the community to be able to provide more regular release cycles to determine 'versioned' points of history. Ideally, these releases will be made at any ABI breakage, but can be made at arbitary time based points along the way. To support releases which may not be ABI stable, declare the soversion of both the libcamera and libcamera-base library to be dependant upon both the major minor and patch component of the project version. As part of this, introduce a new 'Versions' summary section to highlight the different version components that may become apparent within any given build. Bumping versions may leave dangling libcamera.so.* symlinks in build directories. This will confuse Doxygen which will print during its directory scanning phase a warning that the symlink can't be read. As we don't need Doxygen to follow symlinks, disable it with EXCLUDE_SYMLINKS. Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-10-13meson: Fix typoKieran Bingham
The comment for supporting the custom script on 'make dist' contains a typo. Fix it. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-08-16meson: Use dependency() instead of find_library() where possibleLaurent Pinchart
Usage of find_library() to find dependencies that libcamera needs to compile against can lead to the library being found even if the corresponding headers are not installed. This will then result in a compilation failure. Switch to dependency() for libdw, libunwind and lttng-ust to fix this, all three libraries come with a pkgconfig file that is usually installed by the distribution package that contains the library headers. Reported-by: Christian Rauch <Rauch.Christian@gmx.de> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-07-26libcamera: Correctly report enabled ipa modulesQuentin Schulz
"ipa_modules" stores the value of the ipas meson build option. IPAs are enabled if and only if there is an enabled pipeline for an IPA listed in "ipa_modules" array. It is basically the intersection of pipelines and ipa_modules array. In order to correctly report which IPAs get enabled, let's create a new array storing this intersection. Cc: Quentin Schulz <foss+libcamera@0leil.net> Reported-by: Daniel Semkowicz <dse@thaumatec.com> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
2022-07-07meson: Correctly pass the global include to the compilerEli Schwartz
It's not safe to assume `-include config.h` works, since this depends on the functionality of the compiler that the cwd when running the compiler is searched first. When libcamera is included as a Meson subproject, the cwd of the compiler is the cwd of the main project, not of libcamera's build dir, and thus cannot be found. Instead, pass the include filename as a path based on the current build dir. Signed-off-by: Eli Schwartz <eschwartz93@gmail.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>
2022-05-10Add Python bindingsTomi Valkeinen
Add libcamera Python bindings. pybind11 is used to generate the C++ <-> Python layer. We use pybind11 'smart_holder' version to avoid issues with private destructors and shared_ptr. There is also an alternative solution here: https://github.com/pybind/pybind11/pull/2067 Only a subset of libcamera classes are exposed. Implementing and testing the wrapper classes is challenging, and as such only classes that I have needed have been added so far. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@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-10meson: Add 'check: true' for run_command() callsTomi Valkeinen
Add 'check: true/false' to all run_command() calls as suggested in https://github.com/mesonbuild/meson/issues/9300 to get rid of meson warning "You should add the boolean check kwarg to the run_command call." This makes meson fail if the executed command fails, which makes sense. [Kieran: Ignore failures on utils/genversion.sh] 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-10meson: Use new project_*_root() functionsTomi Valkeinen
meson.source_root() and meson.build_root() are deprecated. Use meson.project_source_root() and meson.project_build_root() instead. 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-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-02-22libcamera: Require gcc 8 or newerLaurent Pinchart
gcc 7 has reached end of life and isn't used as a default compiler by any of the major distributions. It has also been dropped from buildroot. Drop its support in libcamera. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@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-01libcamera: base: Add thread safety annotation macrosHirokazu Honda
Clang compiler is able to do a thread safety analysis with annotations [1]. This introduces the thread safety annotation macros and also enable the analysis by adding -Wthread-safety if a clang compiler is used. [1] https://clang.llvm.org/docs/ThreadSafetyAnalysis.html. Signed-off-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-11-29libcamera: Add tracing to meson summaryJacopo Mondi
The meson option summary currently does not report if the support for tracing is enabled or not. Add it. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-10-19build: Preserve upstream git versioning using meson distNaushir Patuck
When distributions build and package libcamera libraries, they may not necessarily run the build in the upstream source tree. In these cases, the git SHA1 versioning information will be lost. This change addresses that problem by requiring package managers to run 'meson dist' to create a tarball of the source files and build from there. On runing 'meson dist', the utils/run-dist.sh script will create a .tarball-version file in the release tarball with the version string generated from the existing utils/gen-version.sh script. The utils/gen-version.sh script has been updated to check for the presence of this .tarball-version file and read the version string from it instead of creating one. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-10-19utils: gen-version: Pass the meson source root to the gen-version.sh scriptNaushir Patuck
The gen-version.sh script expects to be called from a git repo, and sets its src_root variable accordingly. This may not always be the case if it is built from a tarball source - full support for which is in a future commit. The MESON_SOURCE_ROOT environnement variable does not get set when called from the meson vcs_tag() function, but does when called from the run_command() function, so that cannot be used either. Instead, explicitly pass the meson source root to the gen-version.sh script. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-10-15libcamera: base: Add Backtrace classLaurent Pinchart
Create a new class to abstract generation and access to call stack backtraces. The current implementation depends on the glibc backtrace() implementation and is copied from the logger. Future development will bring support for libunwind, transparently for the users of the class. The logger backtrace implementation is dropped, replaced by usage of the new Backtrace class. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-08-20ipa: ipu3: convert AGC to the new algorithm interfaceJean-Michel Hautbois
In preparation for using the AGC through the new algorithm interfaces, convert the existing code to use the new function types. Now that the process call is rewritten, re-enable the compiler flag to warn when a function declaration hides virtual functions from a base class (-Woverloaded-virtual). We never use converged_ so remove its declaration. The controls may not need to be updated at each call, but it should be decided on the context side and not by a specific call by using a lock status in the Agc structure for instance. As the params_ local variable is not useful anymore, remove it here too. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-20ipa: ipu3: Add the functions to the Algorithm classJean-Michel Hautbois
Introduce three functions in the Algorithm class to manage algorithms: - configure which is called when IPA is configured only - prepare called on EventFillParams event at each frame when the request is queued - process called on EventStatReady event at each frame completion when the statistics have been generated. The existing AGC implementation already has a function named process(), though it has different arguments. Adding the new virtual process() interface causes a compiler warning due to the AGC implementation overloading a virtual function, even though the overload can be resolved correctly. Temporarily disable the warning in this commit to maintain bisection until the AGC is converted to the new interface. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-08-03meson: Update min clang version to 9Paul Elder
__builtin_FILE and __builtin_LINE are first defined in clang 9. With clang of any version less than that we have the following compilation errors: ../../include/libcamera/base/log.h:94:27: error: use of undeclared identifier '__builtin_FILE' const char *fileName = __builtin_FILE(), ^ ../../include/libcamera/base/log.h:95:24: error: use of undeclared identifier '__builtin_LINE' unsigned int line = __builtin_LINE()) const; ^ ../../include/libcamera/base/log.h:99:26: error: use of undeclared identifier '__builtin_FILE' const char *fileName = __builtin_FILE(), ^ ../../include/libcamera/base/log.h:100:23: error: use of undeclared identifier '__builtin_LINE' unsigned int line = __builtin_LINE()); Enforce clang version of at least 9 in the main meson file. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-06-25libcamera: Move libcamera.so pkg-config file generationKieran Bingham
The pkg-config file for the main libcamera.so is generated at the top level meson.build. Move this to the actual core libcamera build structure to be consistent and keep it next to the library construction. Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-19libcamera: utils: Support systems that lack secure_getenv and issetugidLaurent Pinchart
Android provides neither secure_getenv() nor issetugid(). Enable compilation on that platform by using a plain getenv(), as that seems to be the best we can do. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-05-27meson: Print summary boolean options in coloursLaurent Pinchart
Boolean options in the summary are printed as 'True' or 'False' by default. Enable the bool_yn option, which prints them as 'YES' or 'NO', in green and red respectively. This makes the summary more readable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2021-05-26android: Fix file system library usage on gcc 7 and 8Laurent Pinchart
On gcc versions older than 9, the file system library, used by the Android camera HAL configuration file parser, is implemented in a separate static library. Furthermore, on gcc 7, it's provided in the std::experimental namespace. This breaks compilation of the HAL on gcc 7, and linking on gcc 8. Fix the compilation issue by conditionally including <experimental/filesystem> and creating a namespace alias in std, and the link issue by linking to libstdc++fs on gcc versions older than 9. The inclusion of <experimental/filesystem> is a bit of a hack, and when we'll start using the file system library in another compilation unit, we should then move all this to an internal helper to abstract the compiler version. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2021-05-24meson: Add a configuration option to build IPAsUmang Jain
There can be multiple IPAs per pipeline-handler or platform. They can live in-tree or externally linked. It is up to the vendor whether to use in-tree IPA for a platform or provide it externally. In the case of IPAs being external, building in-tree IPAs might be futile hence, provide a clear and explicit mechanism to choose whether to build the in-tree IPA for the platform or not. By default, all in-tree IPAs are built when a matching Pipeline handler is also enabled. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2021-05-11meson: Replace obselete join_paths() with '/' operatorUmang Jain
Since meson v0.49.0, join_paths() is equivalent to '/' hence, drop and replace it with '/' short-hand in meson files. This commit does not introduce any functional changes. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-04-12lc-compliance: Add a libcamera compliance toolNiklas Söderlund
Add a compliance tool to ease testing of cameras. In contrast to the unit-tests under test/ that aims to test the internal components of libcamera the compliance tool aims to test application use-cases and to some extent the public API. This change adds the boilerplate code of a simple framework for the creation of tests. The tests aim both to demonstrate the tool and to catch real problems. The tests added are: - Test that if one queues exactly N requests to a camera exactly N requests are eventually completed. - Test that a configured camera can be started and stopped multiple times in an attempt to exercise cleanup code paths otherwise not often tested with 'cam' for example. Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-03-28meson: Summarize which applications and adaptation layers are builtLaurent Pinchart
Add the application and adaptation layers being built to the meson summary. The summary now prints libcamera 0.0.0 Configuration Enabled pipelines: ipu3 raspberrypi rkisp1 simple uvcvideo vimc Android support: True GStreamer support: True V4L2 emulation support: True cam application: True qcam application: True Unit tests: True Subprojects libyuv: YES Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
2021-02-23libcamera: Enable vimc pipeline handler when tests are enabledLaurent Pinchart
The addition of the new IPA IPC mechanism compiles pipeline-specific headers to define the interface between the pipeline and the IPA. This was optimised in 08ce394465b5 ("meson: ipa, proxy: Only build proxies for enabled pipelines") to only build for enabled pipelines, however the tests directly use the VIMC pipeline handler, and require it to be built. Create a local variable to store the requested pipelines from the user configuration and extend the enabled pipelines to ensure that VIMC is always enabled if the tests are also enabled Fixes: 08ce394465b5 ("meson: ipa, proxy: Only build proxies for enabled pipelines") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Sebastian Fricke<sebastian.fricke@posteo.net>
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>
2021-01-20libcamera: Use meson summary() function to summarize configurationLaurent Pinchart
Now that Debian backports have been updated to meson v0.56, all major distributions provide meson >= v0.53 in their latest LTS version. We can replace the manual message()-based configuration summary with the summary() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Fricke <sebastian.fricke@posteo.net> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>