[libcamera-devel] [PATCH 07/15] libcamera: ipu3: Refuse unsupported configuration
Niklas Söderlund
niklas.soderlund at ragnatech.se
Wed Jul 1 18:45:01 CEST 2020
Hi Jacopo,
Thanks for your work.
On 2020-07-01 14:30:28 +0200, Jacopo Mondi wrote:
> Make sure in the validate() function that the number of raw and
> processed streams requested by applications is supported by the
> platform.
>
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
> src/libcamera/pipeline/ipu3/ipu3.cpp | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index daa6d71dae72..651e0c93a7ab 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -213,6 +213,8 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
> assignStreams();
>
> /* Verify and adjust configuration if needed. */
> + unsigned int rawCount = 0;
> + unsigned int outCount = 0;
> for (unsigned int i = 0; i < config_.size(); ++i) {
> StreamConfiguration &cfg = config_[i];
> const StreamConfiguration oldCfg = cfg;
> @@ -223,6 +225,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
> cfg.size = cio2Configuration_.size;
> cfg.pixelFormat = cio2Configuration_.pixelFormat;
> cfg.bufferCount = cio2Configuration_.bufferCount;
> + rawCount++;
> } else {
> /*
> * Clamp the size to match the ImgU alignment
> @@ -242,6 +245,7 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
> }
> cfg.pixelFormat = formats::NV12;
> cfg.bufferCount = IPU3_BUFFER_COUNT;
> + outCount++;
>
> /*
> * \todo: Handle the scaler (BDS) restrictions. The BDS
> @@ -254,6 +258,13 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
> */
> }
>
> + if (rawCount > 1 || outCount > 2) {
> + LOG(IPU3, Error)
> + << "Camera configuration not supported: "
> + << "the platform supports up to one raw stream and two processed ones.";
> + return Invalid;
> + }
> +
> if (cfg.pixelFormat != oldCfg.pixelFormat || cfg.size != oldCfg.size) {
> LOG(IPU3, Debug)
> << "Stream " << i << " configuration adjusted to "
> --
> 2.27.0
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list