[libcamera-devel] [PATCH v2 2/3] rkisp1: Add camera lens to PH and expose it to the IPA

Daniel Semkowicz dse at thaumatec.com
Tue Aug 9 16:47:03 CEST 2022


Check in pipeline handler if camera lens exists, add expose its controls
to the IPA.

Signed-off-by: Daniel Semkowicz <dse at thaumatec.com>
---
 src/ipa/rkisp1/rkisp1.cpp                | 7 +++++++
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 5 +++++
 2 files changed, 12 insertions(+)

diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index ee484845..9e4c48a2 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_;
@@ -201,6 +203,11 @@ 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 93287332..5f10c26b 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.34.1



More information about the libcamera-devel mailing list