summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2024-06-10libcamera: pipeline: vivid: Configure the deviceKieran Bingham
When the configurations have been generated and validated, they can be applied to a device. Vivid supports only a single stream, so it directly obtains the first StreamConfiguration from the CameraConfiguration. The VIVID catpure device is a V4L2Video device, so we generate a V4L2DeviceFormat to apply directly to the capture device node. Note that we convert the libcamera Format stored in cfg.pixelFormat to a V4L2PixelFormat using V4L2PixelFormat helper. This currently defaults to the single-planar formats, and should be extended to support the Multiplanar configuration from the V4L2Device. [todo Repair the link between the multiplanar configuration of the V4L2VideoDevice and the pixel format selection] Following the call to set the format using the Kernel API, if the format has been adjusted in any way by the kernel driver, then we have failed to correctly handle the validation stages, and thus the configure operation is idendified has having failed. Finally stream specific data can be directly stored and set as reflecting the state of the stream. [NOTE: the cfg.setStream() call here associates the stream to the StreamConfiguration however that should quite likely be done as part of the validation process. TBD] Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-10libcamera: pipeline: vivid: Generate and validate StreamConfigurationsKieran Bingham
Implement the support for Generating and Validating the streams the Camera can provide. Vivid is a simple case with only a single stream. Test the configurations can be generated and reported with cam -I: """ LIBCAMERA_LOG_LEVELS=Pipeline,VIVID:0 ./src/cam/cam -c 1 -I [232:02:09.633067174] [2882911] INFO IPAManager ipa_manager.cpp:136 libcamera is not installed. Adding '/home//libcamera/build-vivid/src/ipa' to the IPA search path [232:02:09.633332451] [2882911] WARN IPAManager ipa_manager.cpp:147 No IPA found in '/usr/local/lib/x86_64-linux-gnu/libcamera' [232:02:09.633373414] [2882911] INFO Camera camera_manager.cpp:283 libcamera v0.0.11+714-d1ebd889-dirty Using camera vivid 0: 1280x720-BGR888 * Pixelformat: NV21 (320x180)-(3840x2160)/(+0,+0) - 320x180 - 640x360 - 640x480 - 1280x720 - 1920x1080 - 3840x2160 * Pixelformat: NV12 (320x180)-(3840x2160)/(+0,+0) - 320x180 - 640x360 - 640x480 - 1280x720 - 1920x1080 - 3840x2160 * Pixelformat: BGRA8888 (320x180)-(3840x2160)/(+0,+0) - 320x180 - 640x360 - 640x480 - 1280x720 - 1920x1080 - 3840x2160 * Pixelformat: RGBA8888 (320x180)-(3840x2160)/(+0,+0) - 320x180 - 640x360 - 640x480 - 1280x720 - 1920x1080 - 3840x2160 """ Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-10libcamera: pipeline: vivid: Create a CameraKieran Bingham
Create a VividCameraData inheriting from the CameraData to handle camera specific data, and use it to create and register the camera with the CameraManager. This can now be tested to see that the camera becomes available to applications: """ LIBCAMERA_LOG_LEVELS=Pipeline,VIVID:0 ./src/cam/cam -l [231:44:49.325333712] [2880028] INFO IPAManager ipa_manager.cpp:136 libcamera is not installed. Adding '/home/libcamera/build-vivid/src/ipa' to the IPA search path [231:44:49.325428449] [2880028] WARN IPAManager ipa_manager.cpp:147 No IPA found in '/usr/local/lib/x86_64-linux-gnu/libcamera' [231:44:49.325446253] [2880028] INFO Camera camera_manager.cpp:283 libcamera v0.0.11+713-d175334d-dirty Available cameras: 1: vivid """ Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-10libcamera: pipeline: vivid: Match deviceKieran Bingham
Verify that we can match on our expected device(s). Use a temporary debug print to check that the pipeline finds our device: """ LIBCAMERA_LOG_LEVELS=Pipeline,VIVID:0 ./src/cam/cam -l <snipped> [230:51:10.670503423] [2872877] DEBUG VIVID vivid.cpp:81 Obtained Vivid Device """ Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-10DocumentationUseOnly: Force enable VividKieran Bingham
To make sure we always build the Vivid pipeline in this branch, explicitly add it to the pipelines build targets. This is not any kind of best practice for pipeline handlers, but is here to ensure that this pipeline is always compiled on this branch who's sole purpose is to use and demonstrate the vivid pipeline handler.
2024-06-10DocumentationUseOnly: Disable compiler warningKieran Bingham
Explicitly disable the unused-parameter warning in this pipeline handler. Parameters are left unused while they are introduced incrementally, so for documentation purposes only we disable this warning so that we can compile each commit independently without breaking the flow of the development additions. This is not recommended practice within libcamera, please listen to your compiler warnings. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-10libcamera: pipeline: Introduce skeleton Vivid PipelineKieran Bingham
Provide all of the skeleton stubs to succesfully compile and register a new Pipeline Handler for the Vivid test device. Meson must be reconfigured to ensure that this pipeline handler is included in the selected pipelines configuration, and after building, we can test that the PipelineHandler is successfully registered by listing the cameras on the system with LIBCAMERA_LOG_LEVELS enabled: """ LIBCAMERA_LOG_LEVELS=Pipeline:0 ./build-vivid/src/cam/cam -l [230:30:03.624102821] [2867886] DEBUG Pipeline pipeline_handler.cpp:680 Registered pipeline handler "PipelineHandlerVivid" Available cameras: """ Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-10test: ipa: rkisp1: utils: Fix floating and fixed point conversion testPaul Elder
There was an issue where using map to store the test cases meant that the test for ignoring unused bits was skipped because of clashing keys. Fix this by moving the offending test out of the loop. While at it, also change the arbitrary floating comparison precision to be more precise. Also fix a missing documentation brief. Fixes: 9d152e9c66c1 ("ipa: rkisp1: Add a helper to convert floating-point to fixed-point") Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-05libcamera: dma_buf_allocator: Work around lack of file seals in uClibcLaurent Pinchart
uClibc doesn't provide the macros defining parameters for the file sealing API. Define them manually as a work around. Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2024-06-05libcamera: dma_buf_allocator: Work around lack of memfd_create() in uClibcLaurent Pinchart
uClibc doesn't provide a memfd_create() implementation. Fix it by using a direct syscall when the function isn't available. Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
2024-06-05libcamera: dma_buf_allocator: Create memfd with CLOEXECLaurent Pinchart
Ensure that the memfd file descriptor won't be leaked to child processes by creating it with MFD_CLOEXEC. Fixes: ea4baaacc325 ("libcamera: DmaBufAllocator: Support allocating from /dev/udmabuf") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-04ipa: rpi: Disable StatsOutputEnable control by defaultNaushir Patuck
Set the default value of controls::rpi::StatsOutputEnable to false, disabling the functionality. This stops unnecessary copies of the statistics output ending up in the Request metdata if not needed. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-04libcamera: software_isp: Allow using dma-buffers from /dev/udmabufHans de Goede
Allow the DmaBufAllocator used by the software ISP to use memfd() + /dev/udmabuf for the software ISP destination buffers. This is useful on Linux distributions where normal users are not allowed to access /dev/dma_heap/* while they are allowed to access /dev/udmabuf. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # Lenovo-x13s Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-04libcamera: DmaBufAllocator: Support allocating from /dev/udmabufHans de Goede
The dma-buf allocator currently allocates from CMA and system heaps. Extend the dma-buf allocator to support allocating dma-buffers by creating memfd-s and turning those into dma-buffers using /dev/udmabuf. The buffers allocated through memfd/udmabuf are not suitable for zero-copy buffer sharing with other devices. Co-developed-by: Harvey Yang <chenghaoyang@chromium.org> Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # Lenovo-x13s Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-04libcamera: Rename DmaHeap class to DmaBufAllocatorHans de Goede
Users of the DmaHeap class really just want some way to allocate dma-buffers from userspace. This can also be done by using /dev/udmabuf instead of using /dev/dma_heap/*. Rename DmaHeap class to DmaBufAllocator in preparation of adding /dev/udmabuf support. And update the DmaHeap class docs to match including replacing references to "dma-heap type" with "dma-buf provider". This is a pure automated rename on the code ('s/DmaHeap/DmaBufAllocator/') + file renames + doc updates. There are no functional changes. The DmaBufAllocator objects in vc4.cpp and software_isp.cpp are left named dmaHeap_ to keep the changes to those 2 files to a minimum. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # Lenovo-x13s Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-03libcamera: v4l2_subdevice: Update to the new kernel routing APILaurent Pinchart
The subdev embedded data support series includes a change to the VIDIOC_SUBDEV_G_ROUTING and VIDIOC_SUBDEV_S_ROUTING ioctls that impacts the userspace API. Update to the new API, while preserving backward compatibility to ease the transition. Document the backward compatibility to only be supported for two kernel releases. As the routing API isn't enabled in any upstream kernel yet, users of the API need kernel patches, and are expected to be able to upgrade quickly. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-03include: linux: Update kernel headers to version v6.10-rc1Hans de Goede
Updated kernel headers to v6.10-rc1 using utils/update-kernel-headers.sh and re-instating libcamera local modifications. This includes adding include/linux/udmabuf.h which was not part of libcamera's include/linux headers before. Signed-off-by: Hans de Goede <hdegoede@redhat.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>
2024-06-03update-kernel-headers: Add linux/udmabuf.h to headers to syncHans de Goede
linux/udmabuf.h will be used by upcoming DmaBufAllocator changes and it is not available on some older kernels. Add it to the headers to sync. Signed-off-by: Hans de Goede <hdegoede@redhat.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>
2024-06-03test: ipa: rkisp1-utils: Fix coding style for template argumentsLaurent Pinchart
The coding style names template arguments using CamelCase with an uppercase initial letter. Fix the template arguments in the rkisp1-utils test. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-03pipeline: vimc: Don't hardcode scaling factor with recent kernelsLaurent Pinchart
Starting in kernel v5.16, the vimc driver stopped hardcoding the scaler factor. Use this to lift constraints on the camera configuration, and in particular on the exotic output size alignment to a multiple of 6. As a result, vimc-based cameras can more easily match common display resolutions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-06-03test: v4l2_videodevice: Increase timeout for vimc capture testsLaurent Pinchart
On slower machines, a 10s timeout to capture frames with vimc can be too short and cause test failures. Make the timeout proportional to the number of frames expected to be captured, using a conservative low estimate of the frame rate at 2fps. This does not increase the test time if the vimc driver is fast enough to produce frames. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-06-03test: fence: Increase timeout for fence testLaurent Pinchart
On slower machines, a 1s timeout to capture frames with vimc can be too short and cause test failures. Make the timeout proportional to the number of frames expected to be captured, using a conservative low estimate of the frame rate at 2fps. By itself, that change could increase the test time quite substantially on fast platforms, so break from the capture loop as soon as we capture enough frames. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-03test: fence: Fix race conditionLaurent Pinchart
The fence test is racy, as it relies on the main loop being executed between completion of request signalledRequestId_ and signalledRequestId_ + 1. This usually happens, but is not guaranteed. To fix the race condition, change the request identification logic by replacing usage of the cookie value, which is zero-based and wraps around at nbuffers_ - 1, with a completed request counter that is one-based and doesn't wrap. The completedRequestId_, expiredRequestId_ and signalledRequestId_ variables now track the identifier of the last request that has completed, the request whose fence will time out, and the request whose fence will be signalled. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-06-03test: fence: Turn class member variable into local variableLaurent Pinchart
The fence_ class member variable is only used locally in the FenceTest::run() function. Make it a local variable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-06-03test: camera: Increase timeout for vimc capture testsLaurent Pinchart
On slower machines, a 1s timeout to capture frames with vimc can be too short and cause test failures. Make the timeout proportional to the number of frames expected to be captured, using a conservative low estimate of the frame rate at 2fps. By itself, that change could increase the test time quite substantially on fast platforms, so break from the capture loop as soon as we capture enough frames. To do so, interrupt the dispatcher at every request completion, or it will only get interrupted after the timer times out. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-06-02libcamera: software_isp: Remove TODO about internal representationMilan Zamazal
TODO #4 was recorded at a time where the IPA module computed gain values and the ISP computed the look up tables. The gains were higher-level parameters. Now that the look up tables are computed in the IPA module, the IPA and ISP are more tightly coupled and the TODO item is less relevant. Let's drop the TODO item. We may or may not need to switch to a different representation in future but there is currently no good need for this and the conversion of the values would be just waste of CPU cycles. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-06-02libcamera: software_isp: Remove DebayerParams::kGain10Milan Zamazal
The constant is used in a single place internally and doesn't belong to DebayerParams anymore. Let's use 256 directly. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Andrei Konovalov <andrey.konovalov.ynk@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-06-02libcamera: software_isp: Move color mappings out of debayeringMilan Zamazal
Constructing the color mapping tables is related to stats rather than debayering, where they are applied. Let's move the corresponding code to stats processing. The same applies to the auxiliary gamma table. As the gamma value is currently fixed and used in a single place, with the temporary exception mentioned below, there is no need to share it anywhere anymore. It's necessary to initialize SoftwareIsp::debayerParams_ to default values. These initial values are used for the first two frames, before they are changed based on determined stats. To avoid sharing the gamma value constant in artificial ways, we use 0.5 directly in the initialization. This all is not a particularly elegant thing to do, such a code belongs conceptually to the similar code in stats processing, but doing better is left for larger refactoring. This is a preliminary step towards building this functionality on top of libipa/algorithm.h, which should follow. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Andrei Konovalov <andrey.konovalov.ynk@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-06-02libcamera: software_isp: Honor black level in AWBMilan Zamazal
The white balance computation didn't consider black level. This is wrong because then the computed ratios are off when they are computed from the whole brightness range rather than the sensor range. This patch adjusts white balance computation for the black level. There is no need to change white balance application in debayering as this is already applied after black level correction. Exposure computation already subtracts black level, no changes are needed there. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Andrei Konovalov <andrey.konovalov.ynk@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-06-02libcamera: software_isp: Use a specific integer type for black levelMilan Zamazal
The documented range of values corresponds to uint8_t, so let's use that type. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Andrei Konovalov <andrey.konovalov.ynk@gmail.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-05-31utils: checkstyle.py: Show location of coding style issue within lineLaurent Pinchart
The issue checkers display the line number and line content of each offending line, but don't show the location of the issue within a line. Improve checkstyle by adding a marker that points to the exact location. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-31utils: checkstyle.py: Add a check for hex valuesLaurent Pinchart
libcamera uses lowercase hex values. Add a corresponding checker. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Milan Zamazal <mzamazal@redhat.com>
2024-05-31utils: checkstyle.py: Extend IncludeChecker to cover math.hLaurent Pinchart
math.h is an exception to the C compatibility header rule, as we prefer using cmath. Extend the IncludeCheck to warn about it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-31utils: checkstyle.py: Refactor IncludeCheckerLaurent Pinchart
The IncludeCheck warns when code uses C++ standard library headers where corresponding C compatibility headers are preferred. We have an exception to that rule for math.h, where cmath is prefered. In order to prepare for extending checkstyle.py to enforce that rule, refactor the way the IncludeChecker identifies headers. No functional change is intended. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-31test: ipa: rkisp1-utils: Fix capitalization of hex numbersPaul Elder
Fix capitalization of the hexdecimal numbers in the test for conversion between floating point and fixed point numbers. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-05-31ipa: rkisp1: Add a helper to convert floating-point to fixed-pointPaul Elder
Add helper functions for converting between floating point and fixed point numbers. Also add tests for them. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-27android: camera_capabilities: Fix GCC 14 warningBarnabás Pőcze
GCC 14 thinks `rects` is a "possibly dangling reference to a temporary": /libcamera/src/android/camera_capabilities.cpp: In member function ‘int CameraCapabilities::initializeStaticMetadata()’: /libcamera/src/android/camera_capabilities.cpp:1084:46: error: possibly dangling reference to a temporary [-Werror=dangling-reference] 1084 | const Span<const Rectangle>& rects = | ^~~~~ /libcamera/src/android/camera_capabilities.cpp:1085:83: note: the temporary was destroyed at the end of the full expression ‘(& properties)->libcamera::ControlList::get<libcamera::Span<const libcamera::Rectangle> >(libcamera::properties::PixelArrayActiveAreas).std::optional<libcamera::Span<const libcamera::Rectangle> >::value_or<libcamera::Span<const libcamera::Rectangle> >(libcamera::Span<const libcamera::Rectangle>())’ 1085 | properties.get(properties::PixelArrayActiveAreas).value_or(Span<const Rectangle>{}); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ The return value of `value_or()` is indeed a temporary, but binding it to a reference extends its lifetime. Avoid the warning by not using a reference; this does not make much difference since `value_or()` does not return a reference. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.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>
2024-05-27ipa: rpi: Make monoSensor() accessor constLaurent Pinchart
The ipa::RPi::IpaBase::monoSensor() function doesn't modify the class. Make it const. Fixes: 2031e2f29014 ("ipa: rpi: Add accessor function for monoSensor_") 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>
2024-05-21libcamera: yaml_parser: Avoid double lookup in `operator[]`Barnabás Pőcze
`YamlObject::contains()` does the same search, doing the lookup twice is unnecessary. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-21treewide: Query list of cameras just onceBarnabás Pőcze
This is more efficient since only a single vector will be constructed, and furthermore, it prevents the TOCTOU issue that might arise when the list of cameras changes between the two queries. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-19libcamera v0.3.0Kieran Bingham
abi-compliance checker reports 99.7% binary compatibility and 99.9% source compatibility between v0.2.0 and v0.3.0. The SONAME has been updated accordingly and applications must be relinked against this version of libcamera. Total binary compatibility problems: 2, warnings: 0 Total source compatibility problems: 2, warnings: 0 Specifically, the symbol - ControlList::merge(struct ControlList const& source ) has been replaced with the new symbol: - ControlList::merge ( struct ControlList const& source, enum ControlList::MergePolicy policy ) The following commits in this release relate to either a bug fix or improvement to existing commit. - utils: ipc: extract-docs: Fix escape characters in regex - Reported-by: Nicolas Dufresne <nicolas@ndufresne.ca> - libcamera: Remove empty formats.c - Fixes: e0a51061bc69 ("libcamera: formats: Add 14-bits Bayer RAW formats") - libcamera: bayer_format: Add Y12 to bayerToFormat - Fixes: ec6309571654 ("libcamera: bayer_format: Add unpacked mono 12-bit format to the conversion table") - apps: common: dng_writer: Add a default case for switch-case on a modulo - Bug: https://bugs.libcamera.org/show_bug.cgi?id=207 - utils: mojom: Fix build error caused by the mojom tool update - Fixes: d17de86904f0 ("utils: ipc: Update mojo") - libcamera: formats: Fix planes bounds check - Fixes: e83727a194b5 ("libcamera: PixelFormatInfo: Add functions stride and frameSize") - utils: ipu3: Fix return value check on file output - Fixes: 23ac77dc4a09 ("utils: ipu3: Add IPU3 raw capture unpack utility") - ipa: libipa: histogram: Fix documentation of constructor - Fixes: 1dc01bc9e6c3 ("ipa: libipa: histogram: Add transform parameter to constructor") - gstreamer: Fix string memory leak - Fixes: fc9783acc6083a ("gstreamer: Provide colorimetry <> ColorSpace mappings") - gstreamer: Use copied camera name - Fixes: 58feb69f852289 ("gst: libcamerasrc: Implement selection and acquisition") core: - include: linux: Update kernel headers to version v6.7 - libcamera: v4l2_subdevice: Enable streams API when supported - libcamera: base: signal: Update Qt documentation link to Qt 6 - Documentation: Update Qt documentation links to Qt 6 - test: gstreamer: Use env instead of registry edit - libcamera: Remove empty formats.c - libcamera: formats: Add 16-bit mono format - libcamera: formats: Fix sort ordering of R10_CSI2P - libcamera: bayer_format: Add Y12 to bayerToFormat - libcamera: v4l2_subdevice: Explain sort order of formatInfoMap - libcamera: object: Fix thread-bound reference in documentation - libcamera: signal: Replace object.h inclusion with forward declatation - test: object-delete: Test deferred delete just before thread stops - libcamera: thread: Ensure deferred deletion of all objects before stopping - test: event-thread: Destroy Object from correct thread context - test: message: Remove incorrect slow receiver test - test: message: Destroy Object from correct thread context - test: signal-threads: Destroy Object from correct thread context - test: timer-thread: Move timer start from wrong thread to separate test - test: timer-thread: Destroy Object from correct thread context - libcamera: object: Document and ensure Object deletion constraints - libcamera: object: Add and use thread-bound assertion - utils: mojom: Fix build error caused by the mojom tool update - include: linux: Add RKISP1_V_IMX8MP version - libcamera: utils: Add to_underlying() helper function - libcamera: Use utils::to_underlying() - libcamera: formats: Fix typos in PixelFormatInfo documentation - utils: checkstyle.py: Don't presume python3 location - utils: checkstyle.py: Update LogCategoryChecker regexp - utils: rkisp1: gen-csc-table.py: Don't presume python3 location - libcamera: formats: Fix planes bounds check - utils: ipu3: Fix return value check on file output - README.rst: Report py dependencies - meson_options: Autodetect pycamera support - libcamera: controls: Fix typo on thermal - guides: pipeline-handler: Fix controlInfo_ initialization - libcamera: v4l2_subdevice: Add 14-bit Bayer formats - utils: checkstyle.py: Add Co-developed-by to known_trailers - utils: checkstyle.py: Fix known_trailers sort order - libcamera: framebuffer_allocator: Move from argument in constructor - libcamera: framebuffer_allocator: Use default destructor - libcamera: framebuffer_allocator: Remove entry if allocation fails - libcamera: controls: Add policy parameter to ControlList::merge() - libcamera: v4l2_subdevice: Rename V4L2SubdeviceFormatInfo - libcamera: v4l2_subdevice: Add code member to MediaBusFormatInfo - libcamera: v4l2_subdevice: Expose media bus format info as internal API - libcamera: v4l2_subdevice: Extend MediaBusFormatInfo with metadata formats - libcamera: v4l2_subdevice: Drop V4L2SubdeviceFormat::bitsPerPixel() - libcamera: v4l2_subdevice: Rename V4L2SubdeviceFormat::mbus_code to code - libcamera: v4l2_subdevice: Add stream support to get/set functions - libcamera: v4l2_subdevice: Replace Routing::toString() with operator<<() - libcamera: v4l2_subdevice: Add V4L2Subdevice::Route structure - libcamera: camera_sensor: Move related classes to subdirectory - libcamera: camera_sensor: Drop updateControlInfo() function - libcamera: camera_sensor: Reorder functions - libcamera: camera_sensor: Test for read-only HBLANK with READ_ONLY flag - libcamera: camera_sensor: Expose the Bayer order - checkstyle: Work around bug in difflib - utils: tuning: readme: Improve names of dependency packages - libcamera: internal: Move dma_heaps.[h, cpp] to common directories - libcamera: dma_heaps: extend DmaHeap class to support system heap - libcamera: internal: Move SharedMemObject class to a common directory - libcamera: shared_mem_object: Rename SIZE constant to `size' - libcamera: shared_mem_object: Reorganize the code and document the SharedMemObject class - libcamera: software_isp: Add SwStatsCpu class - libcamera: software_isp: Add Debayer base class - libcamera: software_isp: Add DebayerCpu class - libcamera: Introduce SoftwareIsp - libcamera: swstats_cpu: Add support for 8, 10 and 12 bpp unpacked bayer input - libcamera: debayer_cpu: Add support for 8, 10 and 12 bpp unpacked bayer input - libcamera: debayer_cpu: Add BGR888 output support - libcamera: Add "Software ISP benchmarking" documentation - libcamera: software_isp: Apply black level compensation - Documentation: coding-style: Clean up header guard style - utils: checkstyle.py: Use r'' strings for regular expressions - utils: checkstyle.py: Drop period at end of Doxygen one liners - libcamera: device_enumerator: Fix spell error - libcamera: Fix output spelling error - libcamera: utils: Avoid infinite recursion with strtod() - libcamera: shared_mem_object: Fix compilation with uClibc - meson: Deprecate bitwise operations between different enumeration type - Revert "meson: Deprecate bitwise operations between different enumeration type" - test: Don't add current build directory to include path - libcamera: controls: Generate enum value-name maps - libcamera: Drop file name from header comment blocks - libcamera: Drop file name from header comment blocks in templates - libcamera: Drop remaining file name from header comment blocks - test: gstreamer: Simplify single stream test - Documentation: Add option to treat Doxygen warnings as errors - libcamera: camera_manager: Add environment variable to order pipelines match - include: linux: Add RGB48 formats - libcamera: formats: Add RGB48 formats - include: linux: Add PiSP specific image and config buffer formats - libcamera: formats: Add PiSP specific image and config buffer formats - libcamera: v4l2_subdevice: Add missing MEDIA_BUS_FMT_xxxx16_1X16 info pipeline: - pipeline: rpi: Always initialize the embedded buffer in tryRunPipeline - pipeline: rpi: vc4: Use an unpacked format if no packed one is available - pipeline: simple: Add support for MediaTek MT8365 platforms - libcamera: pipeline: Add Mali-C55 ISP pipeline - libcamera: pipeline: simple: fix size adjustment in validate() - libcamera: pipeline: simple: Rename converterBuffers_ and related vars - libcamera: pipeline: simple: Enable use of Soft ISP and Soft IPA - ipu3: Use posix basename - pipeline: rpi: Avoid duplicating size range for the same pixel format - libcamera: pipeline: Rename pipelines to a shorter name - libcamera: pipeline: Add a get factory by name helper ipa: - libipa: camera_sensor_helper: Mark createInstance() with override - utils: ipc: extract-docs: Fix escape characters in regex - ipa: rkisp1: agc: Wrap variable length C arrays in spans - ipa: rkisp1: Store hardware parameters in IPA context - ipa: rkisp1: Fix histogram weights configuration - ipa: rkisp1: Support the i.MX8MP ISP version - ipa: rpi: cam_helper: Extend embedded data parsing to RAW14 modes - utils: ipc: Fix event functions with no parameters - utils: ipc: Fix async main interface functions with no parameters - libcamera: ipa: Add Soft IPA - libcamera: libipa: camera_sensor: Add Sony IMX283 sensor properties - libcamera: libipa: camera_sensor: Add Sony IMX335 sensor properties - libcamera: libipa: camera_sensor: Add Sony IMX415 sensor properties - ipa: libipa: Allow creation of empty Histogram - ipa: libipa: Add ExposureModeHelper - ipa: libipa: Add AgcMeanLuminance base class - ipa: ipu3: Derive ipu3::algorithms::Agc from AgcMeanLuminance - ipa: ipu3: Remove bespoke AGC functions from IPU3 - ipa: rkisp1: Derive rkisp1::algorithms::Agc from AgcMeanLuminance - ipa: rkisp1: Remove bespoke Agc functions - ipa: libipa: histogram: Add transform parameter to constructor - ipa: rpi: Fix for incorrectly reported max shutter speed - ipa: rkisp1: agc: Fix histogram construction - ipa: libipa: histogram: Fix documentation of constructor - ipa: rpi: Add HDR support - ipa: rpi: Add accessor function for monoSensor_ apps: - gstreamer: Add meson devenv support - apps: common: dng_writer: Add a default case for switch-case on a modulo - doc: gstreamer: Add missing queues - gstreamer: Map R8/R16 pixel format - gstreamer: Map 10/12/14/16 bayer formats supports - cam: capture_script: Make parseRectangles work for non-array - apps: lc-compliance: Check that requests complete successfully - apps: lc-compliance: Fix typo in comment - apps: lc-compliance: Re-organize source directory - android: camera_device: Save capture settings unconditionally - v4l2: Unset _TIME_BITS in addition to _FILE_OFFSET_BITS - v4l2: meson: Keep defines sorted alphabetically - apps: cam: Add support for PPM output format - android: camera_device: Always clear descriptors_ in stop() - apps: cam: Fix C++20 deprecation warning - apps: qcam: Use standard key sequence for quit action - gstreamer: Fix string memory leak - gstreamer: Use copied camera name Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16ipa: rpi: Add accessor function for monoSensor_Naushir Patuck
The monoSensor_ member variable will be used by the derived IPAs in an upcoming commit, so add an accessor function for it. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16ipa: rpi: Add HDR supportNaushir Patuck
Add support for the following HDR modes in the Raspberry Pi IPA: - Night mode - Single exposure mode - Multi-exposure (merged and unmerged) The algorithm is updated to expect the HDR short channel to meter explicitly for highlights. This means that it will not in general under-expose the short channel more than is actually necessary. When images don't have much saturation, it's good to detect this so that some of the boost we want to apply to the dark areas can be implemented as regular gain. This means we can then adjust the tone curve less, leading to less flat looking images. The impact on the HDR algorithm is then that this determines how we build tonemaps dynamically. The highlights are more-or-less correct now, so we have to build a power-type curve that gives us the appropriately configured targets in the lower part of the histogram. We allow the tuning file to supply the maximum spatial gain value, rather than the whole curve (though it can supply this if it wants). Some parameter defaults are tweaked to be generally better across the range of our cameras. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Acked-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16libcamera: v4l2_subdevice: Add missing MEDIA_BUS_FMT_xxxx16_1X16 infoNaushir Patuck
Add the missing 16-bit MEDIA_BUS_FMT_xxxx16_1X16 definitions to the mediaBusFormatInfo table. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16libcamera: formats: Add PiSP specific image and config buffer formatsNaushir Patuck
Add the Raspberry Pi 5 PiSP specific compressed Bayer format types 1/2: - V4L2_PIX_FMT_PISP_COMP1_xxx - V4L2_PIX_FMT_PISP_COMP2_xxx Add the Raspberry Pi 5 PiSP Frontend and Backend config formats: - V4L2_META_FMT_RPI_FE_CFG - V4L2_META_FMT_RPI_BE_CFG Add the Raspberry Pi 5 PiSP Frontend statistics format: - V4L2_META_FMT_RPI_FE_STATS 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: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16include: linux: Add PiSP specific image and config buffer formatsNaushir Patuck
Add the Raspberry Pi 5 PiSP specific compressed Bayer format types 1/2: - V4L2_PIX_FMT_PISP_COMP1_xxx - V4L2_PIX_FMT_PISP_COMP2_xxx Add the Raspberry Pi 5 PiSP Frontend and Backend config formats: - V4L2_META_FMT_RPI_FE_CFG - V4L2_META_FMT_RPI_BE_CFG Add the Raspberry Pi 5 PiSP Frontend statistics format: - V4L2_META_FMT_RPI_FE_STATS The corresponding changes submitted to the linux-media mailing list can be found at: (series "media: raspberrypi: Add support for PiSP Back End") https://lore.kernel.org/linux-media/20240502110503.38412-4-jacopo.mondi@ideasonboard.com/ https://lore.kernel.org/linux-media/20240502110503.38412-5-jacopo.mondi@ideasonboard.com/ and for the DRM mailing at: (patch "[RFC] drm/fourcc: Add RPI modifiers") https://lore.kernel.org/dri-devel/20240226153854.99471-1-jacopo.mondi@ideasonboard.com/ 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: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16libcamera: formats: Add RGB48 formatsNaushir Patuck
Add support for 16-bps (48-bpp) RGB output formats to libcamera. These new formats are defined for the RGB and BGR ordering. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-16include: linux: Add RGB48 formatsNaushir Patuck
Add support for 16-bps (48-bpp) RGB output formats in the uapi headers. These new formats are defined for the RGB and BGR ordering. The corresponding change submitted to the linux-media and DRM mailing lists can be found at: https://lore.kernel.org/linux-media/20240502110503.38412-3-jacopo.mondi@ideasonboard.com/ and https://lore.kernel.org/dri-devel/20240226132544.82817-1-jacopo.mondi@ideasonboard.com/ respectively. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-14libcamera: camera_manager: Add environment variable to order pipelines matchJulien Vuillaumier
To match the enumerated media devices, each registered pipeline handler is used in no specific order. It is a limitation when several pipelines can match the devices, and user has to select a specific pipeline. For this purpose, environment variable LIBCAMERA_PIPELINES_MATCH_LIST is created to give the option to define an ordered list of pipelines to match on. LIBCAMERA_PIPELINES_MATCH_LIST="<name1>[,<name2>[,<name3>...]]]" Example: LIBCAMERA_PIPELINES_MATCH_LIST="rkisp1,simple" Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-05-14libcamera: pipeline: Add a get factory by name helperJulien Vuillaumier
Add a static helper to the PipelineHandlerFactoryBase class to allow retrieving a pipeline by name. Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>