From fa78167e3a54375ccb08975099692ba57d6c5e12 Mon Sep 17 00:00:00 2001 From: Stefan Klug Date: Tue, 25 Nov 2025 17:28:30 +0100 Subject: [PATCH] pipeline: rksip1: Move isRaw up in scope In raw mode the number of configurations is actively limited to 1. It is therefore safe to move isRaw up one level to simplify the code and prepare for later use. During that rework it was noticed that the old code actually has a bug in that it reduces the number of configurations to 1 in case a raw config is found, but it doesn't reduce the config vector to that raw config, but the first config. Change that behavior to check the first config and either remove all remaining configs if the first is raw or drop all raw configs if the first is non-raw. Signed-off-by: Stefan Klug Reviewed-by: Kieran Bingham --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 35 ++++++++++++------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 8bcd394b..89b6ab30 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -551,31 +551,30 @@ CameraConfiguration::Status RkISP1CameraConfiguration::validate() status = Adjusted; /* - * Simultaneous capture of raw and processed streams isn't possible. If - * there is any raw stream, cap the number of streams to one. + * Simultaneous capture of raw and processed streams isn't possible. + * Let the first stream decide on the type. */ - if (config_.size() > 1) { - for (const auto &cfg : config_) { - if (PixelFormatInfo::info(cfg.pixelFormat).colourEncoding == + bool isRaw = (PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding == + PixelFormatInfo::ColourEncodingRAW); + if (isRaw) { + if (config_.size() > 1) { + config_.resize(1); + status = Adjusted; + } + } else { + /* Drop all raw configs. */ + for (auto it = config_.begin(); it != config_.end();) { + if (PixelFormatInfo::info(it->pixelFormat).colourEncoding == PixelFormatInfo::ColourEncodingRAW) { - config_.resize(1); + it = config_.erase(it); status = Adjusted; - break; + continue; } + ++it; } } - bool useDewarper = false; - if (pipe->dewarper_) { - /* - * Platforms with dewarper support, such as i.MX8MP, support - * only a single stream. We can inspect config_[0] only here. - */ - bool isRaw = PixelFormatInfo::info(config_[0].pixelFormat).colourEncoding == - PixelFormatInfo::ColourEncodingRAW; - if (!isRaw) - useDewarper = true; - } + bool useDewarper = (pipe->dewarper_ && !isRaw); /* * If there are more than one stream in the configuration figure out the