[PATCH 6/6] libcamera: pipelines: Draw control delays from CameraSensor properties
Daniel Scally
dan.scally at ideasonboard.com
Thu Oct 31 17:07:41 CET 2024
Rather than hard coding default delays for control values in the
pipeline handlers, pick up the ones defined in the CameraSensor
properties.
Signed-off-by: Daniel Scally <dan.scally at ideasonboard.com>
---
I note that the simple pipeline handler had a Gain delay of 2 rather than the
standard 1...I don't think the difference from the norm is correct but thought
I would highlight it in case I'm mistaken.
src/libcamera/pipeline/ipu3/ipu3.cpp | 11 ++++-------
src/libcamera/pipeline/rkisp1/rkisp1.cpp | 12 +++++-------
src/libcamera/pipeline/simple/simple.cpp | 7 +++++--
3 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 29d3c6c1..ff58ba28 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -1077,14 +1077,11 @@ int PipelineHandlerIPU3::registerCameras()
if (ret)
continue;
- /*
- * \todo Read delay values from the sensor itself or from a
- * a sensor database. For now use generic values taken from
- * the Raspberry Pi and listed as 'generic values'.
- */
+ unsigned int gainDelay = data->properties_.get(properties::GainDelay).value();
+ unsigned int exposureDelay = data->properties_.get(properties::ExposureDelay).value();
std::unordered_map<uint32_t, DelayedControls::ControlParams> params = {
- { V4L2_CID_ANALOGUE_GAIN, { 1, false } },
- { V4L2_CID_EXPOSURE, { 2, false } },
+ { V4L2_CID_ANALOGUE_GAIN, { gainDelay, false } },
+ { V4L2_CID_EXPOSURE, { exposureDelay, false } },
};
data->delayedCtrls_ =
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index c7b0b392..43e1315f 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -24,6 +24,7 @@
#include <libcamera/control_ids.h>
#include <libcamera/formats.h>
#include <libcamera/framebuffer.h>
+#include <libcamera/property_ids.h>
#include <libcamera/request.h>
#include <libcamera/stream.h>
#include <libcamera/transform.h>
@@ -1240,14 +1241,11 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
/* Initialize the camera properties. */
data->properties_ = data->sensor_->properties();
- /*
- * \todo Read delay values from the sensor itself or from a
- * a sensor database. For now use generic values taken from
- * the Raspberry Pi and listed as generic values.
- */
+ unsigned int gainDelay = data->properties_.get(properties::GainDelay).value();
+ unsigned int exposureDelay = data->properties_.get(properties::ExposureDelay).value();
std::unordered_map<uint32_t, DelayedControls::ControlParams> params = {
- { V4L2_CID_ANALOGUE_GAIN, { 1, false } },
- { V4L2_CID_EXPOSURE, { 2, false } },
+ { V4L2_CID_ANALOGUE_GAIN, { gainDelay, false } },
+ { V4L2_CID_EXPOSURE, { exposureDelay, false } },
};
data->delayedCtrls_ =
diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 3ddce71d..20c97c37 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -26,6 +26,7 @@
#include <libcamera/camera.h>
#include <libcamera/control_ids.h>
+#include <libcamera/property_ids.h>
#include <libcamera/request.h>
#include <libcamera/stream.h>
@@ -1286,9 +1287,11 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
if (outputCfgs.empty())
return 0;
+ unsigned int gainDelay = data->properties_.get(properties::GainDelay).value();
+ unsigned int exposureDelay = data->properties_.get(properties::ExposureDelay).value();
std::unordered_map<uint32_t, DelayedControls::ControlParams> params = {
- { V4L2_CID_ANALOGUE_GAIN, { 2, false } },
- { V4L2_CID_EXPOSURE, { 2, false } },
+ { V4L2_CID_ANALOGUE_GAIN, { gainDelay, false } },
+ { V4L2_CID_EXPOSURE, { exposureDelay, false } },
};
data->delayedCtrls_ =
std::make_unique<DelayedControls>(data->sensor_->device(),
--
2.30.2
More information about the libcamera-devel
mailing list