[PATCH/RFC,15/32] libcamera: camera_sensor: Drop updateControlInfo() function
diff mbox series

Message ID 20240301212121.9072-16-laurent.pinchart@ideasonboard.com
State RFC
Headers show
Series
  • libcamera: Support the upstream Unicam driver
Related show

Commit Message

Laurent Pinchart March 1, 2024, 9:21 p.m. UTC
The CameraSensor::updateControlInfo() function is a wrapper around the
same function of the V4L2Subdevice class. It was meant to be called by
pipeline handlers that modify the sensor configuration directly,
bypassing the CameraSensor::setFormat() function. This never happened,
and the function is called once only, internally to the CameraSensor
class. No external users are foreseen, drop the function and call
V4L2Subdevice::updateControlInfo() directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/internal/camera_sensor.h |  2 --
 src/libcamera/sensor/camera_sensor.cpp     | 20 ++------------------
 2 files changed, 2 insertions(+), 20 deletions(-)

Comments

Jacopo Mondi March 4, 2024, 5:32 p.m. UTC | #1
Hi Laurent

On Fri, Mar 01, 2024 at 11:21:04PM +0200, Laurent Pinchart wrote:
> The CameraSensor::updateControlInfo() function is a wrapper around the
> same function of the V4L2Subdevice class. It was meant to be called by
> pipeline handlers that modify the sensor configuration directly,
> bypassing the CameraSensor::setFormat() function. This never happened,
> and the function is called once only, internally to the CameraSensor
> class. No external users are foreseen, drop the function and call
> V4L2Subdevice::updateControlInfo() directly.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

This could indeed be fast-tracked

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

