[libcamera-devel,v3,5/8] libcamera: pipeline: rkisp1: Support the new AE controls
diff mbox series

Message ID 20211221043610.2512334-6-paul.elder@ideasonboard.com
State New
Delegated to: Paul Elder
Headers show
Series
  • The Great AE Changes
Related show

Commit Message

Paul Elder Dec. 21, 2021, 4:36 a.m. UTC
Add support for the new AE controls in the rkisp1 pipeline handler, and
in the IPA.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=42
Bug: https://bugs.libcamera.org/show_bug.cgi?id=43
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>

---
No change in v2

Initial version:
It seems that the rkisp1 pipeline handler doesn't properly expose its
control capabilities? And even though it exposed AeEnable with both true
and false it didn't expose or handle AnalogueGain nor ExposureTime
either? So I just simply replaced AeEnable with ExposureTimeMode for
now.
---
 src/ipa/rkisp1/rkisp1.cpp                | 9 ++++-----
 src/libcamera/pipeline/rkisp1/rkisp1.cpp | 4 ++--
 2 files changed, 6 insertions(+), 7 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 2d79f15f..245e9940 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -60,7 +60,7 @@  private:
 			      const rkisp1_stat_buffer *stats);
 
 	void setControls(unsigned int frame);
-	void metadataReady(unsigned int frame, unsigned int aeState);
+	void metadataReady(unsigned int frame, int aeState);
 
 	std::map<unsigned int, FrameBuffer> buffers_;
 	std::map<unsigned int, MappedFrameBuffer> mappedBuffers_;
@@ -289,7 +289,7 @@  void IPARkISP1::queueRequest(unsigned int frame, rkisp1_params_cfg *params,
 void IPARkISP1::updateStatistics(unsigned int frame,
 				 const rkisp1_stat_buffer *stats)
 {
-	unsigned int aeState = 0;
+	int aeState = controls::AeStateInactive;
 
 	for (auto const &algo : algorithms_)
 		algo->process(context_, stats);
@@ -315,12 +315,11 @@  void IPARkISP1::setControls(unsigned int frame)
 	queueFrameAction.emit(frame, op);
 }
 
-void IPARkISP1::metadataReady(unsigned int frame, unsigned int aeState)
+void IPARkISP1::metadataReady(unsigned int frame, int aeState)
 {
 	ControlList ctrls(controls::controls);
 
-	if (aeState)
-		ctrls.set(controls::AeLocked, aeState == 2);
+	ctrls.set(controls::AeState, aeState);
 
 	RkISP1Action op;
 	op.op = ActionMetadata;
diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
index 8cca8a15..659ece06 100644
--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
@@ -935,8 +935,8 @@  int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor)
 
 	ControlInfoMap::Map ctrls;
 	ctrls.emplace(std::piecewise_construct,
-		      std::forward_as_tuple(&controls::AeEnable),
-		      std::forward_as_tuple(false, true));
+		      std::forward_as_tuple(&controls::ExposureTimeMode),
+		      std::forward_as_tuple(ControlInfo(controls::AeExposureModeValues)));
 
 	data->controlInfo_ = ControlInfoMap(std::move(ctrls),
 					    controls::controls);