[libcamera-devel] [PATCH v3 16/23] libcamera: IPACameraSensorInfo: Add VBLANK
Jacopo Mondi
jacopo at jmondi.org
Thu Jun 30 15:38:55 CEST 2022
The IPA module needs the vertical blanking value to calculate the
total frame size.
In order to prepare removing usage of V4L2_CID_VBLANK in IPA modules,
add the vblank value to the IPACameraSensorInfo structure.
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
include/libcamera/ipa/core.mojom | 6 ++++++
src/libcamera/camera_sensor/camera_sensor.cpp | 15 +++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom
index 74f3339e56f2..d122fb7add4d 100644
--- a/include/libcamera/ipa/core.mojom
+++ b/include/libcamera/ipa/core.mojom
@@ -178,6 +178,11 @@ module libcamera;
* The total line length in pixel clock periods, including blanking.
*/
+/**
+ * \var IPACameraSensorInfo::vblank
+ * \brief The vertical blanking, expressed in number of lines
+ */
+
/**
* \var IPACameraSensorInfo::minFrameLength
* \brief The minimum allowable frame length in units of lines
@@ -218,6 +223,7 @@ struct IPACameraSensorInfo {
uint64 pixelRate;
uint32 lineLength;
+ uint32 vblank;
uint32 minFrameLength;
uint32 maxFrameLength;
diff --git a/src/libcamera/camera_sensor/camera_sensor.cpp b/src/libcamera/camera_sensor/camera_sensor.cpp
index 02810c7c5ad0..08b96b9c3b40 100644
--- a/src/libcamera/camera_sensor/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor/camera_sensor.cpp
@@ -1008,6 +1008,21 @@ int CameraSensor::sensorInfo(IPACameraSensorInfo *info) const
info->minFrameLength = info->outputSize.height + vblank.min().get<int32_t>();
info->maxFrameLength = info->outputSize.height + vblank.max().get<int32_t>();
+ /*
+ * Retrieve the vertical blanking.
+ *
+ * We can't rely on the valued cached as vblank can be modified while
+ * streaming to adjust the frame rate.
+ */
+ ControlList ctrls = subdev_->getControls({ V4L2_CID_VBLANK });
+ if (ctrls.empty()) {
+ LOG(CameraSensor, Error)
+ << "Failed to retrieve camera info controls";
+ return -EINVAL;
+ }
+
+ info->vblank = ctrls.get(V4L2_CID_VBLANK).get<int32_t>();
+
return 0;
}
--
2.36.1
More information about the libcamera-devel
mailing list