[5/7] pipeline: rkisp1: Reorder sensorInfo collection code
diff mbox series

Message ID 20241120085753.1993436-6-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • rkisp1: Fix aspect ratio and ScalerCrop
Related show

Commit Message

Stefan Klug Nov. 20, 2024, 8:57 a.m. UTC
The sensorInfo (specifically the crop rectangle of the selected sensor
mode) is collected to be passed to the IPA later. In an upcoming patch
that data will also be needed for correct ScalerCrop handling. Move the
collection of the sensorInfo before the dewarper configuration step and
refactor the code a bit.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Paul Elder Nov. 20, 2024, 11:37 a.m. UTC | #1
On Wed, Nov 20, 2024 at 09:57:44AM +0100, Stefan Klug wrote:
> The sensorInfo (specifically the crop rectangle of the selected sensor
> mode) is collected to be passed to the IPA later. In an upcoming patch
> that data will also be needed for correct ScalerCrop handling. Move the
> collection of the sensorInfo before the dewarper configuration step and
> refactor the code a bit.
> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 6491a48ee83c..4a226d9b809f 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -844,6 +844,11 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
>  		<< "ISP output pad configured with " << format
>  		<< " crop " << outputCrop;
>  
> +	IPACameraSensorInfo sensorInfo;
> +	ret = data->sensor_->sensorInfo(&sensorInfo);
> +	if (ret)
> +		return ret;
> +
>  	std::map<unsigned int, IPAStream> streamConfig;
>  	std::vector<std::reference_wrapper<StreamConfiguration>> outputCfgs;
>  
> @@ -883,14 +888,9 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
>  		return ret;
>  
>  	/* Inform IPA of stream configuration and sensor controls. */
> -	ipa::rkisp1::IPAConfigInfo ipaConfig{};
> -
> -	ret = data->sensor_->sensorInfo(&ipaConfig.sensorInfo);
> -	if (ret)
> -		return ret;
> -
> -	ipaConfig.sensorControls = data->sensor_->controls();
> -	ipaConfig.paramFormat = paramFormat.fourcc;
> +	ipa::rkisp1::IPAConfigInfo ipaConfig{ sensorInfo,
> +					      data->sensor_->controls(),
> +					      paramFormat.fourcc };
>  
>  	ret = data->ipa_->configure(ipaConfig, streamConfig, &data->ipaControls_);
>  	if (ret) {
> -- 
> 2.43.0
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 6491a48ee83c..4a226d9b809f 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -844,6 +844,11 @@  int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
 		<< "ISP output pad configured with " << format
 		<< " crop " << outputCrop;
 
+	IPACameraSensorInfo sensorInfo;
+	ret = data->sensor_->sensorInfo(&sensorInfo);
+	if (ret)
+		return ret;
+
 	std::map<unsigned int, IPAStream> streamConfig;
 	std::vector<std::reference_wrapper<StreamConfiguration>> outputCfgs;
 
@@ -883,14 +888,9 @@  int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
 		return ret;
 
 	/* Inform IPA of stream configuration and sensor controls. */
-	ipa::rkisp1::IPAConfigInfo ipaConfig{};
-
-	ret = data->sensor_->sensorInfo(&ipaConfig.sensorInfo);
-	if (ret)
-		return ret;
-
-	ipaConfig.sensorControls = data->sensor_->controls();
-	ipaConfig.paramFormat = paramFormat.fourcc;
+	ipa::rkisp1::IPAConfigInfo ipaConfig{ sensorInfo,
+					      data->sensor_->controls(),
+					      paramFormat.fourcc };
 
 	ret = data->ipa_->configure(ipaConfig, streamConfig, &data->ipaControls_);
 	if (ret) {