[libcamera-devel] [PATCH v3 11/23] libcamera: camera_sensor: Expose DelayedControls interface

Jacopo Mondi jacopo at jmondi.org
Thu Jun 30 15:38:50 CEST 2022


Now that the CameraSensor class has an instance of delayed controls
expose its interface for pipeline handlers to use it.

The interface towards DelayedControls still operates on lists of
V4L2 controls.

Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
 include/libcamera/internal/camera_sensor.h    |  4 +++
 src/libcamera/camera_sensor/camera_sensor.cpp | 31 +++++++++++++++++++
 2 files changed, 35 insertions(+)

diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
index bd5aa0dbc27d..a606bc5d1cb5 100644
--- a/include/libcamera/internal/camera_sensor.h
+++ b/include/libcamera/internal/camera_sensor.h
@@ -71,6 +71,10 @@ public:
 
 	CameraLens *focusLens() { return focusLens_.get(); }
 
+	void frameStart(uint32_t sequence);
+	void pushControls(const ControlList &ctrls);
+	ControlList getControls(uint32_t sequence);
+
 protected:
 	std::string logPrefix() const override;
 
diff --git a/src/libcamera/camera_sensor/camera_sensor.cpp b/src/libcamera/camera_sensor/camera_sensor.cpp
index 211c7461f5c6..e1770e8fa130 100644
--- a/src/libcamera/camera_sensor/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor/camera_sensor.cpp
@@ -1043,6 +1043,37 @@ void CameraSensor::updateControlInfo()
 	updateControls();
 }
 
+/**
+ * \brief Signal to the camera sensor class that a new frame has start exposing
+ * \param[in] sequence The frame sequence number
+ */
+void CameraSensor::frameStart(uint32_t sequence)
+{
+	/* A new capture session requires to start in a clean state. */
+	if (sequence == 0)
+		delayedCtrls_->reset();
+
+	delayedCtrls_->applyControls(sequence);
+}
+
+/**
+ * \brief Push a new set of controls to the CameraSensor
+ * \param[in] ctrls The list of controls to push to the sensor
+ */
+void CameraSensor::pushControls(const ControlList &ctrls)
+{
+	delayedCtrls_->push(ctrls);
+}
+
+/**
+ * \brief Get the list of controls applied at frame \a sequence
+ * \param[in] sequence The frame sequence number
+ */
+ControlList CameraSensor::getControls(uint32_t sequence)
+{
+	return delayedCtrls_->get(sequence);
+}
+
 /**
  * \fn CameraSensor::focusLens()
  * \brief Retrieve the focus lens controller
-- 
2.36.1



More information about the libcamera-devel mailing list