[libcamera-devel,3/5] libcamera: camera_sensor: Rename controls() method
diff mbox series

Message ID 20201223184516.58791-4-jacopo@jmondi.org
State Superseded
Delegated to: Jacopo Mondi
Headers show
Series
  • libcamera: Register CameraSensor controls
Related show

Commit Message

Jacopo Mondi Dec. 23, 2020, 6:45 p.m. UTC
The CameraSensor::controls() methods returns the information relative to
the V4L2 controls registered by the sensor sub-device driver. Its
current use is to inform the IPA module of two pipelines (RkISP1 and
VIMC) about the V4L2 controls limits.

The CameraSensor class has a controls_ field, which is instead the
ControlInfoMap of libcamera controls registered by the CameraSensor
class and meant to be exported as Camera controls.

To prepare to register libcamera controls in the CameraSensor::controls_
info map, and remove any ambiguity on the intended usage of
CameraSensor::controls(), rename the method in
CameraSensor::subdevControls() and update its users in the code base.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 include/libcamera/internal/camera_sensor.h | 2 +-
 src/libcamera/camera_sensor.cpp            | 6 +++---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp   | 2 +-
 src/libcamera/pipeline/vimc/vimc.cpp       | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

Comments

Paul Elder Dec. 28, 2020, 8:27 a.m. UTC | #1
Hi Jacopo,

On Wed, Dec 23, 2020 at 07:45:14PM +0100, Jacopo Mondi wrote:
> The CameraSensor::controls() methods returns the information relative to
> the V4L2 controls registered by the sensor sub-device driver. Its
> current use is to inform the IPA module of two pipelines (RkISP1 and
> VIMC) about the V4L2 controls limits.
> 
> The CameraSensor class has a controls_ field, which is instead the
> ControlInfoMap of libcamera controls registered by the CameraSensor
> class and meant to be exported as Camera controls.
> 
> To prepare to register libcamera controls in the CameraSensor::controls_
> info map, and remove any ambiguity on the intended usage of
> CameraSensor::controls(), rename the method in
> CameraSensor::subdevControls() and update its users in the code base.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>

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

