summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
5 hoursipa: simple: Report exposure in metadataHEADmasterMilan Zamazal
Report exposure and gain in metadata. This is more complicated than it could be expected because the exposure value should be in microseconds but it's handled using V4L2_CID_EXPOSURE control, which doesn't specify the unit, see https://www.kernel.org/doc/html/latest/userspace-api/media/v4l/control.html. So the unit conversion is done in the way rkisp1 IPA uses. This requires getting and passing IPACameraSensorInfo around. To avoid naming confusion and to improve consistency with rkisp1 IPA, sensorCtrlInfoMap parameter is renamed to sensorControls. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
5 hoursipa: simple: Report contrast in metadataMilan Zamazal
Provide the requested contrast value, if any, in the metadata to add to the completed requests. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
5 hoursipa: simple: Report black levels in metadataKieran Bingham
Provide the determined black level values in the metadata to add to the completed requests. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
5 hoursipa: simple: Report the ColourGains in metadataKieran Bingham
Provide the determined colour gains back into the metadata to add to completed requests. 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> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
5 hoursipa: simple: softisp: Extend to pass metadataKieran Bingham
Extend the Simple IPA IPC to support returning a metadata ControlList when the process call has completed. A new signal from the IPA is introduced to report the metadata, similarly to what the hardware pipelines do. Merge the metadata reported by the ISP into any completing request to provide to the application. Completion of a request is delayed until this is done; this doesn't apply to canceled requests. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
5 hourslibcamera: software_isp: Track frames and requestsMilan Zamazal
Hardware pipelines track requests and other information related to particular frames. This hasn't been needed in software ISP so far. But in order to be able to track metadata corresponding to a given frame, frame-request tracking mechanism starts being useful. This patch introduces the basic tracking structure, actual metadata handling is added in the following patch. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> # Lenovo X13s Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
37 hoursipa: rksip1: Remove setControls(0) to reduce startup oscillationsStefan Klug
The call to setControls(0) is counter productive. At start() time, no requests were queued and no stats were received. So setControls(0) accesses a zeroed frame context and in turn sends 0 as gain, exposure and vblank to the pipeline handler and DelayedControls. This leads to strong oscillations on every start of the camera. A proper fix for handling the startup controls still needs to be done and was already started in [1] and [2]. From a DelayedControls point of view the call to setControls(0) is also unnecessary as DelayedControls treat frame 0 as already being queued in after initialization. So it is safe to just remove it and the removal fixes the zero effectiveExposureValue discussed in the previous patch for rkisp1. [1]: https://patchwork.libcamera.org/patch/21708/ [2]: https://patchwork.libcamera.org/patch/22445/ 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>
37 hoursipa: libipa: agc_mean_luminance: Error out when effectiveExposureValue is zeroStefan Klug
In a proper system it never happens that the effectiveExposureValue drops to zero. If that still happens due to a bug outside of agc_mean_luminance, the calculated gain goes towards infinity but the newExposureValue is still 0 because it is the result of multiplying the effectiveExposureTime with the gain, leading to wild oscillations. Catch that condition, print an error message and set the new effective exposure value to an arbitrary 10ms. Note that in any case the underlying problem must be fixed. The important change is the added error message to be able to detect such a situation. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
37 hoursipa: rkisp1: Add debug log for the sensor controls being setStefan Klug
In the algorithm code a lot of information is logged in debug log level, but there is no place where the values sent to the sensor get logged. Add such a log message. 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>
42 hourspipeline: rpi: pisp: Fix uninitialized variable warningLaurent Pinchart
gcc 13.3.0 from buildroot 2024.11.1 complains about an uninitialized variable. This is a false positive as the cfe_ array can't be empty. Nonetheless, it breaks builds, so initialize the variable to work around the issue. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
42 hoursipa: rkisp1: agc: Set measurement window to full frameStefan Klug
With the availability of metering modes and the corresponding weights, there is a flexible way of defining the area that gets taken into account when AEGC is calculated. There is no need to reduce that window to an arbitrary region anymore. If need arises we can make this parameter user configurable or add a control for it. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
42 hoursipa: rkisp1: agc: Fix metering modesStefan Klug
The weights for a given metering mode are applied to the histogram data inside the histogram statistics block. The AE statistics do not contain any weights. Therefore the weights are honored when AgcMeanLuminance calculates the upper or lower constraints, but ignored in the calculation of the frame luminance. Fix that by manually applying the weights in the luminance calculation. Fixes: 4c5152843a2a ("ipa: rkisp1: Derive rkisp1::algorithms::Agc from AgcMeanLuminance") Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
43 hourslibcamera: software_isp: Apply CCM in debayeringMilan Zamazal
This patch applies color correction matrix (CCM) in debayering if the CCM is specified. Not using CCM must still be supported for performance reasons. The CCM is applied as follows: [r1 g1 b1] [r] [r2 g2 b2] * [g] [r3 g3 b3] [b] The CCM matrix (the left side of the multiplication) is constant during single frame processing, while the input pixel (the right side) changes. Because each of the color channels is only 8-bit in software ISP, we can make 9 lookup tables with 256 input values for multiplications of each of the r_i, g_i, b_i values. This way we don't have to multiply each pixel, we can use table lookups and additions instead. Gamma (which is non-linear and thus cannot be a part of the 9 lookup tables values) is applied on the final values rounded to integers using another lookup table. Because the changing part is the pixel value with three color elements, only three dynamic table lookups are needed. We use three lookup tables to represent the multiplied matrix values, each of the tables corresponding to the given matrix column and pixel color. We use int16_t to store the precomputed multiplications. This seems to be noticeably (>10%) faster than `float' for the price of slightly less accuracy and it covers the range of values that sane CCMs produce. The selection and structure of data is performance critical, for example using bytes would add significant (>10%) speedup but would be too short to cover the value range. The color lookup tables can be represented either as unions, accommodating tables for both the CCM and non-CCM cases, or as separate tables for each of the cases, leaving the tables for the other case unused. The latter is selected as a matter of preference. The tables are copied (as before), which is not elegant but also not a big problem. There are patches posted that use shared buffers for parameters passing in software ISP (see software ISP TODO #5) and they can be adjusted for the new parameter format. Color gains from white balance are supposed not to be a part of the specified CCM. They are applied on it using matrix multiplication, which is simple and in correspondence with future additions in the form of matrix multiplication, like saturation adjustment. With this patch, the reported per-frame slowdown when applying CCM is about 45% on Debix Model A and about 75% on TI AM69 SK. Using std::clamp in debayering adds some performance penalty (a few percent). The clamping is necessary to eliminate out of range values possibly produced by the CCM. If it could be avoided by adjusting the precomputed tables some way then performance could be improved a bit. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> 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>
43 hourslibcamera: software_isp: Track whether CCM is enabledMilan Zamazal
Applying color correction matrix (CCM) in software ISP is optional due to performance reasons. CCM is applied if and only if `Ccm' algorithm is present in the tuning file. Software ISP debayering is a performance critical piece of code and we do not want to use dynamic conditionals there. Therefore we pass information about CCM application to debayering configuration and let it select the right versions of debayering functions using templates. This is a trick similar to the previously used one for adding or not adding an alpha channel to the output. Debayering gets this information but it ignores it in this patch. Actual processing with CCM is added in the followup patch. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 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>
43 hourslibcamera: software_isp: Add an example CCM to uncalibrated.yamlMilan Zamazal
For performance reasons, color correction matrix (CCM) is not applied by default in software ISP. But let's add a commented out example how to define it to the default tuning file. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
43 hourslibcamera: software_isp: Add CCM algorithmMilan Zamazal
This patch adds color correction matrix (CCM) algorithm to software ISP. It is based on the corresponding algorithm in rkisp1. The primary difference against hardware pipelines is that applying the CCM is optional. Applying CCM causes a significant slowdown, time needed to process a frame raises by 40-90% on tested platforms. If CCM is really needed, it can be applied, if not, it's better to stick without it. This can be configured by presence or omission of Ccm algorithm in the tuning file. CCM is changed only if the determined temperature changes by at least 100 K (an arbitrarily selected value), to avoid recomputing the matrices and lookup tables all the time. Since the CCM is float, rather than double, to use the same type as in the rkisp1 pipeline, the type of color gains is changed from double to float. The outputs of the algorithm are not used yet, they will be enabled in followup patches. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
43 hourslibcamera: software_isp: Use a macro to assign debayering methodsMilan Zamazal
Assignments of the debayering methods to be used is a repetitive pattern that can be (arguably) better expressed by using a macro. This removes some duplication and also makes easier to introduce more complex assignment patterns. This will be useful once color correction matrix support is added. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
43 hourslibcamera: software_isp: Use common code to store debayered pixelsMilan Zamazal
The debayering macros use the same pattern, let's extract it to a common macro. This reduces code duplication a bit now and it'll make changes of debayering easier when color correction matrix is introduced. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
43 hourslibcamera: software_isp: lut: Remove maybe_unused on a used argumentMilan Zamazal
`params' argument of Lut::prepare is actually used, let's remove maybe_unused from it. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
43 hourslibcamera: software_isp: Store color temperature to metadataMilan Zamazal
Image color temperature is a piece of information that should be reported in metadata, let's put it there. Metadata is currently not reported in simple pipeline but we should make at least newly added information ready to be reported. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
43 hourslibcamera: software_isp: Use RGB type to represent gainsMilan Zamazal
Rather than using a custom struct to represent RGB values, let's use the corresponding type and its facilities. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 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>
43 hourslibcamera: software_isp: Determine color temperatureMilan Zamazal
The AWB algorithm has data to determine color temperature of the image. Let's compute the temperature from it and store it into the context. This piece of information is currently unused but it will be needed in a followup patch introducing support for color correction matrix. Let's store the white balance related information under `awb' subsection of the active state, as the hardware pipelines do. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
3 dayslibcamera: camera_manager: Do not emit signals while holding lockBarnabás Pőcze
Both `CameraManager::Private::{add,remove}Camera()` emit the `camera{Added,Removed}` signals, respectively, while holding the lock protecting the list of cameras. This is problematic because if a callback tries to call `cameras()`, then the same (non-recursive) lock would be locked again. Furthermore, there is no real need to hold the lock while user code is running, so release the lock as soon as possible. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Harvey Yang <chenghaoyang@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
3 dayslibcamera: controls: Check size of enumBarnabás Pőcze
Only enums whose sizes match that of `int32_t` can be directly supported. Otherwise the expected size and the real size would disagree, leading to an assertion failure in `ControlValue::set()`. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
3 dayslibcamera: base: span: Explicitly default copy assignmentBarnabás Pőcze
The `dynamic_extent` specialization is currently not trivially copyable unlike its standard counterpart, `std::span`. This is because the copy assignment operator is user-defined. Explicitly default it just like it is done in the main template definition. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
7 dayslibcamera: camera: Ensure correct id maps are always setBarnabás Pőcze
`Camera::Private::properties_` is a default constructed `ControlList`, therefore it does not have an associated `ControlIdMap`. `controlInfo_` is in a similar situation. Extend the `Camera::Private` constructor to initialize the control id map of both properly. Multiple pipeline handlers copy the sensor's property list and set that as camera properties, and since the `CameraSensor{Legacy,Raw}` classes set the proper id map, the camera properties will have it too. However, some pipelines, e.g. `uvcvideo` or `virtual`, do not do so, and thus there will be no id map set. To fix this, extend the `Camera::Private` constructor to set `properties::properties`. As for `controlInfo_`, all pipeline handlers overwrite it during camera initialization (and thus it will have the correct id map), but still initialize the id map so that it is set at all times. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
7 daysipa: simple: lut: Fix include pathBarnabás Pőcze
Use the proper path to include `libcamera/control_ids.h`. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
7 daystest: threads: Use `pthread_testcancel()`Barnabás Pőcze
`pthread_testcancel()` is a guaranteed cancellation point, specifically for testing if cancellation has been requested, so use it. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
7 dayslibcamera: v4l2_videodevice: `lastUsedCounter_` need not be atomicBarnabás Pőcze
The `V4L2BufferCache` type is not thread-safe. Its `lastUsedCounter_` member is not used in contexts where its atomicity would matter. So it does not need to be have an atomic type. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
7 daysapps: cam: Highlight default enumeratorBarnabás Pőcze
Print "[default]" after the default enumerator when listing controls. Example: $ cam -c 1 --list-controls [...] Control: [inout] libcamera::ExposureTimeMode: - ExposureTimeModeAuto (0) [default] - ExposureTimeModeManual (1) Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
7 dayslibcamera: media_device: Ignore `lockf()` return valueBarnabás Pőcze
When `_FORTIFY_SOURCE` is enabled, the `lockf()` function might be marked with the `warn_unused_result` attribute, leading to compilation failure. Fix that by explicitly ignoring the return value. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
7 daysapps: qcam: Simplify `PixelFormat` searchBarnabás Pőcze
Since `PixelFormat` has `operator==()`, `std::find()` can be used directly, so do that to simplify. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
7 dayslibcamera: base: mutex: Remove unnecessary constructorsBarnabás Pőcze
The compiler defined default constructor works perfectly fine. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
7 dayslibcamera: ipa_manager: Store `IPAModule`s in `std::unique_ptr`Barnabás Pőcze
Express the ownership more clearly by using a smart pointer type. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
7 dayslibcamera: media_object: Fix unnecessary copyBarnabás Pőcze
`MediaEntity::ancillaryEntities()` can just return a const lvalue reference to the underlying array, a copy need not be made. That was likely the original intention. Fixes: 9490c664b57a6c ("libcamera: Add members to MediaEntity to support ancillary entities") Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
8 daysapps: cam: Fix include orderLaurent Pinchart
Several .cpp files in the cam application don't include their corresponding header first, as usually done by libcamera to ensure that headers are self-contained. Reorder headers to fix it. This shows through a compilation error that file_sink.h is missing libcamera/controls.h, fix it as well. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>
8 dayspipeline: rpi: Add support for Raspberry Pi 5Naushir Patuck
Add the Raspberry Pi 5 ISP (PiSP) pipeline handler to libcamera. To include this pipeline handler in the build, set the following meson option: meson configure -Dpipelines=rpi/pisp Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
8 dayspipeline: rpi: Add new stream flags for PiSPNaushir Patuck
Add the following new stream flags: Needs16bitEndianSwap - Indicates that a 16-bit endian swap needs to be performed on the framebuffer in software. Needs14bitUnpack - Indicates that a CSI-2 14-bit unpacking (to 16-bits) needs to be performed on the framebuffer in software. These are to workaround hardware restrictions in the CFE hardware that will be supported in a future commit. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
8 daysipa: rpi: Add support for Raspberry Pi 5Naushir Patuck
Add the Raspberry Pi 5 ISP (PiSP) IPA to libcamera. To include this IPA in the build, set the following meson option: meson configure -Dipas=rpi/pisp Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
8 daysmeson: Add libpisp.wrapNaushir Patuck
Add a new subpoject wrap file for the libpisp library located at https://github.com/raspberrypi/libpisp The libpisp library is used to configure the Raspberry Pi 5 Frontend and Backend ISP components. 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>
9 daysgstreamer: Add Y444 format support to the YUV listAntoine Bouyer
'imx8-isi' pipeline provides support for 'YUV444' PixelFormat with YUV streams, but it cannot be played with gstreamer adapter whereas gstreamer's video format 'Y444' value suggests that it also supports this format. To add support of Planar 4:4:4 YUV format in gstreamer adapter, this patch maps 'Y444' gstreamer video format with 'YUV444' libcamera PixelFormat. Then below command example can be used to capture a stream with imx8-isi pipeline: gst-launch-1.0 \ libcamerasrc camera-name=<your_camera_name> ! \ video/x-raw, format=Y444, width=1280, height=800 ! \ queue ! \ filesink location=/tmp/output Signed-off-by: Antoine Bouyer <antoine.bouyer@nxp.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-03-04Revert "README.rst: Report py dependencies"Jacopo Mondi
This reverts commit 36753f5cbbcd7c9e00fa3657d918cbe298f48c9c. Commit 36753f5cbbcd ("README.rst: Report py dependencies") duplicated the entries for the Python bindings dependencies, and does not list libpython3-dev which is still a requirement. Revert it. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2025-03-03libcamera: base: signal: Drop pre-C++17 supportLaurent Pinchart
The libcamera public API requires C++17, drop support for older standards. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-03-03libcamera: base: log: Fix uninitialized variable warningLaurent Pinchart
gcc 13.3.0, cross-compiling from amd64 to arm64, warns about a possibly uninitialized variable in Logger::parseLogLevel(): src/libcamera/base/log.cpp: In static member function ‘static libcamera::LogSeverity libcamera::Logger::parseLogLevel(std::string_view)’: ../../src/libcamera/base/log.cpp:694:55: error: ‘severity’ may be used uninitialized [-Werror=maybe-uninitialized] 694 | if (ec != std::errc() || *end != '\0' || severity > LogFatal) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ src/libcamera/base/log.cpp:690:22: note: ‘severity’ was declared here 690 | unsigned int severity; | ^~~~~~~~ This appears to be a false positive, as the std::from_chars() function should set severity value when it returns without an error. Still, the warning is easy to solve, so fix it by initializing the severity variable. Fixes: 8fa119e0b50f ("libcamera: base: log: Use `std::from_chars()`") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-03-01utils: ipc: Only dispatch messages for proxy when stopping threadMilan Zamazal
When stopping the proxy thread, all messages of InvokeMessage type posted to the pipeline handler thread are dispatched, to ensure that all signals emitted from the proxy thread and queued for delivery to the proxy are delivered synchronously. This unnecessarily delivers queued signals for other objects in the pipeline handler thread, possibly delaying processing of higher priority events. Improve the implementation by limiting synchronous delivery to messages posted for the proxy. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2025-03-01libcamera: software_isp: Dispatch messages on stopMilan Zamazal
There may be pending messages in SoftwareIsp message queue when SoftwareIsp stops. The call to IPAProxySoft::stop() will dispatch them before SoftwareIsp::stop() finishes. But this is dependent on IPAProxySoft::stop() implementation, let's break this dependency and dispatch messages to SoftwareIsp explicitly in SoftwareIsp::stop(). This also allows dropping `running_' flag. Since the SoftwareIsp messages get processed and invoke IPA calls before the IPA proxy is set to ProxyStopping state and the SoftwareIsp worker thread is no longer running, it's guaranteed that no new messages come to SoftwareIsp and attempt to call the stopped IPA proxy. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> 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>
2025-03-01libcamera: base: thread: Support dispatching for a specific receiverMilan Zamazal
The Thread::dispatchMessage() function supports filtering messages based on their type. It can be useful to also dispatch only messages posted for a specific receiver. Add an optional receiver argument to the dispatchMessage() function to do so. When set to null (the default value), the behaviour of the function is not changed. This facility is actually used in followup patches. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> 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>
2025-03-01libcamera: software_isp: Handle queued input buffers on stopMilan Zamazal
When SoftwareIsp stops, input and output buffers queued to it may not yet be fully processed. They will be eventually returned but stop means stop, there should be no processing related actions invoked afterwards. Let's stop forwarding processed input buffers from SoftwareIsp slots when SoftwareIsp is stopped. Let's track the queued input buffers and return them back for capture in SoftwareIsp::stop(). The returned input buffers are marked as cancelled. This is not necessary at the moment but it gives the pipeline handlers chance to deal with this if they need to. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> 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>
2025-03-01libcamera: software_isp: Handle queued output buffers on stopMilan Zamazal
When SoftwareIsp stops, input and output buffers queued to it may not yet be fully processed. They will be eventually returned but stop means stop, there should be no processing related actions invoked afterwards. Let's stop forwarding processed output buffers from the SoftwareIsp slots once SoftwareIsp is stopped. Let's track the queued output buffers and mark those still pending as cancelled in SoftwareIsp::stop and return them to the pipeline handler. Dealing with input buffers is addressed in a separate patch. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> 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>
2025-03-01libcamera: software_isp: Emit ispStatsReady only if IPA is runningMilan Zamazal
Software ISP runs debayering in a separate thread and debayering may emit statsReady when software ISP (including the IPA) is being stopped. The signal waits in a queue and gets invoked later, resulting in an assertion error when attempting to invoke a method on the stopped IPA: FATAL default soft_ipa_proxy.cpp:456 assertion "state_ == ProxyRunning" failed in processStatsThread() Let's prevent this problem by forwarding the ISP stats signal from software ISP only when the IPA is running. To track this, SoftwareISP::running_ variable is introduced. Making processing of the other signals in SoftwareISP more robust is addressed in the followup patches. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reported-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com> 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>