[libcamera-devel,02/16] libcamera: ipu3: Split controls init/update
diff mbox series

Message ID 20210827120757.110615-3-jacopo@jmondi.org
State Superseded
Headers show
Series
  • IPU3 control info update and HAL frame durations
Related show

Commit Message

Jacopo Mondi Aug. 27, 2021, 12:07 p.m. UTC
In order to prepare to updating the Camera controls limits when anew
camera configuration is applied, split the initControls() function in 2:
- updateControls() to actually compute controls values
- initControls() to initialize the sensor configuration and call
  updateControls

Update the functions documentation accordingly.

No functional changes intended.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 33 ++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

Comments

Paul Elder Aug. 31, 2021, 1:55 a.m. UTC | #1
Hi Jacopo,

On Fri, Aug 27, 2021 at 02:07:43PM +0200, Jacopo Mondi wrote:
> In order to prepare to updating the Camera controls limits when anew

s/prepare to/prepare for/

s/anew/a new/

> camera configuration is applied, split the initControls() function in 2:

s/2/two/

> - updateControls() to actually compute controls values
> - initControls() to initialize the sensor configuration and call
>   updateControls
> 
> Update the functions documentation accordingly.
> 
> No functional changes intended.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

Makes sense.

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

> ---
>  src/libcamera/pipeline/ipu3/ipu3.cpp | 33 ++++++++++++++++++++++++----
>  1 file changed, 29 insertions(+), 4 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index b321c94e9cb0..885f5ddce139 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -154,6 +154,7 @@ private:
>  	}
>  
>  	int initControls(IPU3CameraData *data);
> +	int updateControls(IPU3CameraData *data);
>  	int registerCameras();
>  
>  	int allocateBuffers(Camera *camera);
> @@ -927,9 +928,11 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)
>   * \brief Initialize the camera controls
>   * \param[in] data The camera data
>   *
> - * Initialize the camera controls as the union of the static pipeline handler
> - * controls (IPU3Controls) and controls created dynamically from the sensor
> - * capabilities.
> + * Initialize the camera controls by calculating controls which the pipeline
> + * is reponsible for and merge them with the controls computed by the IPA.
> + *
> + * This function needs data->ipaControls_ to be initialized by the IPA init()
> + * function at camera creation time. Always call this function after IPA init().
>   *
>   * \return 0 on success or a negative error code otherwise
>   */
> @@ -950,8 +953,30 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
>  	if (ret)
>  		return ret;
>  
> +	return updateControls(data);
> +}
> +
> +/**
> + * \brief Update the camera controls
> + * \param[in] data The camera data
> + *
> + * Compute the camera controls by calculating controls which the pipeline
> + * is reponsible for and merge them with the controls computed by the IPA.
> + *
> + * This function needs data->ipaControls_ to be refreshed when a new
> + * configuration is applied to the camera by the IPA configure() function.
> + *
> + * Always call this function after IPA configure() to make sure to have a
> + * properly refreshed IPA controls list.
> + *
> + * \return 0 on success or a negative error code otherwise
> + */
> +int PipelineHandlerIPU3::updateControls(IPU3CameraData *data)
> +{
> +	CameraSensor *sensor = data->cio2_.sensor();
>  	IPACameraSensorInfo sensorInfo{};
> -	ret = sensor->sensorInfo(&sensorInfo);
> +
> +	int ret = sensor->sensorInfo(&sensorInfo);
>  	if (ret)
>  		return ret;
>  
> -- 
> 2.32.0
>
Umang Jain Sept. 1, 2021, 6:25 a.m. UTC | #2
Hi Jacopo,

Thanks for the patch

On 8/27/21 5:37 PM, Jacopo Mondi wrote:
> In order to prepare to updating the Camera controls limits when anew
> camera configuration is applied, split the initControls() function in 2:
> - updateControls() to actually compute controls values
> - initControls() to initialize the sensor configuration and call
>    updateControls
>
> Update the functions documentation accordingly.
>
> No functional changes intended.
>
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>


Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>


> ---
>   src/libcamera/pipeline/ipu3/ipu3.cpp | 33 ++++++++++++++++++++++++----
>   1 file changed, 29 insertions(+), 4 deletions(-)
>
> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> index b321c94e9cb0..885f5ddce139 100644
> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> @@ -154,6 +154,7 @@ private:
>   	}
>   
>   	int initControls(IPU3CameraData *data);
> +	int updateControls(IPU3CameraData *data);
>   	int registerCameras();
>   
>   	int allocateBuffers(Camera *camera);
> @@ -927,9 +928,11 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)
>    * \brief Initialize the camera controls
>    * \param[in] data The camera data
>    *
> - * Initialize the camera controls as the union of the static pipeline handler
> - * controls (IPU3Controls) and controls created dynamically from the sensor
> - * capabilities.
> + * Initialize the camera controls by calculating controls which the pipeline
> + * is reponsible for and merge them with the controls computed by the IPA.
> + *
> + * This function needs data->ipaControls_ to be initialized by the IPA init()
> + * function at camera creation time. Always call this function after IPA init().
>    *
>    * \return 0 on success or a negative error code otherwise
>    */
> @@ -950,8 +953,30 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
>   	if (ret)
>   		return ret;
>   
> +	return updateControls(data);
> +}
> +
> +/**
> + * \brief Update the camera controls
> + * \param[in] data The camera data
> + *
> + * Compute the camera controls by calculating controls which the pipeline
> + * is reponsible for and merge them with the controls computed by the IPA.
> + *
> + * This function needs data->ipaControls_ to be refreshed when a new
> + * configuration is applied to the camera by the IPA configure() function.
> + *
> + * Always call this function after IPA configure() to make sure to have a
> + * properly refreshed IPA controls list.
> + *
> + * \return 0 on success or a negative error code otherwise
> + */
> +int PipelineHandlerIPU3::updateControls(IPU3CameraData *data)
> +{
> +	CameraSensor *sensor = data->cio2_.sensor();
>   	IPACameraSensorInfo sensorInfo{};
> -	ret = sensor->sensorInfo(&sensorInfo);
> +
> +	int ret = sensor->sensorInfo(&sensorInfo);
>   	if (ret)
>   		return ret;
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index b321c94e9cb0..885f5ddce139 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -154,6 +154,7 @@  private:
 	}
 
 	int initControls(IPU3CameraData *data);
