summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2024-03-15libcamera: v4l2_subdevice: Add V4L2Subdevice::Route structureLaurent Pinchart
The V4L2Subdevice class deals with streams in two places: - In routing tables, streams as expressed as a pad number and a stream number in a v4l2_subdev_route instance. - In the format and selection get and set functions, streams as expressed using the Stream structure, which binds the pad number and stream number. Expressing streams in different ways requires pipeline handlers and other helpers to convert between the two representations. This isn't much of an issue yet as libcamera has little stream-aware code, but it is expected to increasingly become a burden. To simplify the API, introduce a V4L2Subdevice::Route structure that mimicks the kernel v4l2_subdev_route structure but represents streams as V4L2Subdevice::Stream instances. This will improve seamless integration of routes, formats and selection rectangles. 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>
2024-03-15libcamera: v4l2_subdevice: Replace Routing::toString() with operator<<()Laurent Pinchart
The main (and only at the moment) use case for the Routing::toString() function is to print a representation of the routing table in a log message. The function is implemented using an std::stringstream, and the returned std::string is then inserted into an std::ostream. This is inefficient. Replace the function with a specialization of the operator<<() and use it in the caller. 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>
2024-03-15libcamera: v4l2_subdevice: Add stream support to get/set functionsLaurent Pinchart
Extend the V4L2Subdevice API with stream support for the functions that get and set formats and selection rectangles. Add a Stream structure to identify a subdev pad and stream, and use it to extend the V4L2Subdevice functions that get and set formats and selection rectangles with stream support. To preserve the existing pad-based API, implement overloaded functions that wrap the new stream-based API. This allows callers that are not stream-aware to use a simpler pad-based API, instead of having to explicitly set the stream number to 0 in all API calls. 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>
2024-03-15libcamera: v4l2_subdevice: Rename V4L2SubdeviceFormat::mbus_code to codeLaurent Pinchart
The V4L2SubdeviceFormat::mbus_code member doesn't follow the libcamera coding style as it should use camelCase. Fix it by renaming it to just 'code', to shorten lines in addition to fixing the coding style. 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>
2024-03-15libcamera: v4l2_subdevice: Drop V4L2SubdeviceFormat::bitsPerPixel()Laurent Pinchart
The V4L2SubdeviceFormat::bitsPerPixel() function is just a wrapper around a MediaBusFormatInfo lookup. It made sense when the MediaBusFormatInfo class was not exposed outside of the compilation unit, but is now redundant. Drop it and use MediaBusFormatInfo in the only caller. 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>
2024-03-15libcamera: v4l2_subdevice: Extend MediaBusFormatInfo with metadata formatsLaurent Pinchart
Not all media bus formats describe image formats. Extend the MediaBusFormatInfo class with a type member to indicate if the format corresponds to image data or metadata, and add the (only) metatdata format supported by the kernel to the known mediaBusFormatInfo. The kernel doesn't (yet) have any metadata format specific to sensor embedded data. This is being addressed in the V4L2 API. In preparation for embedded data support, already introduce the EmbeddedData type here. Corresponding formats will be added when available. 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>
2024-03-15libcamera: v4l2_subdevice: Expose media bus format info as internal APILaurent Pinchart
The V4L2SubdeviceFormatInfo structure, internal to the v4l2_subdevice.cpp compilation unit, contains information about media bus formats that will be useful in other parts of libcamera. To prepare for this, expose the structure in the v4l2_subdevice.h header and turn it into a class with a similar design as PixelFormatInfo. 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>
2024-03-15libcamera: v4l2_subdevice: Add code member to MediaBusFormatInfoLaurent Pinchart
To prepare for exposing the MediaBusFormatInfo structure as an internal API, add a code member to the structure to store the media bus code. This makes MediaBusFormatInfo usable standalone, without having to externally associate the code related to the info. The entries in the mediaBusFormatInfo map are becoming too long, so split them on multiple lines. While at it, swap the order of the members to match the PixelFormatInfo class for consistency. 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>
2024-03-15libcamera: v4l2_subdevice: Rename V4L2SubdeviceFormatInfoLaurent Pinchart
The V4L2SubdeviceFormatInfo structure contains information about a media bus format, not a V4L2 subdevice format. Rename it to MediaBusFormatInfo to clarify its purpose. Rename the formatInfoMap map accordingly. 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>
2024-03-12libcamera: controls: Add policy parameter to ControlList::merge()Stefan Klug
This is useful in many cases although not included in the stl. Note: This is an ABI incompatible change. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-03-12libcamera: framebuffer_allocator: Remove entry if allocation failsBarnabás Pőcze
Remove the entry from the `buffers_` mapping if `Camera::exportFrameBuffers()` fails, otherwise there would be a stale entry in the map. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.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-03-12libcamera: framebuffer_allocator: Use default destructorBarnabás Pőcze
The compiler generated destructor works fine, so use that. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.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-03-12libcamera: framebuffer_allocator: Move from argument in constructorBarnabás Pőcze
The single argument, of type `std::shared_ptr<Camera>`, is passed by value, so it can simply be moved from in order to avoid calling the copy constructor. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.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-03-11cam: capture_script: Make parseRectangles work for non-arrayPaul Elder
parseRectangles currently always parses Rectangle controls as an array of Rectangles. This causes non-array Rectangle controls to not be parsed correctly, as when the ControlValue is get()ed, the non-array assertion will fail. Set the ControlValue with a single Rectangle in case a single Rectangle has been specified in the yaml capture script to fix that. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-03-06ipa: rpi: cam_helper: Extend embedded data parsing to RAW14 modesNick Hollinghurst
Fix embedded data byte-skipping for 14-bit modes (4 out of 7 bytes carry register data), and allow 14-bit modes in IMX708 PDAF parsing. Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-03-06libcamera: v4l2_subdevice: Add 14-bit Bayer formatsNick Hollinghurst
Add MEDIA_BUS_FMT_SBGGR14_1X14 etc to formatInfoMap. Not adding any Y14 for now. Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-03-01libcamera: controls: Fix typo on thermalKieran Bingham
The documentation for the SensorTemperature control has a spelling mistake for thermal. Fix it. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-02-28pipeline: simple: Add support for MediaTek MT8365 platformsSuhrid Subramaniam
The camera pipeline for MediaTek MT8365 consists of the following: Raw sensor (+ external ISP) --> SENINF --> CAMSV30 --> DRAM SENINF (SENsor INterFace) is a CSI-2 receiver. CAMSV30 (Camera Simple Version) is a DMA Engine which bypasses ISP3.0 and writes directly to DRAM. Both SENINF and CAMSV30 are supported by V4L2 drivers. MT8365 platform consists of a hardware converter called MDP which supports up to three streams. Signed-off-by: Suhrid Subramaniam <suhrid.subramaniam@mediatek.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-02-28libcamera: formats: Fix planes bounds checkKieran Bingham
The plane validation in the stride helper incorrectly accepts the number of planes as a plane index. Fix the off by one issue. Fixes: e83727a194b5 ("libcamera: PixelFormatInfo: Add functions stride and frameSize") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-02-27libcamera: formats: Fix typos in PixelFormatInfo documentationLaurent Pinchart
The PixelFormatInfo documentation has typo. Fix two of them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-02-27libcamera: Use utils::to_underlying()Laurent Pinchart
Replace manual implementations of the utils::to_underlying() helper with calls to the function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2024-02-27libcamera: utils: Add to_underlying() helper functionLaurent Pinchart
C++23 has a std::to_underlying() helper function that converts an enumeration value to its underlying type. Add a compatible implementation to the libcamera::utils namespace. 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> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
2024-02-23ipa: rkisp1: Support the i.MX8MP ISP versionPaul Elder
Handle the RKISP1_V_IMX8MP version in the rkisp1 IPA. This enables basic support of the i.MX8MP, excluding the processing blocks specific to the new ISP version. Those will be supported later. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-02-23ipa: rkisp1: Fix histogram weights configurationLaurent Pinchart
The histogram weights are initialized to hardcoded 1's for each histogram grid cell. The code uses the wrong variable for the grid size, resulting in some weights having a 0 value. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-02-23ipa: rkisp1: Store hardware parameters in IPA contextLaurent Pinchart
Versions of the ISP differ in the processing blocks they include, as well as in the implementation of some of those blocks. In particular, they have different numbers of histogram bins oe AE statistics cells. The algorithms take these differences into account by checking the ISP version reported by the driver. These checks are currently scattered in multiple places. Centralize them in the IPARkISP1::init() function, and store the version-dependent hardware parameters in the IPA context, accessible by all algorithms. While at it, drop the IPASessionConfiguration::hw member that stores the revision number, unused by the algorithms. It can be added back laer to the IPAHwSettings structure if needed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-02-23ipa: rkisp1: agc: Wrap variable length C arrays in spansLaurent Pinchart
The RkISP1 statistics structure contains multiple arrays whose length varies depending on the hardware revision. Accessing those arrays is error-prone, wrap them in spans at the top level to reduce risks of out-of-bound accesses. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-02-23pipeline: rpi: vc4: Use an unpacked format if no packed one is availableDavid Plowman
When validating a stream, and no valid packed pixel format can be found, see if an unpacked format can be used instead. This is particularly helpful for 8 (and 16) bit raw formats, where asking for a packed format would previously have failed. Now the configuration will be adjusted to give you a format (in fact, the only format) that will work. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-02-02gstreamer: Map 10/12/14/16 bayer formats supportsNicolas Dufresne
These formats are now defined in upstream GStreamer main branch, so it is now safe to use their names. Note that libcamera only supports little endian variants of these formats. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-02-02gstreamer: Map R8/R16 pixel formatNicolas Dufresne
This enables monochrome support in libcamerasrc. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-01-25libcamera: object: Add and use thread-bound assertionLaurent Pinchart
Several functions in libcamera classes are marked as thread-bound, restricting the contexts in which those functions can be called. There is no infrastructure to enforce these restrictions, causing difficult to debug race conditions when they are not met by callers. As a first step to solve this, add an assertThreadBound() protected function to the Object class to test if the calling thread context is valid, and use it in member functions of Object subclasses marked as thread-bound. This replaces manual tests in a few locations. The thread-bound member functions of classes that do not inherit from Object are not checked, and neither are the functions of classes marked as thread-bound at the class level. These issue should be addressed in the future. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
2024-01-25libcamera: object: Document and ensure Object deletion constraintsLaurent Pinchart
Object instances are meant to be deleted from the thread they are bound to, and this requirement is documented. There are however exceptions to the rule, as threads may be stopped and restarted, with objects bound to them not being deleted and recreated for every stop/restart cycle. Bound objects may therefore need to be deleted after the thread has stopped, making it impossible to use Object::deleteLater(). Document the lifetime requirements more precisely, and enforce them with an assertion. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
2024-01-25libcamera: thread: Ensure deferred deletion of all objects before stoppingLaurent Pinchart
Objects can be scheduled for deletion with Object::deleteLater(), which queues a deferred deletion to the thread's event loop. As the deleteLater() function is meant to be called from a different thread, this may race with thread termination, and deferred deletions queued just before calling Thread::exit() may not be processed by the event loop. Make sure they get processed when finishing the thread, before stopping. This eliminates the race condition that occurs when calling Object::deleteLater() followed by Thread::exit() from the same thread. Calling deleteLater() from neither the thread the object is bound to or the thread calling Thread::exit() is still inherently racy. The change fixes a failure in the object-delete unit test. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
2024-01-25libcamera: signal: Replace object.h inclusion with forward declatationLaurent Pinchart
The signal.h header doesn't need to include object.h. Replace it with a forward declaration, and instead include object.h in source files that require it. It can speed up compilation a little bit, but more importantly avoids unintended dependencies from the Signal class to the Object class to be added later as the compiler will catch them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
2024-01-25libcamera: object: Fix thread-bound reference in documentationLaurent Pinchart
The Object::message() function is documented as thread-bound without using the correct \threadbound reference. Fix it to ensure it gets included in the thread safety context list. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
2024-01-24apps: common: dng_writer: Add a default case for switch-case on a moduloPaul Elder
Clearly all cases in the switch are already satisfied, but some compilers fail to realize this and spit out an error: Compiler version: gcc 11.2.0 "aarch64-buildroot-linux-gnu-gcc.br_real (Buildroot 2021.11) 11.2.0" ../../src/apps/common/dng_writer.cpp: In function ‘void thumbScanlineIPU3(const FormatInfo&, void*, const void*, unsigned int, unsigned int)’: ../../src/apps/common/dng_writer.cpp:277:55: error: ‘val4’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10; | ^~~~ ../../src/apps/common/dng_writer.cpp:277:48: error: ‘val3’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10; | ^~~~ ../../src/apps/common/dng_writer.cpp:277:41: error: ‘val2’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10; | ^~~~ ../../src/apps/common/dng_writer.cpp:277:34: error: ‘val1’ may be used uninitialized in this function [-Werror=maybe-uninitialized] 277 | uint8_t value = (val1 + val2 + val3 + val4) >> 10; | ^~~~ Add a default case for the switch-case on a modulo to silence this. Bug: https://bugs.libcamera.org/show_bug.cgi?id=207 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> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-01-23libcamera: v4l2_subdevice: Explain sort order of formatInfoMapKieran Bingham
The sort order used in the table isn't obvious. Reference the source of linux/media-bus-format.h at the top of the table for reference for future updates. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-23libcamera: bayer_format: Add Y12 to bayerToFormatKieran Bingham
Support for Mono 12-bit formats were added to the mbusCodeToBayer table without supplying the corresponding entry for converting the other way. Add the relevant entry to the bayerToFormat table. Fixes: ec6309571654 ("libcamera: bayer_format: Add unpacked mono 12-bit format to the conversion table") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-23libcamera: formats: Fix sort ordering of R10_CSI2PKieran Bingham
Move formats::R10_CSI2P to be grouped with the formats::R10 counterpart and keep the section of format declarations sorted in increasing bit depth. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-23libcamera: formats: Add 16-bit mono formatNaushir Patuck
Add the relevant definitions for a 16-bit mono pixel and media-bus format. 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: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-23libcamera: Remove empty formats.cLaurent Pinchart
Commit e0a51061bc69 ("libcamera: formats: Add 14-bits Bayer RAW formats") added an empty formats.c file by mistake (and we failed to catch it during review). Delete it. Fixes: e0a51061bc69 ("libcamera: formats: Add 14-bits Bayer RAW formats") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-23pipeline: rpi: Always initialize the embedded buffer in tryRunPipelineElias Naur
Vc4CameraData::findMatchBuffers() may return successfully with a null embedded buffer, in which case the embedded buffer id would be left uninitialized. Without this change, libcamera v0.2.0 usually crashes for me with an assertion error: ipa_base.cpp:397 assertion "it != buffers_.end()" failed in prepareIsp() Signed-off-by: Elias Naur <mail@eliasnaur.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-01-23gstreamer: Add meson devenv supportNicolas Dufresne
This change to the build system will prepend the plugin build directory to GST_PLUGIN_PATH environment. This makes the built plugin visible to GStreamer inside meson devenv enabling uninstalled testing. In order to avoid polluting the user registry, the GST_REGISTRY environment is also set. Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-22libcamera: base: signal: Update Qt documentation link to Qt 6Neal Gompa
The documentation is effectively the same, but we should be pointing to the actively supported and used Qt version. Signed-off-by: Neal Gompa <neal@gompa.dev> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-01-17libcamera: v4l2_subdevice: Enable streams API when supportedLaurent Pinchart
The streams API needs to be enabled explictly by setting a subdev client capability. Do so unconditionally for subdevs that expose streams support. We don't need any kernel version check to use the VIDIOC_SUBDEV_S_CLIENT_CAP ioctl, as it is guaranteed to be supported by kernels that support streams. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-12libipa: camera_sensor_helper: Mark createInstance() with overrideLaurent Pinchart
The CameraSensorHelperFactory::createInstance() function overrides a virtual function from CameraSensorHelperFactoryBase. The function declaration doesn't mark it with the override keyword. This could cause issues in the future if the base class' function changes, as the compiler will not issue any warning in that case. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09libcamera: geometry: Correct doxygen reference to classesDaniel Scally
The classes Rectangle, Size and SizeRange are referenced with \struct in the doxygen comments in geometry.cpp. Correct the reference to \class to better reflect their definition. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09ipa: rpi: vc4: data: Update tuning files for HDRDavid Plowman
All the Raspberry Pi official camera tuning files are updated for HDR. As stated previously, there is no mechanism in the hardware for combining images so all this does is enable multi-channel AGC to produce short and long exposure frames. It will be up to the application to deal with them. The changes are identical in every tuning file. 1. The existing AGC tuning is duplicated twice so that we have 3 AGC channels. 2. The first is left alone (the default AGC channel), the second is tweaked to under-expose significantly (ev -3) and the final one is tweaked to over-exposure slightly (ev +0.5) 3. Control parameters are provided to the "rpi.hdr" algorithm to associate these AGC channels correctly with the HDR modes. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09ipa: rpi: Implement HDR controlDavid Plowman
Sufficient plumbing is added so that the HDR mode control can be used to engage HDR modes on platforms that support them. On the vc4 platform, this allows multi-channel AGC to run, though there is no image merging. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09libcamera: framebuffer_allocator: Remove unnecessary `clear()`Barnabás Pőcze
The vector in question is destroyed when the item in the `buffers_` map is destroyed as a result of the `erase()` call. A vector's destructor already does all the things that `clear()` does, so calling it earlier is not needed. 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: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09libcamera: device_enumerator: ensure deviceNode is not emptyBenjamin Bara
When activating both ISP nodes on the i.MX8MP, but only connecting one camera sensor, libcamera aborts because it couldn't find the chosen entity's device node: [37:54:40.779902250] [3631] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media1: rkisp1 [37:54:40.780196750] [3631] DEBUG DeviceEnumerator device_enumerator_udev.cpp:322 All dependencies for media device /dev/media0 found [37:54:40.780237875] [3631] DEBUG DeviceEnumerator device_enumerator.cpp:252 Added device /dev/media0: rkisp1 [37:54:40.780505125] [3631] DEBUG Camera camera_manager.cpp:152 Found registered pipeline handler 'PipelineHandlerRkISP1' [37:54:40.780599875] [3631] DEBUG DeviceEnumerator device_enumerator.cpp:312 Successful match for media device "rkisp1" [37:54:40.780731375] [3631] ERROR V4L2 v4l2_device.cpp:93 'rkisp1_isp': Failed to open V4L2 device '': No such file or directory Fix this by skipping empty device nodes: [37:49:05.172672000] [3603] DEBUG DeviceEnumerator device_enumerator_udev.cpp:322 All dependencies for media device /dev/media1 found [37:49:05.172720625] [3603] DEBUG DeviceEnumerator device_enumerator.cpp:256 Added device /dev/media1: rkisp1 [37:49:05.172973875] [3603] DEBUG DeviceEnumerator device_enumerator_udev.cpp:322 All dependencies for media device /dev/media0 found [37:49:05.173012125] [3603] DEBUG DeviceEnumerator device_enumerator.cpp:256 Added device /dev/media0: rkisp1 [37:49:05.173281625] [3603] DEBUG Camera camera_manager.cpp:152 Found registered pipeline handler 'PipelineHandlerRkISP1' [37:49:05.173376875] [3603] DEBUG DeviceEnumerator device_enumerator.cpp:107 Skip rkisp1_isp: no device node [37:49:05.173414375] [3603] DEBUG DeviceEnumerator device_enumerator.cpp:316 Successful match for media device "rkisp1" [37:49:05.173671250] [3603] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video1[15:cap]: Opened device platform:rkisp1: rkisp1: rkisp1_stats [37:49:05.173775125] [3603] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video2[16:out]: Opened device platform:rkisp1: rkisp1: rkisp1_params [37:49:05.173880500] [3603] DEBUG V4L2 v4l2_videodevice.cpp:632 /dev/video0[18:cap]: Opened device platform:rkisp1: rkisp1: rkisp1 Signed-off-by: Benjamin Bara <benjamin.bara@skidata.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>