summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2 dayslibcamera: rkisp1: Create main buffer pool out of if(!isRaw)HEADmasterJacopo 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>
2 dayslibcamera: 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>
2 dayslibcamera: 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>
2 dayslibcamera: 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>
2 daysgstreamer: 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>
2 daysgstreamer: 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>
2 daysgstreamer: 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>
2 daysv4l2: 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>
2 daystest: py: LD_PRELOAD the C++ standard library when using ASanLaurent Pinchart
When the ASan runtime is linked using --as-needed, its dependency on the C++ standard library is stripped. This results to a failure to properly handled exceptions when a C++ dynamically loaded .so is used, as in the Python unit tests that load the libcamera Python module: AddressSanitizer: CHECK failed: asan_interceptors.cpp:335 "((__interception::real___cxa_throw)) != (0)" (0x0, 0x0) (tid=32679) #0 0x7fa2f32e6c19 in CheckUnwind /var/tmp/portage/sys-devel/gcc-13.3.1_p20241025/work/gcc-13-20241025/libsanitizer/asan/asan_rtl.cpp:69 #1 0x7fa2f330c9fd in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /var/tmp/portage/sys-devel/gcc-13.3.1_p20241025/work/gcc-13-20241025/libsanitizer/sanitizer_common/sanitizer_termination.cpp:86 #2 0x7fa2f3247824 in __interceptor___cxa_throw /var/tmp/portage/sys-devel/gcc-13.3.1_p20241025/work/gcc-13-20241025/libsanitizer/asan/asan_interceptors.cpp:335 #3 0x7fa2f3247824 in __interceptor___cxa_throw /var/tmp/portage/sys-devel/gcc-13.3.1_p20241025/work/gcc-13-20241025/libsanitizer/asan/asan_interceptors.cpp:334 #4 0x7fa2efb6da8b in operator() ../../src/py/libcamera/py_main.cpp:157 [...] The issue has been reported in [1] and so far remains unfixed. Work around it by preloading the C++ standard library. [1] https://github.com/google/sanitizers/issues/934 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2 daystest: py: Replace environment array with environment objectLaurent Pinchart
The environment for pyunittests is stored in an array. Meson provides an environment object, which makes handling of multi-value environment variables easier and increases code clarity. Switch to using the environment object. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2 daystest: py: Fix log level restore in SimpleTestMethods()Laurent Pinchart
The SimpleTestMethods() function tests that incorrect calls to the Camera.acquire() method raise an exception. Before doing so, it sets the log level for the Camera category to FATAL, in order to avoid showing misleading errors in the test log, and then restores the log level to ERROR after running the test. ERROR is however not the default log level. Restore the log level to INFO instead, in order to avoid losing log messages in subsequent tests. Fixes: 06cb7130c4fa ("py: Add unittests.py") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
3 daysutils: checkstyle.py: Centralize dependency handling for checkersLaurent Pinchart
The checkstyle.py script depends on external tools. Those dependencies are handled in different ways in different parts of the code. Centralize the management of checker-specific dependencies to simplify the checkers and output more consistent error messages. This fixes a crash in the Pep8Formatter class when the autopep8 dependency is not found. Fixes: 8ffaf376bb53 ("utils: checkstyle: Add a python formatter") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
3 daysutils: checkstyle.py: Print issues using __str__Laurent Pinchart
CommitIssue and StyleIssue classes have different string representations, which are handled by type-specific print() calls in the code that handles the issues. This requires the user to know which type of issue it is dealing with. Simplify that by moving the string representation logic to a __str__() method. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
3 daysutils: checkstyle.py: Turn check() into a class method for all checkersLaurent Pinchart
The check() method of StyleChecker subclasses are instance methods, while CommitChecker subclasses use class methods. This makes unified handling of checkers more complicated. Turn the StyleChecker check() method into a class method, passing it the contents to be checked directly. While at it, fix two style issues reported by checkstyle.py. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
3 daysutils: checkstyle.py: Factor out common code to new CheckerBase classLaurent Pinchart
The CommitChecker, StyleChecker and Formatter classes duplicate code. Create a new CheckerBase class to factor out common code. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
3 daysgstreamer: 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>
3 dayspipeline: 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>
3 dayspipeline: 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>
3 dayspipeline: 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>
3 dayspipeline: 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>
3 dayspipeline: 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>
3 dayspipeline: 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>
3 dayscontrols: 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>
10 dayslibcamera: 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>
10 daysipa: 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>
14 daysqcam: 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-18libcamera: tracepoints: Fix copyright year for reproducible buildsBernhard M. Wiedemann
The tracepoints.h file is generated from the tracepoints.h.in template by the gen-tp-header.py script. The template contains a {{year}} placeholder for the copyright year, which the script fills with the current year. This breaks reproducible builds with at least the openSUSE debugsource package. As the gen-tp-header.py script doesn't add any copyrightable contents to the tracepoints.h file, fix this by replacing the {{year}} placeholder with the year of the last copyright-worthy change to tracepoints.h.in. Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@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-18libcamera: controls: Add missing size to control_type<Point>Stefan Klug
The size member is missing in control_type<Point>. This did not do any harm because the only control using the Point type was an array control. As soon as a control-id with a non-array Point control gets defined, the compile fails with: error: size is not a member of libcamera::details::control_type<libcamera::Point> 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>
2024-10-18ipa: rkisp1: algorithms: agc: 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_AUTOEXP bit to prevent using invalid or outdated data. As it doesn't happen regularly add an error message to get notified when it happens. 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-18libcamera: MappedFrameBuffer: Fix typo in comment formattingPaul Elder
Fix typo in comment block formatting. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-15libcamera: rkisp1: Maintain alphabetical order of forward declarationsUmang Jain
Alphabetical order of Forward declarations should be maintained hence, 'class V4L2Subdevice' should come after 'class SensorConfiguration'. Fix it. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-10-15libcamera: rkisp1: Rectify SensorConfiguration checkUmang Jain
The 'found' flag was mistakenly understood that a compatible sensor format has been found when a sensor configuration is passed in. However, 'found' related to the stream configuration's pixelformat, whether it is supported by the RkISP1Path video node or not. It does not relate to the sensor format, hence the check: if (sensorConfig && !found) doesn't make sense. Rectify the above check with: if (sensorConfig && !rawFormat.isValid()) to ensure a sensor format compatible with sensor configuration has been set to rawFormat. Fixes: 047d647452c4 ("libcamera: rkisp1: Integrate SensorConfiguration support") Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-10-15libcamera: rkisp1: Use const reference for sensor configurationUmang Jain
User-provided sensor configuration is never meant to be altered, hence pass SensorConfiguration by `const` reference in RkISP1Path::validate(). Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2024-10-09gitignore: Add venv directory to gitignoreStefan Klug
The python venv module is the standard way of creating virtual python environments. 'venv' is a commonly used name for the corresponding directory. For example in the tuning docs we propose to execute 'python -m venv venv' to setup a local virtual environment. During development I often have these scattered around in the source tree and they show up as untracked files in git. Add venv to .gitignore to prevent that. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-10-09libcamera: rkisp1: Clamp stream configuration to ISP limit on raw pathUmang Jain
Commit 761545407c76 ("pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline") introduced a mechanism to determine maximum supported sensor resolution and filter out resolutions that cannot be supported by the ISP. However, it missed to update the raw stream configuration path, where it should have clamped the raw stream configuration size to the maximum sensor supported resolution. This patch fixes the above issue and can be confirmed with IMX283 on i.MX8MP: From: ($) cam -c1 -srole=raw,width=5472,height=3072 INFO Camera camera.cpp:1197 configuring streams: (0) 5472x3648-SRGGB12 ERROR RkISP1 rkisp1_path.cpp:425 Unable to configure capture in 5472x3648-SRGGB12 Failed to configure camera Failed to start camera session To: ($) cam -c1 -srole=raw,width=5472,height=3072 INFO Camera camera.cpp:1197 configuring streams: (0) 4096x3072-SRGGB12 cam0: Capture until user interrupts by SIGINT 536.082380 (0.00 fps) cam0-stream0 seq: 000000 bytesused: 25165824 536.182378 (10.00 fps) cam0-stream0 seq: 000001 bytesused: 25165824 536.282375 (10.00 fps) cam0-stream0 seq: 000002 bytesused: 25165824 ... Fixes: 761545407c76 ("pipeline: rkisp1: Filter out sensor sizes not supported by the pipeline") Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
2024-10-09libcamera: rkisp1: Integrate SensorConfiguration supportUmang Jain
Integrate the RkISP1 pipeline handler to support sensor configuration provided by applications through CameraConfiguration::sensorConfig. The SensorConfiguration must be validated on both RkISP1Path (mainPath and selfPath), so the parameters of RkISP1Path::validate() have been updated to include sensorConfig. The camera configuration will be marked as invalid when the sensor configuration is supplied, if: - Invalid sensor configuration (SensorConfiguration::isValid()) - Bit depth not supported by RkISP1 pipeline - Sensor configuration output size is larger than maximum supported sensor's size on RkISP1 pipeline - No matching sensor configuration output size supplied by the sensor Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Tested-by: Stefan Klug <stefan.klug@ideasonboard.com>