+	int updateControls(IPU3CameraData *data);
 	int registerCameras();
 
 	int allocateBuffers(Camera *camera);
@@ -927,9 +928,11 @@  bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)
  * \brief Initialize the camera controls
  * \param[in] data The camera data
  *
- * Initialize the camera controls as the union of the static pipeline handler
- * controls (IPU3Controls) and controls created dynamically from the sensor
- * capabilities.
+ * Initialize the camera controls by calculating controls which the pipeline
+ * is reponsible for and merge them with the controls computed by the IPA.
+ *
+ * This function needs data->ipaControls_ to be initialized by the IPA init()
+ * function at camera creation time. Always call this function after IPA init().
  *
  * \return 0 on success or a negative error code otherwise
  */
@@ -950,8 +953,30 @@  int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
 	if (ret)
 		return ret;
 
+	return updateControls(data);
+}
+
+/**
+ * \brief Update the camera controls
+ * \param[in] data The camera data
+ *
+ * Compute the camera controls by calculating controls which the pipeline
+ * is reponsible for and merge them with the controls computed by the IPA.
+ *
+ * This function needs data->ipaControls_ to be refreshed when a new
+ * configuration is applied to the camera by the IPA configure() function.
+ *
+ * Always call this function after IPA configure() to make sure to have a
+ * properly refreshed IPA controls list.
+ *
+ * \return 0 on success or a negative error code otherwise
+ */
+int PipelineHandlerIPU3::updateControls(IPU3CameraData *data)
+{
+	CameraSensor *sensor = data->cio2_.sensor();
 	IPACameraSensorInfo sensorInfo{};
-	ret = sensor->sensorInfo(&sensorInfo);
+
+	int ret = sensor->sensorInfo(&sensorInfo);
 	if (ret)
 		return ret;