summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-01-30ipa: raspberrypi: Handle autofocus algorithm resultsNick Hollinghurst
Handle the results returned from the autofocus algorithm by updating lens actuator position to the desired value. Update the Request metadata with the algorithm status to provide back to the application. Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30ipa: raspberrypi: Handle autofocus controlsNick Hollinghurst
Add handlers for all autofocus related libcamera controls. Translate these controls to the RPiController autofocus algorithm API. Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30ipa: raspberrypi: Include autofocus controls in the IPA ControlInfoMapNaushir Patuck
Add all the autofocus controls handled by the IPA into the ControlInfoMap if a controllable lens actuator is present. Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30ipa: raspberrypi: Reorder header file inclusionNaushir Patuck
Reorder the libcamera/request header file inclusion to match the libcamera guidelines. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30ipa: raspberrypi: Add autofocus algorithm interface headersNick Hollinghurst
Add a new AfAlgorithm class that defines the interface for the Raspberry Pi autofocus algorithm. Add an AfStatus structure that returns the results of the autofocus algorithm back to the IPA. Add a structure for PDAF statistics provided by supported sensors for use with an autofocus algorithm. This structure is currently based on the IMX708's PDAF "Type 1" statistics. Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30ipa: mojom: raspberrypi: Add setLensControls() functionNick Hollinghurst
Add a setLensControls() function to the IPA/pipeline handler interface. This will be used in a future commit to control the lens actuator position from an autofocus algorithm. Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30pipeline: ipa: raspberrypi: Validate lens controlsNaushir Patuck
Pass the available lens controls to the IPA through the configure() function. Validate that the V4L2_CID_FOCUS_ABSOLUTE does exist. If it doesn't, log a warning message, and do not advertise focus related controls from the IPA. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30pipeline: ipa: raspberrypi: Replace entityControlsNaushir Patuck
Replace the legacy entityControls map passed into ipa::configure() with explicit fields for sensor and ISP controls. This removes any ambiguity over which set of controls corresponds with specific integer keys. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30pipeline: ipa: raspberrypi: Remove unused streamConfigNaushir Patuck
Remove the streamConfig parameter from the ipa::configure() call, it is never used. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30pipeline: ipa: raspberrypi: Check if lens actuator is availableNaushir Patuck
Check if a lens actuator is available by the presense of the lens driver entity in the pipeline handler. Pass this result to the IPA on init. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.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-30pipeline: raspberrypi: Improve the values reported in the ScalerCrop controlDavid Plowman
Previously the x,y offsets in the min/max ScalerCrop control values were zero. Here we make them the same as the sensor's analogue crop offset which is I think less misleading. With this change, it also seems reasonable to advertise the default scaler crop value to be the true default that you will get. This makes it possible for applications to see what that value will be without having to start the camera and wait for frames. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30documentation: sensor_drivers: Document H/V flipJacopo Mondi
Briefly document the optional requirement support for H/V flip controls. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2023-01-30libcamera: rkisp1: Add support for TransformJacopo Mondi
Add support for Transform to the RkISP1 pipeline handler. The pipeline rotates using the sensor's V/H flips, hence use the CameraSensor helpers to handle transformation requests from applications. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-30libcamera: camera_sensor: Apply flips at setFormat()Jacopo Mondi
Augment the CameraSensor::setFormat() function to configure horizontal and vertical flips before applying the image format on the sensor. Applying flips before format is crucial as they might change the Bayer pattern ordering. To allow users of the CameraSensor class to specify a Transform, add to the V4L2SubdeviceFormat class a 'transform' member, by default initialized to Transform::Identity. Moving the handling of H/V flips to the CameraSensor class allows to remove quite some boilerplate code from the IPU3 and RaspberryPi pipeline handlers. No functional changes intended. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2023-01-30libcamera: camera_sensor: Validate TransformJacopo Mondi
The two pipeline handlers that currently support Transform (IPU3 and RaspberryPi) implement it by operating H/V flips on the image sensor. Centralize the code that validates a Transform request against the sensor rotation capabilities in the CameraSensor class. The implementation in the IPU3 pipeline handler was copied from the RaspberryPi implementation, and is now centralized in CameraSensor to make it easier for other platforms. The CameraSensor::validateTransform() implementation comes directly from the RaspberryPi pipeline handler, no functional changes intended. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2023-01-30libcamera: camera_sensor: Verify flips supportJacopo Mondi
During the camera sensor driver validation, verify if the sensor supports horizontal and vertical flips and store a flag as CameraSensor::supportFlips_ class member. The flag will be later inspected when applying flips. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
2023-01-26libcamera: Add support for OmniVision OV8858Nicholas Roth
Support for the OmniVision OV8858 sensor is scheduled for inclusion in the Linux kernel in version v6.3. Add support for the sensor in libcamera by providing static properties and a camera sensor helper in libipa. The camera sensor helper expresses analogue gain increments in 1/128 step which differs from what is reported in the sensor documentation in section "5.8 manual exposure compensation/ manual gain compensation" [0] A more detailed analysis of the sensor gain model is reported at: https://patchwork.linuxtv.org/project/linux-media/patch/20221106171129.166892-2-nicholas@rothemail.net/#142267 Record with a \todo note a reference to discussion on the gain model implementation. Signed-off-by: Nicholas Roth <nicholas@rothemail.net> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-25ipa: rkisp1: Raise maximum analogue gainMikhail Rudenko
Omnivision OV4689 sensor driver exposes maximum analogue gain of 16x. Raise kMaxAnalogueGain to 16.0, so that the full gain range can be used. Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-25ipa: rkisp1: Add OV4689 tuning fileMikhail Rudenko
Add a minimal tuning file for Omnivision OV4689, specifying black level subtraction level. Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-25libcamera: camera_sensor: Add OV4689 sensor propertiesMikhail Rudenko
Add an entry to the sensor properties for Omnivision OV4689. Kernel supports two more types of color bars patterns, which we do not expose now. Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-25ipa: camera_sensor_helper: Add OV4689 supportMikhail Rudenko
Add support for Omnivision OV4689 image sensor to libipa. The sensor implements a linear gain equation with analogue gain control values 0-2047 corresponding to 0x-16x physical gain range. Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Mikhail Rudenko <mike.rudenko@gmail.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-19libcamera: camera: Fix validateColorSpaces to choose "main" colour spaceDavid Plowman
The intention is that the "main" colour space is the colour space of the largest non-raw stream. Unfortunately the use of "config_[i].size" is clearly incorrect, and has been copied from prior versions of the code. This patch corrects the error. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2023-01-16libcamera: ipa_module: Relax ipaModuleInfo symbol size checkLaurent Pinchart
When an IPA module is loaded, the loadIPAModuleInfo() function validates the ipaModuleInfo structure. As part of that process, it checks that the ipaModuleInfo symbol size matches the expected structure size. This check breaks with clang and ASan, as the LLVM's address sanitizer implementation includes the redzone after the structure in the symbol size, currently growing it by 156 bytes (on x86-64). This causes all IPA modules to fail to load. Fix the problem by relaxing the size check to only ensure that the symbol is large enough to contain the structure. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-16py: cam.py: Fix duplicate metadata output if more than one streamDaniel Oakley
Currently, if there are multiple streams, the --metadata flag will print the metadata for each request multiple times. Moving the metadata print logic outside the stream for loop this will no longer occur. Signed-off-by: Daniel Oakley <daniel.oakley@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-01-16libcamera: rkisp1: Re-sort includesJacopo Mondi
Comply with a checkstyle suggestion and separate inclusion directives. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-01-16libcamera: bayer_format: Expand documentationJacopo Mondi
The current documentation of the BayerFormat::transform() function reports examples on the Bayer components ordering transformation for horizontal flip (mirroring) but not for vertical flip or for the combination of the two. It is useful to complete the documentation to ease understanding of the transform() function on a sensor's Bayer pattern. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@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>
2023-01-10base: utils: Add and use strtod() helperLaurent Pinchart
The strtod() function is locale-dependent, and thus ill-suited to parse numbers coming from, for instance, YAML files. The YamlObject class uses strtod_l() to fix that issue, but that function is not available with all libc implementations. Correctly handling this problem is becoming out of scope for the YamlObject class. As a first step, add a strtod() helper function in the utils namespace that copies the implementation from YamlObject, and use it in YamlObject. The core issue will then be fixed in utils::strtod(). Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-10utils: checkstyle.py: Add commit title checkerLaurent Pinchart
Add a commit checker to ensure that commit titles start with a prefix. The commit issue message lists prefix candidates retrieved from the git log. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-05README: Replace deprecated 'meson' with 'meson setup'Laurent Pinchart
Meson has deprecated implicit usage of the setup command, and this now generates a warning: WARNING: Running the setup command as `meson [options]` instead of `meson setup [options]` is ambiguous and deprecated. Update the build instructions to use 'meson setup' explicitly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-01-05Documentation: Specify Doxygen OUTPUT_DIRECTORY explicitlyBarnabás Pőcze
Currently, doxygen is run by ninja in the top-level build directory, therefore the "Documentation" folder is always created there. However, when libcamera is built as a subproject, it should not touch the top-level build directory because it can cause conflicts and because the documentation won't be created where meson thinks it will be, so the "doxygen" target will always be dirty and installation will fail. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-01-05libcamera: Use C++17 [[fallthrough]] everywhereMatti Lehtimäki
Fixes build failure on some build environments. Signed-off-by: Matti Lehtimäki <matti.lehtimaki@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-01-03libcamera: yaml_parser: Use C localeKieran Bingham
When parsing configuration files on systems with differing locales, the use of strtod can produce different results, or in the worst case - fail to parse expected values. Fix this by using strtod_l() instead. To avoid constructing and destructing a locale_t instance for every use of strtod_l(), create an RAII class that wraps the locale_t and use it to provide a global "C" locale. Bug: https://bugs.libcamera.org/show_bug.cgi?id=174 Bug: https://github.com/raspberrypi/libcamera/issues/29 Reported-by: https://github.com/kralo Reported-by: Hannes Winkler <hanneswinkler2000@web.de> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@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-30qcam: Show string representation of pixel formatChristian Rauch
The raw pixel format in form of the fourcc integer is not easily readable. Use the string representation instead for easier debugging. Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de> 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-12-29meson: options: Fix typo in pipelines documentationPaul Elder
Fix a typo in the pipelines option documentation. 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-24gstreamer: Add bayer8 support to libcamerasrc elementPavel Machek
Bayer8 support is useful on hardware such as Librem 5, as GStreamer provides easy solution for debayering and display of the camera data. Add necessary glue to libcamerasrc element. Signed-off-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-24libcamera: Simple typo fixesPavel Machek
Fix various typos in the code base. Signed-off-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-24test: Drop pipeline testLaurent Pinchart
The two pipeline test (for ipu3 and rkisp1) are meant to perform very basic validation of the corresponding pipeline handlers, limited to verifying camera enumeration. They are not unit tests as such, they are superseded by the lc-compliance tool, and they are never used in practice (and always skipped). Drop them. 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>
2022-12-24test: py: Fix test failure when ASan is enabledLaurent Pinchart
When the address sanitizer is enabled, the Python unit tests fail due to the link order runtime check as the Python interpreter is (generally) not linked to ASan. Fix this by LD_PRELOAD'ing the ASan runtime. We have to disable the leak detector as the Python interpreter itself leaks memory, which would result in test failures. To LD_PRELOAD the ASan runtime, the path to the binary needs to be known. gcc gives us a generic way to get the path, but that doesn't work with clang as the ASan runtime file name depends on the clang version and target architecture. We thus have to keep the Python test disabled when ASan is enabled and libcamera is compiled with clang. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-12-24test: v4l2_compat: Enable test with ASanLaurent Pinchart
When libcamera is compiled with the address sanitizer enabled, the v4l2_compat test generates failures in the link order runtime check, as the host v4l2-ctl and v4l2-compliance tools are not (generally) linked to ASan. For this reason, the test is disabled, which sadly shrinks test coverage. Fix this by loading the ASan runtime using LD_PRELOAD. This needs to be done from within the v4l2_compat_test.py Python script, as the Python interpreter itself leaks memory and would cause test failures if run with ASan. To LD_PRELOAD the ASan runtime, the path to the binary needs to be known. gcc gives us a generic way to get the path, but that doesn't work with clang as the ASan runtime file name depends on the clang version and target architecture. We thus have to keep the v4l2_compat test disabled when ASan is enabled and libcamera is compiled with clang. 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>
2022-12-24test: v4l2_compat: Reduce indentationLaurent Pinchart
Return early with subdir_done() to reduce indentation in case the v4l2_compat layer is not enabled. This matches our usual code patterns in meson.build files, and prepares for enabling the v4l2_compat test with ASan. 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>
2022-12-22ipa: raspberrypi: Fix permissions on imx477_scientific.jsonLaurent Pinchart
The imx477_scientific.json file was added to the source tree with incorrect executable permission. Fix it. Fixes: bf66a1d25162 ("ipa: raspberrypi: Add a "scientific" tuning for the IMX477") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-22libcamera: camera_sensor: Add AR0521 sensor propertiesJacopo Mondi
Add an entry to the sensor properties for OnSemi AR0521. The chip manual list one additional test pattern "PN9 Link integrity test pattern" not supported by the mainline Linux driver. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-22ipa: camera_sensor_helper: Add AR0521 supportJacopo Mondi
Add support for OnSemi AR0521 5Mpx image sensor to libipa. The sensor analogue gain is implemented as a coarse and a fine factor, with the coarse gain being a power of two and the fine gain being a value in the [1.0, 2.0[ range. The mapping between gain codes and gain values is tabulated in the datasheet, and the table values are very close but not identical to the mathematical model. Compute the gain using the model to keep the code shorter, if this causes precision issues the calculation could be replaced with a table. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-12-20libcamera v0.0.3v0.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-12-19Expose the Request Sequence Number in Python BindingsMatthew Goodman
The python bindings are missing the ability to read the sequence number of the Request object from the public API. Expose the objects sequence number on the pybind11 surfaces to support applications reading this value. Signed-off-by: Matthew Goodman <matt@exclosure.io> [Kieran: Revised commit message] Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-12-19ipa: raspberrypi: Add a "scientific" tuning for the IMX477Naushir Patuck
Add a tuning file for the IMX477 more suited to scientific applications. The key differences from the original tuning file are: - Disable ALSC block completely - Pure rec709 gamma curve, and no contrast enhance - New CT curve and CCMs based on the illumination spectrum of a black body radiator up to about 3600 K and the CIE illuminant D for higher color temperatures. Further details on the changes can be found at: https://forums.raspberrypi.com/viewtopic.php?t=343449 All credit for these changes go to Dr. Rolf Henkel. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Rolf Henkel <cpixip@pixelcircus.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>