summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2020-07-07 14:50:08 +0200
committerJacopo Mondi <jacopo@jmondi.org>2020-08-03 11:16:17 +0200
commit117e65cef28a5bb29b831b9468e11de732e283f6 (patch)
treee7f9031bf9ac8b3170723066321173b07712b363 /src
parent320757897caba92d3cc6419db80e475de231cd0c (diff)
libcamera: ipu3: Validate the stream combination
The IPU3 pipeline handler supports 2 processed RGB/YUV streams and one RAW stream. Validate that the requested stream combination is supported in the pipeline handler validate() implementation and return an error in case it's not. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index e30071cf..22baacf9 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -241,20 +241,35 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
}
/*
- * Select the sensor format by collecting the maximum width and height
- * and picking the closest larger match, as the IPU3 can downscale
- * only. If no resolution is requested for any stream, or if no sensor
- * resolution is large enough, pick the largest one.
+ * Validate the requested stream configuration and select the sensor
+ * format by collecting the maximum width and height and picking the
+ * closest larger match, as the IPU3 can downscale only. If no
+ * resolution is requested for any stream, or if no sensor resolution is
+ * large enough, pick the largest one.
*/
+ unsigned int rawCount = 0;
+ unsigned int yuvCount = 0;
Size size;
for (const StreamConfiguration &cfg : config_) {
+ const PixelFormatInfo &info = PixelFormatInfo::info(cfg.pixelFormat);
+
+ if (info.colourEncoding == PixelFormatInfo::ColourEncodingRAW)
+ rawCount++;
+ else
+ yuvCount++;
+
if (cfg.size.width > size.width)
size.width = cfg.size.width;
if (cfg.size.height > size.height)
size.height = cfg.size.height;
}
+ if (rawCount > 1 || yuvCount > 2) {
+ LOG(IPU3, Debug) << "Camera configuration not supported";
+ return Invalid;
+ }
+
/* Generate raw configuration from CIO2. */
cio2Configuration_ = data_->cio2_.generateConfiguration(size);
if (!cio2Configuration_.pixelFormat.isValid())