[libcamera-devel] [PATCH v2 18/20] libcamera: ipu3: Calculate ImgU pipe configuration

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Jul 10 14:46:40 CEST 2020


Hi Jacopo,

Thank you for the patch.

On Thu, Jul 09, 2020 at 10:41:26AM +0200, Jacopo Mondi wrote:
> Collect the ImgU device desired pipe configuration while assigning
> streams in the pipeline handler validate() function and ask the
> ImgUDevice class to calculate the pipe configuration parameters.
> 
> If the requested pipe configuration results in a non-valid
> configuration, return an error from the validate() function.
> 
> Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

although I wonder if the Pipe and PipeConfig structures shouldn't be
merged, but that's a topic for another patch.

> ---
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index 9a6e71514c90..72261d16e9f8 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -71,6 +71,7 @@ private:
>  	IPU3CameraData *data_;
>  
>  	StreamConfiguration cio2Configuration_;
> +	ImgUDevice::PipeConfig pipeConfig_;
>  };
>  
>  class PipelineHandlerIPU3 : public PipelineHandler
> @@ -179,6 +180,9 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
>  
>  	LOG(IPU3, Debug) << "CIO2 configuration: " << cio2Configuration_.toString();
>  
> +	ImgUDevice::Pipe pipe{};
> +	pipe.input = cio2Configuration_.size;
> +
>  	/*
>  	 * Adjust the configurations if needed and assign streams while
>  	 * iterating them.
> @@ -250,11 +254,13 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
>  		    (oldCfg.size == yuvSize || outCount == 1)) {
>  			cfg.setStream(&data_->outStream_);
>  			mainOutputAvailable = false;
> +			pipe.output = cfg.size;
>  
>  			LOG(IPU3, Debug) << "Assigned " << cfg.toString()
>  					 << " to the main output";
>  		} else {
>  			cfg.setStream(&data_->vfStream_);
> +			pipe.viewfinder = cfg.size;
>  
>  			LOG(IPU3, Debug) << "Assigned " << cfg.toString()
>  					 << " to the viewfinder output";
> @@ -269,6 +275,13 @@ CameraConfiguration::Status IPU3CameraConfiguration::validate()
>  		}
>  	}
>  
> +	pipeConfig_ = data_->imgu_->calculatePipeConfig(&pipe);
> +	if (pipeConfig_.isNull()) {
> +		LOG(IPU3, Error) << "Failed to calculate pipe configuration: "
> +				 << "unsupported resolutions.";
> +		return Invalid;
> +	}
> +
>  	return status;
>  }
>  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list