> ---
>  include/libcamera/internal/camera_sensor.h | 2 +-
>  src/libcamera/camera_sensor.cpp            | 6 +++---
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp   | 2 +-
>  src/libcamera/pipeline/vimc/vimc.cpp       | 4 ++--
>  4 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
> index 0357b2a630f7..841c7f4bef0f 100644
> --- a/include/libcamera/internal/camera_sensor.h
> +++ b/include/libcamera/internal/camera_sensor.h
> @@ -57,7 +57,7 @@ public:
>  				      const Size &size) const;
>  	int setFormat(V4L2SubdeviceFormat *format);
>  
> -	const ControlInfoMap &controls() const;
> +	const ControlInfoMap &subdevControls() const;
>  	ControlList getControls(const std::vector<uint32_t> &ids);
>  	int setControls(ControlList *ctrls);
>  
> diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
> index 609f948c56a6..fa85484f6186 100644
> --- a/src/libcamera/camera_sensor.cpp
> +++ b/src/libcamera/camera_sensor.cpp
> @@ -616,10 +616,10 @@ int CameraSensor::setFormat(V4L2SubdeviceFormat *format)
>  }
>  
>  /**
> - * \brief Retrieve the supported V4L2 controls and their information
> - * \return A map of the V4L2 controls supported by the sensor
> + * \brief Retrieve the controls supported by the V4L2 subdev and their information
> + * \return A map of the V4L2 controls supported by the video subdevice
>   */
> -const ControlInfoMap &CameraSensor::controls() const
> +const ControlInfoMap &CameraSensor::subdevControls() const
>  {
>  	return subdev_->controls();
>  }
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 021d0ffe3ffb..31c9683f783b 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -906,7 +906,7 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c
>  	}
>  
>  	std::map<unsigned int, const ControlInfoMap &> entityControls;
> -	entityControls.emplace(0, data->sensor_->controls());
> +	entityControls.emplace(0, data->sensor_->subdevControls());
>  
>  	IPAOperationData ipaConfig;
>  	data->ipa_->configure(sensorInfo, streamConfig, entityControls,
> diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
> index 8bda746f3136..e33b2c0823af 100644
> --- a/src/libcamera/pipeline/vimc/vimc.cpp
> +++ b/src/libcamera/pipeline/vimc/vimc.cpp
> @@ -338,7 +338,7 @@ void PipelineHandlerVimc::stop(Camera *camera)
>  
>  int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request)
>  {
> -	ControlList controls(data->sensor_->controls());
> +	ControlList controls(data->sensor_->subdevControls());
>  
>  	for (auto it : request->controls()) {
>  		unsigned int id = it.first;
> @@ -480,7 +480,7 @@ int VimcCameraData::init()
>  		return -ENODEV;
>  
>  	/* Initialise the supported controls. */
> -	const ControlInfoMap &controls = sensor_->controls();
> +	const ControlInfoMap &controls = sensor_->subdevControls();
>  	ControlInfoMap::Map ctrls;
>  
>  	for (const auto &ctrl : controls) {
> -- 
> 2.29.2
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch
diff mbox series

diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
index 0357b2a630f7..841c7f4bef0f 100644
--- a/include/libcamera/internal/camera_sensor.h
+++ b/include/libcamera/internal/camera_sensor.h
@@ -57,7 +57,7 @@  public:
 				      const Size &size) const;
 	int setFormat(V4L2SubdeviceFormat *format);
 
-	const ControlInfoMap &controls() const;
+	const ControlInfoMap &subdevControls() const;
 	ControlList getControls(const std::vector<uint32_t> &ids);
 	int setControls(ControlList *ctrls);
 
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 609f948c56a6..fa85484f6186 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -616,10 +616,10 @@  int CameraSensor::setFormat(V4L2SubdeviceFormat *format)
 }
 
 /**
- * \brief Retrieve the supported V4L2 controls and their information
- * \return A map of the V4L2 controls supported by the sensor
+ * \brief Retrieve the controls supported by the V4L2 subdev and their information
+ * \return A map of the V4L2 controls supported by the video subdevice
  */
-const ControlInfoMap &CameraSensor::controls() const
+const ControlInfoMap &CameraSensor::subdevControls() const
 {
 	return subdev_->controls();
 }
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 021d0ffe3ffb..31c9683f783b 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -906,7 +906,7 @@  int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c
 	}
 
 	std::map<unsigned int, const ControlInfoMap &> entityControls;
-	entityControls.emplace(0, data->sensor_->controls());
+	entityControls.emplace(0, data->sensor_->subdevControls());
 
 	IPAOperationData ipaConfig;
 	data->ipa_->configure(sensorInfo, streamConfig, entityControls,
diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp
index 8bda746f3136..e33b2c0823af 100644
--- a/src/libcamera/pipeline/vimc/vimc.cpp
+++ b/src/libcamera/pipeline/vimc/vimc.cpp
@@ -338,7 +338,7 @@  void PipelineHandlerVimc::stop(Camera *camera)
 
 int PipelineHandlerVimc::processControls(VimcCameraData *data, Request *request)
 {
-	ControlList controls(data->sensor_->controls());
+	ControlList controls(data->sensor_->subdevControls());
 
 	for (auto it : request->controls()) {
 		unsigned int id = it.first;
@@ -480,7 +480,7 @@  int VimcCameraData::init()
 		return -ENODEV;
 
 	/* Initialise the supported controls. */
-	const ControlInfoMap &controls = sensor_->controls();
+	const ControlInfoMap &controls = sensor_->subdevControls();
 	ControlInfoMap::Map ctrls;
 
 	for (const auto &ctrl : controls) {