| Message ID | 20261112141214.976332-1-jacopo.mondi@ideasonboard.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 20157337022e..013e72d1aed4 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -304,7 +304,12 @@ RkISP1Path::validate(const CameraSensor *sensor, if (cfg->pixelFormat == format) { found = true; - break; + /* + * If a sensorConfig has been specified, continue walking + * all supported formats to find a valid 'rawFormat'. + */ + if (!sensorConfig) + break; } }
The RkISP1Path::validate() function walks the list of all available formats at the ISP output to ensure the supplied StreamConfiguration has a valid pixelformat, or adjust it a supported one in case it doesn't. When a sensorConfig is specified, the selection of the sensor format is restricted by the attributes of the supplied sensorConfig itself and the presence of a valid rawFormat is required in the rest of the function. Currently, whenever a valid pixel format is found, the loop is interrupted, risking the rawFormat variable to remain non initialized. This causes the validate() function to bail out if a sensor config is specified. So far the issue when unnoticed as 10bits and 12bits raw format are enumerated, by chance, before processed formats, and once the loop exists because a valid processed format has been found, rawFormat had been initialized already. 8bits formats instead are enumerated, again by chance, after the processed formats, and when the loop exists rawFormat is not initialized, preventing the camera to operate with any 8 bit format. Fix this by walking all supported formats even if the pixel format has been found to ensure rawFormat is initialized when a sensorConfig is specified. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> --- I'm not 100% happy with this as I think the usage of rawFormat and the fact it is populated during the validation of the StreamConfiguration pixelformat is not correct. However, considering this part of the code has been there for a long time, and I'm the first one hitting any error, just make sure we support all sensor bit depths instead of rewriting the function completely. --- --- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) -- 2.56.0