> ---
>  include/libcamera/internal/camera_sensor.h |  2 --
>  src/libcamera/sensor/camera_sensor.cpp     | 20 ++------------------
>  2 files changed, 2 insertions(+), 20 deletions(-)
>
> diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
> index 60a8b106d175..b2f077b9cc75 100644
> --- a/include/libcamera/internal/camera_sensor.h
> +++ b/include/libcamera/internal/camera_sensor.h
> @@ -75,8 +75,6 @@ public:
>  	const ControlList &properties() const { return properties_; }
>  	int sensorInfo(IPACameraSensorInfo *info) const;
>
> -	void updateControlInfo();
> -
>  	CameraLens *focusLens() { return focusLens_.get(); }
>
>  	Transform computeTransform(Orientation *orientation) const;
> diff --git a/src/libcamera/sensor/camera_sensor.cpp b/src/libcamera/sensor/camera_sensor.cpp
> index af5d97f35de1..545f89d036df 100644
> --- a/src/libcamera/sensor/camera_sensor.cpp
> +++ b/src/libcamera/sensor/camera_sensor.cpp
> @@ -814,7 +814,7 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format, Transform transform)
>  	if (ret)
>  		return ret;
>
> -	updateControlInfo();
> +	subdev_->updateControlInfo();
>  	return 0;
>  }
>
> @@ -924,9 +924,7 @@ int CameraSensor::applyConfiguration(const SensorConfiguration &config,
>   *
>   * Control information is updated automatically to reflect the current sensor
>   * configuration when the setFormat() function is called, without invalidating
> - * any iterator on the ControlInfoMap. A manual update can also be forced by
> - * calling the updateControlInfo() function for pipeline handlers that change
> - * the sensor configuration wihtout using setFormat().
> + * any iterator on the ControlInfoMap.
>   *
>   * \return A map of the V4L2 controls supported by the sensor
>   */
> @@ -1013,10 +1011,6 @@ int CameraSensor::setControls(ControlList *ctrls)
>   * Sensor information is only available for raw sensors. When called for a YUV
>   * sensor, this function returns -EINVAL.
>   *
> - * Pipeline handlers that do not change the sensor format using the setFormat()
> - * function may need to call updateControlInfo() beforehand, to ensure all the
> - * control ranges are up to date.
> - *
>   * \return 0 on success, a negative error code otherwise
>   */
>  int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const
> @@ -1094,16 +1088,6 @@ int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const
>  	return 0;
>  }
>
> -/**
> - * \fn void CameraSensor::updateControlInfo()
> - * \brief Update the sensor's ControlInfoMap in case they have changed
> - * \sa V4L2Device::updateControlInfo()
> - */
> -void CameraSensor::updateControlInfo()
> -{
> -	subdev_->updateControlInfo();
> -}
> -
>  /**
>   * \fn CameraSensor::focusLens()
>   * \brief Retrieve the focus lens controller
> --
> Regards,
>
> Laurent Pinchart
>
Stefan Klug March 6, 2024, 4:12 p.m. UTC | #2
Hi Laurent,

On Fri, Mar 01, 2024 at 11:21:04PM +0200, Laurent Pinchart wrote:
> The CameraSensor::updateControlInfo() function is a wrapper around the
> same function of the V4L2Subdevice class. It was meant to be called by
> pipeline handlers that modify the sensor configuration directly,
> bypassing the CameraSensor::setFormat() function. This never happened,
> and the function is called once only, internally to the CameraSensor
> class. No external users are foreseen, drop the function and call
> V4L2Subdevice::updateControlInfo() directly.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Nice. I overcautiously called it in my SimplePipeline changes after setFormat()
This can now be removed.

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

Cheers,
Stefan

> ---
>  include/libcamera/internal/camera_sensor.h |  2 --
>  src/libcamera/sensor/camera_sensor.cpp     | 20 ++------------------
>  2 files changed, 2 insertions(+), 20 deletions(-)
> 
> diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
> index 60a8b106d175..b2f077b9cc75 100644
> --- a/include/libcamera/internal/camera_sensor.h
> +++ b/include/libcamera/internal/camera_sensor.h
> @@ -75,8 +75,6 @@ public:
>  	const ControlList &properties() const { return properties_; }
>  	int sensorInfo(IPACameraSensorInfo *info) const;
>  
> -	void updateControlInfo();
> -
>  	CameraLens *focusLens() { return focusLens_.get(); }
>  
>  	Transform computeTransform(Orientation *orientation) const;
> diff --git a/src/libcamera/sensor/camera_sensor.cpp b/src/libcamera/sensor/camera_sensor.cpp
> index af5d97f35de1..545f89d036df 100644
> --- a/src/libcamera/sensor/camera_sensor.cpp
> +++ b/src/libcamera/sensor/camera_sensor.cpp
> @@ -814,7 +814,7 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format, Transform transform)
>  	if (ret)
>  		return ret;
>  
> -	updateControlInfo();
> +	subdev_->updateControlInfo();
>  	return 0;
>  }
>  
> @@ -924,9 +924,7 @@ int CameraSensor::applyConfiguration(const SensorConfiguration &config,
>   *
>   * Control information is updated automatically to reflect the current sensor
>   * configuration when the setFormat() function is called, without invalidating
> - * any iterator on the ControlInfoMap. A manual update can also be forced by
> - * calling the updateControlInfo() function for pipeline handlers that change
> - * the sensor configuration wihtout using setFormat().
> + * any iterator on the ControlInfoMap.
>   *
>   * \return A map of the V4L2 controls supported by the sensor
>   */
> @@ -1013,10 +1011,6 @@ int CameraSensor::setControls(ControlList *ctrls)
>   * Sensor information is only available for raw sensors. When called for a YUV
>   * sensor, this function returns -EINVAL.
>   *
> - * Pipeline handlers that do not change the sensor format using the setFormat()
> - * function may need to call updateControlInfo() beforehand, to ensure all the
> - * control ranges are up to date.
> - *
>   * \return 0 on success, a negative error code otherwise
>   */
>  int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const
> @@ -1094,16 +1088,6 @@ int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const
>  	return 0;
>  }
>  
> -/**
> - * \fn void CameraSensor::updateControlInfo()
> - * \brief Update the sensor's ControlInfoMap in case they have changed
> - * \sa V4L2Device::updateControlInfo()
> - */
> -void CameraSensor::updateControlInfo()
> -{
> -	subdev_->updateControlInfo();
> -}
> -
>  /**
>   * \fn CameraSensor::focusLens()
>   * \brief Retrieve the focus lens controller
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
index 60a8b106d175..b2f077b9cc75 100644
--- a/include/libcamera/internal/camera_sensor.h
+++ b/include/libcamera/internal/camera_sensor.h
@@ -75,8 +75,6 @@  public:
 	const ControlList &properties() const { return properties_; }
 	int sensorInfo(IPACameraSensorInfo *info) const;
 
-	void updateControlInfo();
-
 	CameraLens *focusLens() { return focusLens_.get(); }
 
 	Transform computeTransform(Orientation *orientation) const;
diff --git a/src/libcamera/sensor/camera_sensor.cpp b/src/libcamera/sensor/camera_sensor.cpp
index af5d97f35de1..545f89d036df 100644
--- a/src/libcamera/sensor/camera_sensor.cpp
+++ b/src/libcamera/sensor/camera_sensor.cpp
@@ -814,7 +814,7 @@  int CameraSensor::setFormat(V4L2SubdeviceFormat *format, Transform transform)
 	if (ret)
 		return ret;
 
-	updateControlInfo();
+	subdev_->updateControlInfo();
 	return 0;
 }
 
@@ -924,9 +924,7 @@  int CameraSensor::applyConfiguration(const SensorConfiguration &config,
  *
  * Control information is updated automatically to reflect the current sensor
  * configuration when the setFormat() function is called, without invalidating
- * any iterator on the ControlInfoMap. A manual update can also be forced by
- * calling the updateControlInfo() function for pipeline handlers that change
- * the sensor configuration wihtout using setFormat().
+ * any iterator on the ControlInfoMap.
  *
  * \return A map of the V4L2 controls supported by the sensor
  */
@@ -1013,10 +1011,6 @@  int CameraSensor::setControls(ControlList *ctrls)
  * Sensor information is only available for raw sensors. When called for a YUV
  * sensor, this function returns -EINVAL.
  *
- * Pipeline handlers that do not change the sensor format using the setFormat()
- * function may need to call updateControlInfo() beforehand, to ensure all the
- * control ranges are up to date.
- *
  * \return 0 on success, a negative error code otherwise
  */
 int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const
@@ -1094,16 +1088,6 @@  int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const
 	return 0;
 }
 
-/**
- * \fn void CameraSensor::updateControlInfo()
- * \brief Update the sensor's ControlInfoMap in case they have changed
- * \sa V4L2Device::updateControlInfo()
- */
-void CameraSensor::updateControlInfo()
-{
-	subdev_->updateControlInfo();
-}
-
 /**
  * \fn CameraSensor::focusLens()
  * \brief Retrieve the focus lens controller