summaryrefslogtreecommitdiff
path: root/src/libcamera/pipeline/ipu3
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2021-02-18 20:43:18 +0100
committerJacopo Mondi <jacopo@jmondi.org>2021-03-09 08:53:39 +0100
commitcbd4617a098afe251e9c3386ed3fa0aedb0e89ec (patch)
treef9e8a3471a6042da2f1870b118573df9bedd8a5b /src/libcamera/pipeline/ipu3
parent45ebe9a209fc5bcce649b8b3f27f80131fc4e2c7 (diff)
libcamera: ipu3: Initialize controls using sensor resolution
The controls' limits initialized by the IPU3 pipeline handler depend on the sensor configuration. In order to compute controls using a known state apply to the sensor a configuration equal to its own resolution. Move the \todo note regarding the controls' limits dependency on the sensor configuration at the beginning of the function and remove the other redundant ones in the function body. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/libcamera/pipeline/ipu3')
-rw-r--r--src/libcamera/pipeline/ipu3/ipu3.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 3dd1bdd0..a7be2c54 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -868,10 +868,23 @@ bool PipelineHandlerIPU3::match(DeviceEnumerator *enumerator)
*/
int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
{
+ /*
+ * \todo The constrols intialized here depend on sensor configuration
+ * and their limits should be updated once the configuration gets
+ * changed.
+ *
+ * Initialize the sensor using its resolution and compute the control
+ * limits.
+ */
CameraSensor *sensor = data->cio2_.sensor();
- CameraSensorInfo sensorInfo{};
+ V4L2SubdeviceFormat sensorFormat = {};
+ sensorFormat.size = sensor->resolution();
+ int ret = sensor->setFormat(&sensorFormat);
+ if (ret)
+ return ret;
- int ret = sensor->sensorInfo(&sensorInfo);
+ CameraSensorInfo sensorInfo{};
+ ret = sensor->sensorInfo(&sensorInfo);
if (ret)
return ret;
@@ -880,7 +893,6 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
/*
* Compute exposure time limits.
*
- * \todo The exposure limits depend on the sensor configuration.
* Initialize the control using the line length and pixel rate of the
* current configuration converted to microseconds. Use the
* V4L2_CID_EXPOSURE control to get exposure min, max and default and
@@ -906,25 +918,12 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
/*
* Compute the scaler crop limits.
*
- * \todo The scaler crop limits depend on the sensor configuration. It
- * should be updated when a new configuration is applied. To initialize
- * the control use the 'Viewfinder' configuration (1280x720) as the
- * pipeline output resolution and the full sensor size as input frame
- * (see the todo note in the validate() function about the usage of the
- * sensor's full frame as ImgU input).
+ * Initialize the control use the 'Viewfinder' configuration (1280x720)
+ * as the pipeline output resolution and the full sensor size as input
+ * frame (see the todo note in the validate() function about the usage
+ * of the sensor's full frame as ImgU input).
*/
- /* Re-fetch the sensor info updated to use the largest resolution. */
- V4L2SubdeviceFormat sensorFormat = {};
- sensorFormat.size = sensor->resolution();
- ret = sensor->setFormat(&sensorFormat);
- if (ret)
- return ret;
-
- ret = sensor->sensorInfo(&sensorInfo);
- if (ret)
- return ret;
-
/*
* The maximum scaler crop rectangle is the analogue crop used to
* produce the maximum frame size.