summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-10-13DO NOT MERGE: add cross fileMattijs Korpershoek
Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-10-13android: mm: generic: Use GraphicBufferAllocator instead of gralloc.hMattijs Korpershoek
gralloc.h is a very old API that has been deprecated at least since Android P (9). Switch over to a higher level abstraction of gralloc from libui, which is compatible with Android 11 and up. Libui: * is provided in the VNDK (so it's available to vendors). * is also used in the camera vts test named VtsAidlHalCameraProvider_TargetTest. Notes: * GraphicsBufferAllocator being a Singleton, buffer lifecycle management is easier. * The imported headers from Android generate the -Wextra-semi warning. To avoid patching the files, a pragma has been added before inclusion. * libdl was used for dlclosing() the legacy hal, so the dep has been dropped Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-10-13Revert "android: mm: Stub libhardware for build tests"Mattijs Korpershoek
The VNDK, which is included as a subproject can provide libhardware. Remove the stub and use the VNDK instead. This reverts commit b9ecd85ed1fee2e9d715368b24592ad3009131d8. Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-10-13subprojects: Add Android VNDK to compile test the HALMattijs Korpershoek
The Android HAL has quite some Android-specific dependencies (such as libhardware) which are not part of regular linux distributions. To compile-test the HAL on a Linux x86 system, we have added some stubs. This means that each time we add a new Android specific dependency, we need to write an associated stub for it, which can get tricky, especially for complex C++ classes such as GraphicBufferAllocator. It would be easier if we could import the includes and the required libraries we need from Android so that we can build-test the HAL. The Vendor Native Development Kit (VNDK) provides all the libraries that a vendor service (such as the libcamera HAL) can link against. Add the VNDK as a subproject of libcamera and add the necessary meson bits so that we can compile test the Android HAL on linux without having to stub anything. Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-10-13meson: fix building with cpp_stlibMattijs Korpershoek
When building with custom STLs [1], meson will pass -nostdlib++ to the compiler, which will conflict with the -stdlib=libc++ flag: clang-17: error: argument unused during compilation: '-stdlib=libc++' [-Werror,-Wunused-command-line-argument] Test the user requested a custom cpp_stlib and only configure libc++ when needed. [1] https://mesonbuild.com/Cross-compilation.html#using-a-custom-standard-library Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-10-13android: delete unused android/log.h includeMattijs Korpershoek
This header has been transformed into a symlink in the Android tree in 2017 [1]. It's heavily out of date and conflicts the VNDK provided log.h header. Since it's unused, we can drop it here. Tested with: meson setup -Dandroid=enabled -Dandroid_platform=generic -Dpipelines=simple build meson compile -C buildd [1] https://android-review.googlesource.com/c/platform/system/core/+/316957 Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-09-23android: switch over to modern gralloc API via libuiMattijs Korpershoek
gralloc.h is a very old API that has been deprecated at least since Android P (9). Devices are encouraged to switch over to HIDL interface named android.hardware.graphics.allocator@<VERSION>, where <VERSION> can be 2.0 ,3.0 or 4.0. This is mandatory since Android Q (10) [1] Fortunately, Android provides an abstraction on top of android.hardware.graphics.allocator which is compatible with each version. This abstraction is implemented in libui, which is available in the VNDK. Import all necessary headers from AOSP and switch over the generic_frame_buffer_allocator to use GraphicBufferAllocator. This series has been build-tested on a linux host and functionally tested on an AM62x SK EVM with Android 13. (preview and capture). [1] https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/main/compatibility_matrices/compatibility_matrix.4.xml#195 To: libcamera-devel@lists.libcamera.org Cc: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Cc: Guillaume La Roque <glaroque@baylibre.com> Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com> Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> --- Changes in v4: - EDITME: describe what is new in this series revision. - EDITME: use bulletpoints and terse descriptions. - Link to v3: https://lore.kernel.org/r/20230923-gralloc-api-v4-v3-0-9a9e039284ba@baylibre.com Changes in v3: - Fixed patch 3 missing whitespace (Jacopo) - Added libui meson import build in patch 3 (more consistent) (Jacopo) - Removed member reference to GraphicBufferAllocator in patch 4 (Jacopo) - Link to v2: https://lists.libcamera.org/pipermail/libcamera-devel/2023-September/038942.html Changes in v2: - Dropped additional ; in graphic_buffer_allocator_stub.cpp. (Kieran) - Surrounded problematic includes with #pragma to avoid clang compile errors related to -Wextra-semi. (Kieran) - Link to v1: https://lists.libcamera.org/pipermail/libcamera-devel/2023-September/038927.html Tested on linux with: CC=clang CXX=clang++ meson setup build -Dandroid=enabled -Dandroid_platform=generic ninja -C build And clang version clang++ (clang 16.0.6 "clang version 16.0.6 (Fedora 16.0.6-2.fc38)") --- b4-submit-tracking --- # This section is used internally by b4 prep for tracking purposes. { "series": { "revision": 4, "change-id": "20230824-gralloc-api-v4-e3388fd364c6", "base-branch": "master", "prefixes": [], "history": { "v1": [ "20230912-gralloc-api-v4-v1-0-0f80402d8e7a@baylibre.com" ], "v2": [ "20230912-gralloc-api-v4-v2-0-e859da63f98c@baylibre.com" ], "v3": [ "20230923-gralloc-api-v4-v3-0-9a9e039284ba@baylibre.com" ] } } }
2023-09-21meson: Simplify check for _FORTIFY_SOURCELaurent Pinchart
Use the compiler.get_define() function to get the value of _FORTIFY_SOURCE instead of iterating over the cpp_args. This simplies the code, but also guarantees to return the actual value of _FORTIFY_SOURCE, even if defined through other means than through the meson cpp_args. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: George Burgess IV <gbiv@google.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-09-21android: camera_device: Fix requestedStream handlingHarvey Yang
The Android CameraDevice class adds a sourceStream for each Mapped stream requested by the framework. When mapping multiple framework streams to the same sourceStream, the implementation of CameraDevice::processCaptureRequest wrongly erases the just added sourceStream from the list of streams to request to libcamera. Fix this by adding the stream instead of erasing it. Fixes: 7ea83eba0df6 ("android: camera_device: Postpone mapped streams handling") Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-09-19meson: Don't set _FORTIFY_SOURCE for ChromeOSGeorge Burgess IV
ChromeOS is moving to a platform default of `_FORTIFY_SOURCE=3`, and this definition conflicts with that: <command line>:4:9: error: '_FORTIFY_SOURCE' macro redefined [-Werror,-Wmacro-redefined] Rather than adding logic to keep up with their local configuration, it seems best to leave setting _FORTIFY_SOURCE on ChromeOS up to ChromeOS. Signed-off-by: George Burgess IV <gbiv@google.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-09-16ipa: rpi: Fix segfault when parsing invalid json fileNaushir Patuck
If the json file parsing failed due to a malformed file, the root pointer would be null. This was not tested and caused a segfault when trying to use the pointer to retrieve the version key. Fix this by bailing out early if the parser returns a null pointer. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-09-16ipa: rpi: agc: Use channel constraints in the AGC algorithmDavid Plowman
Whenever we run Agc::process(), we store the most recent total exposure requested for each channel. With these values we can apply the channel constraints after time-filtering the requested total exposure, but before working out how much digital gain is needed. 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: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-09-16ipa: rpi: agc: Add AgcChannelConstraint classDavid Plowman
A channel constraint is somewhat similar to the upper/lower bound constraints that we use elsewhere, but these constraints apply between multiple AGC channels. For example, it lets you say things like "don't let the channel 1 total exposure be more than 8x that of channel 0", and so on. By using both an upper and lower bound constraint, you could fix one AGC channel always to be a fixed ratio of another. Also read a vector of them (if present) when loading the tuning file. 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: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-09-16ipa: rpi: agc: Implementation of multi-channel AGCDavid Plowman
The switchMode, prepare and process methods are updated to implement multi-channel AGC correctly: * switchMode now invokes switchMode on all the channels (whether active or not). * prepare must find what channel the current frame is, and run on behalf of that channel. * process updates the most recent DeviceStatus and statistics for the channel of the frame that has just arrived, but generates updated values working through the active channels in round-robin fashion. One minor detail in process is that we don't want to change the DeviceStatus metadata of the current frame, so we now pass this to the AgcChannel's process method, rather than letting it find the DeviceStatus in the metadata. 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: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-09-16ipa: rpi: agc: Reorganise code for multi-channel AGCDavid Plowman
This commit does the basic reorganisation of the code in order to implement multi-channel AGC. The main changes are: * The previous Agc class (in agc.cpp) has become the AgcChannel class in (agc_channel.cpp). * A new Agc class is introduced which is a wrapper round a number of AgcChannels. * The basic plumbing from ipa_base.cpp to Agc is updated to include a channel number. All the existing controls are hardwired to talk directly to channel 0. There are a couple of limitations which we expect to apply to multi-channel AGC. We're not allowing different frame durations to be applied to the channels, nor are we allowing separate metering modes. To be fair, supporting these things is not impossible, but there are reasons why it may be tricky so they remain "TBD" for now. This patch only includes the basic reorganisation and plumbing. It does not yet update the important methods (switchMode, prepare and process) to implement multi-channel AGC properly. This will appear in a subsequent commit. For now, these functions are hard-coded just to use channel 0, thereby preserving the existing behaviour. 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: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-09-16ipa: rpi: histogram: Add interBinMean()Naushir Patuck
Add a new helper function Histogram::interBinMean() that essentially replaces the existing Histogram::interQuantileMean() logic but working on bins instead. Rework the interQuantileMean() to call into interBinMean() with the appropriate convertion from quatiles to bins. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-09-15README.rst: Drop recommendation to install meson using pip3Laurent Pinchart
Usage of pip3 to install meson may result in a different meson version available for the local user and for root. This causes issues when running `meson install` (directly or through `ninja install`): Installing to a system location will request elevated privileges and use the system meson version to install files, which may fail to unpickle data pickled with the meson version for the local user. As all major distributions now provide a recent-enough version of meson, usage of pip3 is not longer needed in most cases, and shouldn't be recommended. Drop it. While at it, update the version of meson listed in the documentation to match the required version. Bug: https://bugs.libcamera.org/show_bug.cgi?id=199 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-09-04ipa: rpi: vc4: Make the StatisticsPtr construction clearerDavid Plowman
StatisticsPtr is a shared pointer, so the use of std::make_unique to create it was a bit confusing. Use std::make_shared instead. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-09-04ipa: rpi: agc: Split AgcStatus into AgcStatus and AgcPrepareStatusDavid Plowman
The Agc::process() function returns an AgcStatus object in the metadata as before, but Agc::prepare() is changed to return the values it computes in a separate AgcPrepareStatus object (under the new tag "agc.prepare_status"). The "digitalGain" and "locked" fields are moved from AgcStatus to AgcPrepareStatus. This will be useful going forward as we can be more flexible about the order in which prepare() and process() are called, without them trampling on each other's results. 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-09-04ipa: rpi: agc: Filter exposures before dealing with digital gainDavid Plowman
We now time-filter the exposure before sorting out how much digital gain is required. This is actually a little more natural and simplifies the code. It also prepares us for some future work where this arrangement will be helpful. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrpyi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-09-04ipa: rpi: agc: Fetch AWB status in process method, not prepareDavid Plowman
prepare() doesn't use the AWB status, so fetching it in process() is probably better. This change is preparatory to other changes, where we may find ourselves calling process() without having called prepare() previously. 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-09-04pipeline: rpi: Simplify buffer id generationNaushir Patuck
Replace the buffer id generation in RPi::Stream with a simple integer counter since ids don't get recycled any more. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-09-04pipeline: rpi: Rename RPi::Stream::setExternalBuffer()Naushir Patuck
Since we don't distinguish between externally and internally allocated dma bufs, rename this function to setExportedBuffer() to clearer on its function. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-09-04pipeline: rpi: Remove additional external dma buf handling logicNaushir Patuck
There is no need to distinguish between dma bufs allocated outside of libcamera and internally allocated buffers. As such, remove all the special case handling of such buffers. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-09-04pipeline: rpi: Increase buffer import count to 32Naushir Patuck
Hardcode the maximum number of buffers imported to the V4L2 video device to 32. This only has a minor disadvantage of over-allocating cache slots and V4L2 buffer indexes, but does allow more headroom for using dma buffers allocated from outside of libcamera. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-08-29libcamera: stream: Document stride will be 0 for compressed formatsUmang Jain
For compressed formats, v4l2_pix_format.bytesperline value will be zero and is documented similarly in the kernel. Since we set the stride to v4l2_pix_format.bytesperline, document the case where it is expected to be zero (i.e. if the format is compressed). Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-08-29ipa: rpi: imx290: Hide one frame on startupNaushir Patuck
The imx290 produces a single unusable frame on startup and mode switch. This is signalled to the IPA in the mode switch case, but not the startup case. Fix this. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-08-02libcamera: Remove duplicated SortIncludes in `.clang-format`Harvey Yang
`SortIncludes: true` was added in both commit ae05b9f9d082 ("clang-format: Enable sorted includes") and commit 0e1ff86e78ae ("clang-format: Regroup sort orders"), which caused issues to run clang-format. Fixes: 0e1ff86e78ae ("clang-format: Regroup sort orders") Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-07-31Documentation: theme: Fix compilation with Sphinx >= 7.0.0Laurent Pinchart
Sphinx 7.0.0 has dropped support for the deprecated 'style' variable (https://github.com/sphinx-doc/sphinx/pull/11381). This breaks compilation of the documentation: /usr/bin/sphinx-build -D release=v0.1.0+16-eed6a079 -q -W -b html Documentation Documentation/html Theme error: An error happened in rendering the page api-html/index. Reason: UndefinedError("'style' is undefined") The recommended replacement is 'styles[-1]'. However, this resolves to '_static/css/theme.css', which is part of the 'css_styles' variable, and results in the stylesheet being included twice. To avoid that and fix the compilation error, simply drop the first reference. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-31pipeline: rpi: Don't call toV4L2DeviceFormat() from validate()Naushir Patuck
Don't make an unnecessary call to toV4L2DeviceFormat() from validate() to get a V4L2DeviceFormat. Instead, the conversion can happen directly from the RAW stream PixelFormat. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-07-28meson: Correctly locate libc++Laurent Pinchart
The meson find_library() function takes a library name without the "lib" prefix. Its usage to find lic++ is thus not correct, and meson warns about it: WARNING: find_library('libc++') starting in "lib" only works by accident and is not portable Fix it by dropping the "lib" prefix. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-28utils: checkstyle.py: Extract title and trailers with one commandLaurent Pinchart
The Amendment class calls `git show` twice, once to extract the commit title, and a second time to extract the trailers. This can be combined in a single command, which is more efficient. Do so. While at it, centralize initialization of self._trailers in the Commit.__init__() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-28libcamera: yaml: Increase the YAML parser limitNaushir Patuck
Increase the maximum list size to 2000 elements. This allows, for example, larger lens shading config structures to be parsed correctly without throwing any errors. Signed-off-by: Naushir Patuck <naush@raspberrypi.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>
2023-07-28ipa: rpi: Fix the reporting of Focus FoMsDavid Plowman
The FocusFom metadata was no longer being reported back because the "focus.status" metadata was never being created. Additionally, the scaling of the focus FoMs was over-zealous, rounding just about everything down to zero. Fixes: ac7511dc4c59 ("ipa: raspberrypi: Generalise the focus reporting code") Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.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>
2023-07-28utils: raspberrypi: ctt: Code tidyingBen Benson
Altered the way that some lines are laid out, made functions more attractive to look at, and tidied up messy areas. Signed-off-by: Ben Benson <ben.benson@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2023-07-28ipa: rpi: vc4: data: Updated color matrices for RPi CamerasBen Benson
Altered the color matrices for the tuning files for various cameras in order to make them more color accurate. Signed-off-by: Ben Benson <ben.benson@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2023-07-28utils: raspberrypi: ctt: Improved color matrix fittingBen Benson
Added code which optimises the color matrices based off delta E values for the calibration images. Working in LAB color space. Signed-off-by: Ben Benson <ben.benson@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2023-07-25ipa: rpi: common: Handle AEC/AGC flicker controlsDavid Plowman
We handle the flicker modes by passing the correct period to the AEC/AGC algorithm which already contains the necessary code. The "Auto" mode, as well as reporting the detected flicker period via the "AeFlickerDetected" metadata, are unsupported for now. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2023-07-25libcamera: controls: Add controls for AEC/AGC flicker avoidanceDavid Plowman
Flicker is the term used to describe brightness banding or oscillation of images caused typically by artificial lighting driven by a 50 or 60Hz mains supply. We add three controls intended to be used by AEC/AGC algorithms: AeFlickerMode to enable flicker avoidance. AeFlickerPeriod to set the flicker period "manually". AeFlickerDetected to report any flicker that is currently detected. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2023-07-24libcamera: rpi: pipeline_base: Cache sensor formatJacopo Mondi
The format to be applied on the sensor is selected by two criteria: the desired output size and the bit depth. As the selection depends on the presence of a RAW stream and the streams configuration is handled in validate() there is no need to re-compute the format in configure(). Centralize the computation of the sensor format in validate() and remove it from configure(). Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2023-07-24libcamera: rpi: pipeline_base: Move findBestFormat to CameraDataJacopo Mondi
The findBestFormat() helper operates on the list of sensor formats, which is owned by the CameraData class. Move the function to that class as well to: 1) Avoid passing the list of formats to the function 2) Remove a static helper in favour of a class function 3) Allow subclasses with access to CameraData to call the function Move to the CameraData class the scoreFormat helper as well. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2023-07-24libcamera: rpi: pipeline_base: Remove populateSensorFormats()Jacopo Mondi
populateSensorFormats() is a static helper that is called from a single place and performs a simple loop over the sensor camera formats. Remove it and in-line it in the caller to remove one static helper from the pipeline_base.cpp file. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-18utils: checkstyle.py: Check trailers for Amendment commitsKieran Bingham
The commit trailers are checked as part of processing the commit message with the newly introduced TrailersChecker. This relies on the trailers property being correctly exposed by the Commit object, and is implemented for the base Commit but not processed for Amendment commits. Refactor the trailer property handling to a helper function in the base Commit class and make use of it with a newly added call to obtain the existing Trailers from the most recent commit when using Amendment. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-18utils: checkstyle.py: Derive Amendment from CommitKieran Bingham
The Amendment commit class is derived from the StagedChanges class (which in turn derives from the Commit base class), however there is no code sharing between Amendment and StagedChanges other than the call to initalise through the base Commit class. Refactor the inheritance to make an Amendment derive directly from Commit. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-18utils: checkstyle.py: Initialise staged trailersKieran Bingham
There are no possible Trailers for staged changes as the commit message has not yet been written. Initialise the empty trailers when the commit object is initialised. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-18utils: checkstyle.py: Treat Malformed trailers as a CommitIssueKieran Bingham
If a Malformed trailer is identified the checkstyle script triggers a RuntimeError and stops processing the rest of the commit. A malformed trailer can be regarded as an issue in the commit and reported as such using the same method as other faults identified by the tool. Convert the RuntimeError into a CommitIssue and continue processing other trailers. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-16libcamera v0.1.0Kieran Bingham
ABI Compliance: abi-compliance-checker reports 99% binary compatibility and 81.4% source compatibilty between version 0.0.5 and 0.1. - Binary compatibility: 99% - Source compatibility: 81.4% - Total binary compatibility problems: 4, warnings: 2 - Total source compatibility problems: 165, warnings: 7 Now that we have funtional ABI validation, the soname has been updated from libcamera.so.0.0.5 to libcamera.so.0.1. Future releases will now maintain the same soname until an ABI breakage is detected to reduce the repackaging and rebuilding of other components that may use libcamera. The abi-compatibility report can now be generated with the new utility './utils/abi-compat.sh'. Key differences here are due to preventing the installation of internal and private headers in the packaging process, and most of this API compatibility should not be visible to applications with the exception of: - Camera::generateConfiguration ( StreamRoles const& roles ) The StreamRoles type definition has been removed. This is now handled as a Span<StreamRole> to prevent unnecessary allocations and copies. - CameraManager::addCamera ( std::shared_ptr<struct Camera> camera, std::vector<unsigned long>const& devnums ) - CameraManager::get ( dev_t devnum ) - CameraManager::removeCamera ( std::shared_ptr<struct Camera> camera ) These functions of the CameraManager were for use exclusively by the V4L2 adaptation layer, and not intended for use by applications. This has now been reworked to use the new SystemDevices and the redundant functions removed. The ABI/API breakages have been introduced by: 5ca0c9276f28 ("libcamera: CameraManager: Remove ::get(dev_t)") 26a4b83d1b94 ("libcamera: Remove `StreamRoles` alias") 63966ae587d7 ("libcamera: base: Do not install private headers") Core: - libcamera: v4l2_videodevice: Use O_CLOEXEC when exporting DMA buffers - libcamera: ipa_manager: Allow IPA loading in nested subdirs - meson: Fix usage of overwritten pipeline variable - subprojects: Drop leftovers of pybind11 - camera_sensor: ipa: core: Add CFA pattern to IPACameraSensorInfo - libcamera: controls: Define a default lens position behaviour - libcamera: internal: request: convert to pragma once - libcamera: camera_manager: Move private implementation to internal - libcamera: camera_manager: Move {add,remove}Camera to internal - libcamera: properties: Provide a Devices camera property - libcamera: pipeline: Register device numbers with camera - libcamera: camera_sensor: Adjust properties::Rotation - libcamera: meson: Allow PH to change libcamera_deps - libcamera: base: Move thread_annotations to private - libcamera: base: Do not install private headers - utils: ABI Compatibility checker - meson: Use x.y soname versioning - libcamera: camera: Take span of StreamRole instead of vector - libcamera: Remove `StreamRoles` alias - utils: ipu3-capture.sh: Fix the script to work with recent media-ctl versions - Documentation: Add predefined macros from config.h to Doxyfile - utils: checkstyle: Add __repr__ method to CommitFile class - utils: checkstyle: Support running checkers selectively - utils: checkstyle: Don't include commit ID in commit title - utils: checkstyle: Add trailers checker - tests: gstreamer: Test cameras' enumeration from GstDeviceProvider - meson: Fix space around colon issues - libcamera: Add option to configure udev support - libcamera: CameraManager: Remove ::get(dev_t) - tests: gstreamer: Fix compiler error with gcc 8.4.0 ipa: - meson: ipa: Add mapping for pipeline handler to mojom interface file - libcamera: ipa: Remove character restriction on the IPA name - ipa: meson: Allow nested IPA directory structures - ipa: raspberrypi: Introduce IpaBase class - ipa: raspberrypi: agc: Move weights out of AGC - ipa: rkisp1: agc: drop hard-coded analogue gain range - libipa: camera_sensor_helper: Add IMX327 helper - pipeline: rpi: ipa_base: Parse config files after platformRegister() - libcamera: camera_sensor: Add Sony IMX327 sensor properties - ipa: rpi: imx296: Small refinements to the IMX296 mono sensor tuning - ipa: rpi: Handle controls for mono variant sensors - libcamera: controls: Drop reference to IPA in controls documentation - libipa: camera_sensor_helper: Restore alphabetical order - ipa: ipu3: agc: Drop hard-codec analogue gain max - ipa: rkisp1: agc: Restore minimum analogue gain limit - pipeline: ipa: rpi: Return lens controls from ipa->configure() - ipa: rpi: Set lens position to hyperfocal on startup - ipa: rpi: tunings: Add missing short and long exposure profiles - ipa: rpi: agc: Use std::string instead of char arrays - ipa: rpi: agc: Gracefully handle missing agc modes - ipa: rpi: agc: Do not switch to a default if a mode is unavailable - ipa: rpi: imx708: Fix mode switch drop frame count - ipa: rpi: imx296_mono: Disable all colour shading pipeline: - libcamera: pipeline: simple: Add support for ST's DCMIPP - pipeline: meson: Allow nested pipeline handler directory structures - pipeline: ipa: raspberrypi: Refactor and move the Raspberry Pi code - pipeline: raspberrypi: rpi_stream: Set invalid buffer to id == 0 - pipeline: ipa: raspberrypi: Restructure the IPA mojom interface - pipeline: raspberrypi: Make RPi::Stream::name() return const std::string & - pipeline: raspberrypi: Introduce PipelineHandlerBase class - pipeline: raspberrypi: Add stream flags to RPi::Stream - libcamera: rkisp1: Generate config using main path - libcamera: rkisp1: Crop on ISP before downscaling - libcamera: rkisp1: Assign sizes to roles - libcamera: rkisp1: Fix enumeration of RAW formats - pipeline: rpi: Do not return an error from pipeline config file handling - libcamera: pipeline: simple: Support TI CSI-RX - pipeline: rpi: Account for Bayer packing when validating format apps: - apps: qcam: Remove redundant check - v4l2: Move the v4l2 compat layer to libexec/libcamera - android: mm: generic: use GRALLOC_HARDWARE_MODULE_ID - android: mm: Stub libhardware for build tests - py: Fix CameraManager.version property - py: Move ColorSpace and Transform classes to separate files - py: Use exceptions instead of returning error codes - py: unittests.py: Add weakref helpers and use del - py: Move to mainline pybind11 version - py: Fix code formatting - py: unittests.py: Fix type checker warnings - gstreamer: Add enable_auto_focus option to the GStreamer plugin - gstreamer: Drop libcamera_private dependency - apps: Add ipa-verify application - v4l2: v4l2_camera_proxy: Prevent ioctl sign-extensions - v4l2: Use SystemDevices properties to identify cameras Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-11tests: gstreamer: Fix compiler error with gcc 8.4.0Laurent Pinchart
The provider g_autoptr variable introduced by commit adb1bbb748a1 ("tests: gstreamer: Test cameras' enumeration from GstDeviceProvider") is left uninitialized when declared. The cleanup function could thus get called on an unitialized variable if the scope was exited before the variable gets initialized. This can't occur here, but gcc 8.4.0 still complains about it: /usr/include/glib-2.0/glib/gmacros.h: In member function ‘virtual int GstreamerDeviceProviderTest::run()’: /usr/include/glib-2.0/glib/gmacros.h:1049:27: error: ‘provider’ may be used uninitialized in this function [-Werror=maybe-uninitialized] { if (_ptr) (cleanup) ((ParentName *) _ptr); } \ ^ ../test/gstreamer/gstreamer_device_provider_test.cpp:37:32: note: ‘provider’ was declared here g_autoptr(GstDeviceProvider) provider; Silence the error by initializing the variable to NULL at declaration time. This is a good practice in any case, as later refactoring could otherwise introduce a scope exit before initialization. Fixes: adb1bbb748a1 ("tests: gstreamer: Test cameras' enumeration from GstDeviceProvider") 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> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-11libcamera: CameraManager: Remove ::get(dev_t)Kieran Bingham
The CameraManager::get(dev_t) implementation was provided only for the V4L2 Adaptation layer. This has now been replaced with the use of the public SystemDevices property. Remove the deprecated function entirely, along with the camerasByDevnum_ map which was only used to support this functionality. This is a clear (and intentional) breakage in both the API and ABI. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-11v4l2: Use SystemDevices properties to identify camerasKieran Bingham
The CameraManager->get(dev_t) helper was implemented only to support the V4L2 Adaptation layer, and has been deprecated now that a new camera property - SystemDevices has been introduced. Rework the implementation of getCameraIndex() to use the SystemDevices property and remove reliance on the now deprecated call. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>