summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
3 dayslibcamera: add DmaBufAllocator::exportBuffers()Harvey Yang
Add a helper function exportBuffers in DmaBufAllocator to make it easier to use. It'll be used in Virtual Pipeline Handler and SoftwareIsp. Signed-off-by: Harvey Yang <chenghaoyang@chromium.org> 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>
4 daysipa: rpi: awb: Disable CT search bias for Grey World AWBNaushir Patuck
If grey world AWB is setup in the tuning file, the CT curve will either be missing or invalid. Disable biasing the statistics for the search in such cases. Fixes: ea8fd63d936f ("ipa: rpi: awb: Add a bias to the AWB search") Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
4 daysipa: rpi: Use centralised libipa helpersDaniel Scally
Use the centralised libipa helpers rather than open coding common functions. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
4 daysipa: rkisp1: Use centralised libipa helpersDaniel Scally
Use the centralised libipa helpers instead of open-coding common functions. Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
4 daysipa: ipu3: Use centralised libipa helpersDaniel Scally
Use the centralised libipa helpers instead of open coding common functions. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
4 daysipa: libipa: Add colour helpersDaniel Scally
We start to have some functions relating to colour that are effectively identical crop up across the IPA modules. Add a file allowing those to be centralised within libipa so that a single implementation can be used in all of the IPAs. Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 dayslibcamera: yaml_parser: Use std::from_chars()Laurent Pinchart
std::from_chars(), introduced in C++17, is a fast, locale-independent string-to-arithmetic conversion function. The C++ standard library provides overloads for all integer types, making it a prime candidate to replace the manual handling of integer sizes in the YamlParser string to integer conversion. Compared to std::strtol(), std::from_chars() doesn't recognize the '0x' prefix or '+' prefix, and doesn't ignore leading white space. As the YamlParser doesn't require those features, std::from_chars() can be used safely, reducing the amount of code. C++17 also requires the standard C++ library to provide overloads for floating-point types, but libc++ does not implement those. The float and bool implementations of YamlParser::Getter::get() are therefore kept as-is. 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>
10 daysipa: libipa: Add data accessor to HistogramStefan Klug
For debugging purposes it is helpful to access the internal data of the histogram. Add an accessor for that. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 daysipa: rkisp1: Add debug metadata support to the rkisp1Stefan Klug
Add a DebugMetadata helper to the context and add the corresponding plumbing. This is all that is needed to support debug metadata in an IPA. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 daysipa: rkisp1: Add constructor to the ipa contextStefan Klug
Initialization using the initializer list is cumbersome and requires modifications to the list whenever the context is modified. Fix that by adding a proper constructor to the context. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
10 dayslibcamera: Add a DebugMetadata helperStefan Klug
Debug metadata often occurs in places where the metadata control list is not available e.g. in queueRequest() or processStatsBuffer() or even in a class far away from the metadata handling code. It is therefore difficult to add debug metadata without adding lots of boilerplate code. This can be mitigated by recording the metadata and forwarding it to the metadata control list when it becomes available. To solve the issue of code that is far away from the metadata context, add a chaining mechanism to allow loose coupling at runtime. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 dayslibcamera: Add debug control spaceStefan Klug
Add a new 'debug' controls namespace for the upcoming implementation of debug metadata. While at it, sort the entries alphabetically. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
11 daysCameraManager: Ensure we cleanup on failureKieran Bingham
If the CameraManager fails to initialise at startup during CameraManager::Private::init(), then the run() function will prepare the thread for operations, but the thread will immediately close without executing any cleanup. This can leave instantiated objects such as the EventNotifier registered by the udev enumerator constructed in a thread which no longer exists. The destructor of those objects can then fire an assertion that they are being executed from an incorrect thread while performing their cleanup. Ensure that the failure path does not result in reporting thread ownership assertions by performing cleanup correctly on the CameraManager thread before it closes. Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
12 dayslibcamera: Rationalize IPA and handlers namesJacopo Mondi
The names used by the IPA interface and the names used for buffer completions handlers in libcamera clash in the use of the term "buffer". For example video device buffer completion handler is called "bufferReady" and the IPA event to ask the IPA to compute parameters are called "fillParamsBuffers". This makes it hard to recognize which function handles video device completion signals and which ones handle the IPA interface events. Rationalize the naming scheme in the IPA interface function and events and the signal handlers in the pipelines, according to the following table. Remove the name "buffer" from the IPA interface events and events handler and reserve it for the buffer completion handlers. Rename the IPA interface events and function to use the 'params' and 'stats' names as well. IPA Interface: - fillParamsBuffer -> computeParams [FUNCTION] - processStatsBuffer -> processStats [FUNCTION] - paramFilled -> paramsComputed [EVENT] Pipeline handler: - bufferReady -> videoBufferReady [BUFFER HANDLER] - paramReady -> paramBufferReady [BUFFER HANDLER] - statReady -> statBufferReady [BUFFER HANDLER] - paramFilled -> paramsComputed [IPA EVENT HANDLER] Cosmetic change only, no functional changes intended. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-08libcamera: software_isp: Clean up pending requests on stopMilan Zamazal
PipelineHandler::stop() calls stopDevice() method to perform pipeline specific cleanup and then completes waiting requests. If any queued requests remain, an assertion error is raised. Software ISP stores request buffers in SimpleCameraData::conversionQueue_ and queues them as V4L2 signals bufferReady. stopDevice() cleanup forgets to clean up the buffers and their requests from conversionQueue_, possibly resulting in the assertion error. This patch fixes the omission. The problem wasn't very visible when SimplePipelineHandler::kNumInternalBuffers (the number of buffers allocated in V4L2) was equal to the number of buffers exported from software ISP. But when the number of the exported buffers was increased by one in commit abe2ec64f9e4e97bbdfe3a50372611bd7b5315c2, the assertion error started pop up in some environments. Increasing the number of the buffers much more, e.g. to 9, makes the problem very reproducible. Each pipeline uses its own mechanism to track the requests to clean up and it can't be excluded that similar omissions are present in other places. But there is no obvious way to make a common cleanup for all the pipelines (except for doing it instead of raising the assertion error, which is probably undesirable, in order not to hide incomplete pipeline specific cleanups). Bug: https://bugs.libcamera.org/show_bug.cgi?id=234 Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-11-08libcamera: simple: Track requests in conversionQueue_Milan Zamazal
Simple pipeline retrieves the requests to complete from the conversionQueue_. This patch stores the requests in conversionQueue_ explicitly. This explicit tracking is supposed to be preferred to implicit retrieval and it simplifies the completion code a bit here and in the followup patch that adds request cleanup on stop. The change as implemented assumes that all the buffers in each of the conversionQueue_ elements point to the same request, the one specified. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Tested-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-11-08libcamera: pipeline_handler: Provide cancelRequestMilan Zamazal
Let's extract the two occurrences of canceling a request to a common helper. This is especially useful for the followup patch, which needs to cancel a request from outside. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-11-05libcamera: rkisp1: Create main buffer pool out of if(!isRaw)Jacopo Mondi
The "useDewarper_" class variable is set to true during configure only if the configuration is !isRaw. The main path buffer pool creation can thus be moved out of the if (!isRaw) block at allocateBuffers() time. Cosmetic change that will make it easier to create a buffer pool for the main and self paths unconditionally in future. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2024-11-05libcamera: camera_sensor: Sort factories by priorityLaurent Pinchart
In order to support a default implementation for camera sensors when no better implementation matches, libcamera needs to try "specialized" implementations first and pick the default last. Make this possible by adding a priority value for factories. Newly registered factories are inserted in the factories list sorted by descending priority, and the default factory uses a negative priority to be inserted as the last element. This mechanism may be a bit overkill in the sense that there is no expected use cases for priorities other than trying the default last, but the implementation is simple and easy to understand. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-11-05libcamera: camera_sensor: Create abstract base classLaurent Pinchart
With a camera sensor factory in place, the next step is to create an abstract base class that all camera sensors implement, providing a uniform API to pipeline handler. Turn all public functions of the CameraSensor class into pure virtual functions, and move the implementation to the CameraSensorLegacy class. Part of the code is likely worth keeping as common helpers in a base class. However, to follow the principle of not designing helpers with a single user, this commit moves the whole implementation. Common helpers will be introduced later, along with other CameraSensor subclasses. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-11-05libcamera: camera_sensor: Introduce CameraSensorFactoryJacopo Mondi
Introduce a factory to create CameraSensor derived classes instances by inspecting the sensor media entity name and provide a convenience macro to register specialized sensor handlers. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05gstreamer: Generate controls from control_ids_*.yaml filesJaslo Ziska
This commit implements gstreamer controls for the libcamera element by generating the controls from the control_ids_*.yaml files using a new gen-gst-controls.py script. The appropriate meson files are also changed to automatically run the script when building. The gen-gst-controls.py script works similar to the gen-controls.py script by parsing the control_ids_*.yaml files and generating C++ code for each exposed control. For the controls to be used as gstreamer properties the type for each control needs to be translated to the appropriate glib type and a GEnumValue is generated for each enum control. Then a g_object_install_property(), _get_property() and _set_property() function is generated for each control. The vendor controls get prefixed with "$vendor-" in the final gstreamer property name. The C++ code generated by the gen-gst-controls.py script is written into the template gstlibcamerasrc-controls.cpp.in file. The matching gstlibcamerasrc-controls.h header defines the GstCameraControls class which handles the installation of the gstreamer properties as well as keeping track of the control values and setting and getting the controls. The content of these functions is generated in the Python script. Finally the libcamerasrc element itself is edited to make use of the new GstCameraControls class. The way this works is by defining a PROP_LAST enum variant which is passed to the installProperties() function so the properties are defined with the appropriate offset. When getting or setting a property PROP_LAST is subtracted from the requested property to translate the control back into a libcamera::controls:: enum variant. Signed-off-by: Jaslo Ziska <jaslo@ziska.de> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05gstreamer: Remove auto-focus-mode property from libcamerasrcJaslo Ziska
In preparation for generic support of all libcamera controls, remove the manual handling of the auto-focus-mode property from the libcamerasrc element. Signed-off-by: Jaslo Ziska <jaslo@ziska.de> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05gstreamer: Remove auto-focus-mode property from device providerJaslo Ziska
The device provider is not supposed to have control properties, remove the auto-focus-mode property which was introduced by accident. Fixes: 5a142438b025 ("gstreamer: Add enable_auto_focus option to the GStreamer plugin") Signed-off-by: Jaslo Ziska <jaslo@ziska.de> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05v4l2: v4l2_camera_proxy: Fix VIDIOC_[GS]_PARM supportLaurent Pinchart
v4l2-compliance reports an error due to VIDIOC_S_PARM being supported without VIDIOC_G_PARM. Fix it by implementing VIDIOC_G_PARM. To satisfy all compliance tests, VIDIOC_S_PARM also needs to be updated to properly zero reserved fields. Fixes: 5456e02d3f5b ("v4l2: Support setting frame rate in the V4L2 Adaptation layer") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-11-04gstreamer: Implement caps negotiation for video/x-bayerJohannes Kirchmair
The parsing of video/x-bayer sources from string makes it possible to use cameras providing e.g SGRBG8 streams via gst-launch. Like: gst-launch-1.0 libcamerasrc camera-name=<cam> ! video/x-bayer,format=grbg Without this change the gstreamer plugin complains about "Unsupported media type: video/x-bayer". Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Johannes Kirchmair <johannes.kirchmair@skidata.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-04pipeline: rpi: Handler controls::rpi::ScalerCropsNaushir Patuck
Handle multiple scaler crops being set through the rpi::ScalerCrops control. We now populate the cropParams_ map in the loop where we handle the output stream configuration items. The key of this map is the index of the stream configuration structure set by the application. This will also be the same index used to specify the crop rectangles through the ScalerCrops control. CameraData::applyScalerCrop() has been adapted to look at either controls::ScalerCrop or controls::rpi::ScalerCrops. The latter takes priority over the former. If only controls::ScalerCrop is provided, the pipeline handler will apply the same scaler crop to all output streams. Finally return all crops through the same ScalerCrops control via request metadata. The first configure stream's crop rectangle is also returned via the ScalerCrop control in the request metadata. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-11-04pipeline: rpi: Pass ISP output index into platformSetIspCrop()Naushir Patuck
At this point, the index is unused, but will be in a future commit where we can set different crops on each ISP output. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-11-04pipeline: rpi: Track which ISP output is configured for a streamNaushir Patuck
Add a ispIndex field to CropParams that is used to track which ISP output (0/1) will be used for a given stream during configuration. Tracking this information is required for an upcoming change where crop rectangles can be specified for each configured stream. Currently, the value is fixed to 0. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-11-04pipeline: rpi: Introduce CameraData::CropParamsNaushir Patuck
In preparation for assigning separate crop windows for each stream, add a new CropParams structure that stores the existing ispCrop_ and ispMinCropSize_ as fields. Use a new std::map to store a CropParams structure where the map key is the index of the stream configuration in the CameraConfiguration vector. At preset, only a single CropParams structure will be set at key == 0 to preserve the existing crop handling logic. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-11-04pipeline: rpi: Pass crop rectangle as a parameter to platformSetIspCrop()Naushir Patuck
This will be required when we program separate crop values to each ISP output in a future commit. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-11-04pipeline: rpi: Remove CameraData::scalerCrop_Naushir Patuck
Do not cache the scalerCrop_ parameter. The cached value is used to update the request metadata, but since this is not an expensive operation (and can only occur once per frame), caching it is of limited value. This will simplify logic in a future commit where we can specify a crop per-output stream. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-11-04controls: rpi: Add a vendor rpi::ScalerCrops controlNaushir Patuck
Add a vendor control rpi::ScalerCrops that is analogous to the current core::ScalerCrop, but can apply a different crop to each configured stream. This control takes a span of Rectangle structures - the order of rectangles must match the order of streams configured by the application. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-28libcamera: formats: Change bytesPerGroup of RGB565 and RGB565_BE from 3 to 2Hou Qi
The RGB565 and RGB565_BE formats incorrectly specify a wrong value of 3 bytes per group of pixels, when they actually use 2. Fix them. Signed-off-by: Hou Qi <qi.hou@nxp.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>
2024-10-28ipa: libipa: Fix ExposureModeHelper function name in documentationLaurent Pinchart
Previous iterations of the ExposureModeHelper class had a setShutterGainLimits() function, which got renamed to setLimits(). The documentation still uses the old name. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-10-25qcam: Automatically select the camera if only one is availableStanislaw Gruszka
When only a single camera is available, showing the camera selection dialog is unnecessary. It's better to automatically select the available camera without prompting the user for input. Co-developed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.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-10-24libcamera: rkisp1: Plumb the dw100 dewarper as V4L2M2M converterUmang Jain
Plumb the dw100 dewarper as a V4L2M2M converter in the rkisp1 pipeline handler. If the dewarper is found, it is instantiated and buffers are exported from it, instead of RkISP1Path. Internal buffers are allocated for the RkISP1Path in case where dewarper is going to be used. The RKISP1 pipeline handler now supports scaler crop control through the converter. Register the ScalerCrop control for the cameras created in the RKISP1 pipeline handler. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2024-10-24libcamera: rkisp1: Prepare for additional camera controlsUmang Jain
Currently the rkisp1 pipeline handler only registers controls that are related to the IPA. This patch prepares the rkisp1 pipeline-handler to register camera controls which are not related to the IPA. Hence, introduce an additional ControlInfoMap for IPA controls. These controls will be merged together with the controls in the pipeline handler (introduced subsequently) as part of updateControls() and together will be registered during the registration of the camera. This is similar to what IPU3 pipeline handler handles its controls. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-24libcamera: converter: Add interface to support cropping capabilityUmang Jain
If the converter has cropping capability on its input, the interface should support it by providing appropriate virtual functions. Provide Feature::InputCrop in Feature enumeration for the same. Provide virtual setInputCrop() and inputCropBounds() interfaces so that the converter can implement its own cropping functionality. The V4L2M2MConverter implements these interfaces of the Converter interface. Not all V4L2M2M converters will have cropping ability on its input, hence it needs to be discovered at construction time. If the capability to crop is identified successfully, the cropping bounds are determined during configure() time. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-10-24libcamera: converter: Add interface for feature flagsUmang Jain
This patch intends to extend the converter interface to have feature flags, which enables each converter to expose the set of features it supports. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-21ipa: rpi: Add tuning files for OV7251Dave Stevenson
OV7251 is a mono VGA global shutter sensor that has a mainline driver and works with libcamera. Add the supporting files for it. The tuning is copied from OV9281. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-21py: Add bindings for ControlId vendor informationPaul Elder
Add python bindings for quering vendor information from a ControlId. While at it, update __repr__ so that it also prints the vendor. Example usage: >>> cid libcamera.ControlId(20, libcamera.Saturation, ControlType.Float) >>> cid.vendor 'libcamera' 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-10-21apps: cam: Print control vendor information when listing controlsPaul Elder
Now that the vendor of the control can be queried, print it in --list-controls. Example output: $ cam -c 1 --list-controls Using camera platform/vimc.0 Sensor B as cam0 Control: libcamera::Brightness: [-1.000000..1.000000] Control: libcamera::Contrast: [0.000000..2.000000] Control: libcamera::Saturation: [0.000000..2.000000] Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-21libcamera: controls: Add vendor information to ControlIdPaul Elder
Add vendor/namespace information to ControlId, so that the vendor can be queried from it. This is expected to be used by applications either simply to display the vendor or for it to be used for grouping in a UI. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-10-19libcamera: pipeline: rkisp1: Fix typo in todo taskKieran Bingham
The delay values should be managed correctly. Not the dealys. Correct accordingly. Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18libcamera: software_isp: Black level from tuning fileMilan Zamazal
This patch allows obtaining a black level from a tuning file in addition to the camera sensor helper. If both of them define a black level, the one from the tuning file takes precedence. The use cases are: - A user wants to use a different black level, for whatever reason. - There is a sensor without known gains but with a known black level. Because a camera sensor helper cannot be defined without specifying gains, the only way to specify the black level is using the tuning file. Software ISP uses its fallback gain handling in such a case. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18libcamera: software_isp: Get black level from the camera helperMilan Zamazal
The black level in software ISP is unconditionally guessed from the obtained frames. CameraSensorHelper optionally provides the black level from camera specifications now. Let's use the value if available. If the black level is not available from the given CameraSensorHelper instance, it's still determined on the fly. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Robert Mader <robert.mader@collabora.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18libcamera: software_isp: Clear IPA context on configure and stopRobert Mader
Like the hardware pipelines do. Not clearing frameContexts otherwise can trigger asserts like "Frame context for ... has been overwritten by ..." when switching between cameras using the swISP, e.g. on phones. Clearing the configuration and active state will become more important with upcoming changes such as getting the black level from the camera helper. Fixes: 04d171e6b299 ("libcamera: software_isp: Call Algorithm::queueRequest") Signed-off-by: Robert Mader <robert.mader@collabora.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18pycamera: Add missing code for ControlTypePointStefan Klug
In the python bindings ControlTypePoint is not handled in the corresponding conversion functions. Add that. While at it, sort the listings in the same order as the enum in controls.h. Fixes: 200d535ca85f ("libcamera: controls: Add ControlTypePoint") Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-18ipa: rkisp1: algorithms: awb: Check for correct stats typeStefan Klug
Sometimes the ISP produces statistics only with a subset of statistic types being valid. It doesn't happen normally, but was observed in the wild. Check for the RKISP1_CIF_ISP_STAT_AWB bit to prevent using invalid or outdated data. As it doesn't happen regularly add an error message to get notified when it happens. For simpler code structure, the ColourTemperature metadata entry gets written unconditionally and overwritten later if needed. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>