[libcamera-devel] [PATCH v3 09/17] rkisp1: Add camera lens to PH and expose it to the IPA
Jacopo Mondi
jacopo at jmondi.org
Thu Aug 18 11:44:02 CEST 2022
From: Daniel Semkowicz via libcamera-devel <libcamera-devel at lists.libcamera.org>
Check in pipeline handler if camera lens exists, add expose its controls
to the IPA.
Signed-off-by: Daniel Semkowicz <dse at thaumatec.com>
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
---
src/ipa/rkisp1/rkisp1.cpp | 6 ++++++
src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 15d1a40fbb9a..3a98aaf75d98 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -7,6 +7,7 @@
#include <algorithm>
#include <math.h>
+#include <optional>
#include <queue>
#include <stdint.h>
#include <string.h>
@@ -70,6 +71,7 @@ private:
std::map<unsigned int, MappedFrameBuffer> mappedBuffers_;
ControlInfoMap sensorCtrls_;
+ std::optional<ControlInfoMap> lensCtrls_;
/* Camera sensor controls. */
bool autoExposure_;
@@ -206,6 +208,10 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,
sensorCtrls_ = entityControls.at(0);
+ auto lensControls = entityControls.find(1);
+ if (lensControls != entityControls.end())
+ lensCtrls_ = lensControls->second;
+
const auto itExp = sensorCtrls_.find(V4L2_CID_EXPOSURE);
if (itExp == sensorCtrls_.end()) {
LOG(IPARkISP1, Error) << "Can't find exposure control";
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 932873329e89..5f10c26bcb4d 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -28,6 +28,7 @@
#include <libcamera/stream.h>
#include "libcamera/internal/camera.h"
+#include "libcamera/internal/camera_lens.h"
#include "libcamera/internal/camera_sensor.h"
#include "libcamera/internal/delayed_controls.h"
#include "libcamera/internal/device_enumerator.h"
@@ -694,6 +695,10 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c)
std::map<uint32_t, ControlInfoMap> entityControls;
entityControls.emplace(0, data->sensor_->controls());
+ CameraLens *lens = data->sensor_->focusLens();
+ if (lens)
+ entityControls.emplace(1, lens->controls());
+
ret = data->ipa_->configure(sensorInfo, streamConfig, entityControls);
if (ret) {
LOG(RkISP1, Error) << "failed configuring IPA (" << ret << ")";
--
2.37.2
More information about the libcamera-devel
mailing list