[1/3] libcamera: rkisp1: Use const reference for sensor configuration
diff mbox series

Message ID 20241011092222.537322-2-umang.jain@ideasonboard.com
State Accepted
Commit 326e0aa834487dd50610c0ff0423acc48d7b2298
Headers show
Series
  • libcamera: rkisp1: sensorConfig assorted fixes
Related show

Commit Message

Umang Jain Oct. 11, 2024, 9:22 a.m. UTC
User-provided sensor configuration is never meant to be altered,
hence pass SensorConfiguration by `const` reference in
RkISP1Path::validate().

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 2 +-
 src/libcamera/pipeline/rkisp1/rkisp1_path.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Kieran Bingham Oct. 14, 2024, 11:32 a.m. UTC | #1
Quoting Umang Jain (2024-10-11 10:22:20)
> User-provided sensor configuration is never meant to be altered,
> hence pass SensorConfiguration by `const` reference in
> RkISP1Path::validate().
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 2 +-
>  src/libcamera/pipeline/rkisp1/rkisp1_path.h   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp
> index 1999094e..4a3b779c 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp
> @@ -253,7 +253,7 @@ RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size,
>  
>  CameraConfiguration::Status
>  RkISP1Path::validate(const CameraSensor *sensor,
> -                    std::optional<SensorConfiguration> &sensorConfig,
> +                    const std::optional<SensorConfiguration> &sensorConfig,
>                      StreamConfiguration *cfg)
>  {
>         const std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> index ce9a5666..8461071f 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> @@ -45,7 +45,7 @@ public:
>                                                   const Size &resolution,
>                                                   StreamRole role);
>         CameraConfiguration::Status validate(const CameraSensor *sensor,
> -                                            std::optional<SensorConfiguration> &sensorConfig,
> +                                            const std::optional<SensorConfiguration> &sensorConfig,
>                                              StreamConfiguration *cfg);
>  
>         int configure(const StreamConfiguration &config,
> -- 
> 2.45.2
>
Stefan Klug Oct. 15, 2024, 6:19 p.m. UTC | #2
On Fri, Oct 11, 2024 at 02:52:20PM +0530, Umang Jain wrote:
> User-provided sensor configuration is never meant to be altered,
> hence pass SensorConfiguration by `const` reference in
> RkISP1Path::validate().
> 
> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>

Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> 

> ---
>  src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 2 +-
>  src/libcamera/pipeline/rkisp1/rkisp1_path.h   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp
> index 1999094e..4a3b779c 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp
> @@ -253,7 +253,7 @@ RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size,
>  
>  CameraConfiguration::Status
>  RkISP1Path::validate(const CameraSensor *sensor,
> -		     std::optional<SensorConfiguration> &sensorConfig,
> +		     const std::optional<SensorConfiguration> &sensorConfig,
>  		     StreamConfiguration *cfg)
>  {
>  	const std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> index ce9a5666..8461071f 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
> @@ -45,7 +45,7 @@ public:
>  						  const Size &resolution,
>  						  StreamRole role);
>  	CameraConfiguration::Status validate(const CameraSensor *sensor,
> -					     std::optional<SensorConfiguration> &sensorConfig,
> +					     const std::optional<SensorConfiguration> &sensorConfig,
>  					     StreamConfiguration *cfg);
>  
>  	int configure(const StreamConfiguration &config,
> -- 
> 2.45.2
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp
index 1999094e..4a3b779c 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp
@@ -253,7 +253,7 @@  RkISP1Path::generateConfiguration(const CameraSensor *sensor, const Size &size,
 
 CameraConfiguration::Status
 RkISP1Path::validate(const CameraSensor *sensor,
-		     std::optional<SensorConfiguration> &sensorConfig,
+		     const std::optional<SensorConfiguration> &sensorConfig,
 		     StreamConfiguration *cfg)
 {
 	const std::vector<unsigned int> &mbusCodes = sensor->mbusCodes();
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
index ce9a5666..8461071f 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h
+++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h
@@ -45,7 +45,7 @@  public:
 						  const Size &resolution,
 						  StreamRole role);
 	CameraConfiguration::Status validate(const CameraSensor *sensor,
-					     std::optional<SensorConfiguration> &sensorConfig,
+					     const std::optional<SensorConfiguration> &sensorConfig,
 					     StreamConfiguration *cfg);
 
 	int configure(const StreamConfiguration &config,