[libcamera-devel] [RFC PATCH 07/12] ipa: rkisp1: Convert to use the FCQueue

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Jul 21 14:13:05 CEST 2022


Establish a queue of FrameContexts using the new FCQueue and use it to
supply the FrameContext to the algorithms.

The algorithms on the RKISP1 do not use this yet themselves, but are
able to do so after the introduction of this patch.

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
 src/ipa/rkisp1/ipa_context.h | 2 ++
 src/ipa/rkisp1/rkisp1.cpp    | 9 +++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
index a64dbc75fdd2..dc4fa5d1ddba 100644
--- a/src/ipa/rkisp1/ipa_context.h
+++ b/src/ipa/rkisp1/ipa_context.h
@@ -72,6 +72,8 @@ struct RKISP1FrameContext : public IPAFrameContext {
 struct IPAContext {
 	IPASessionConfiguration configuration;
 	IPAActiveState activeState;
+
+	FCQueue<RKISP1FrameContext> frameContexts;
 };
 
 } /* namespace ipa::rkisp1 */
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 7481e67e70f6..a2b7b25a53e5 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -205,7 +205,9 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,
 		<< " Gain: " << minGain << "-" << maxGain;
 
 	/* Clean context at configuration */
-	context_ = {};
+	context_.configuration = {};
+	context_.activeState = {};
+	context_.frameContexts.clear();
 
 	/* Set the hardware revision for the algorithms. */
 	context_.configuration.hw.revision = hwRevision_;
@@ -290,6 +292,8 @@ void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)
 void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId,
 				   const ControlList &sensorControls)
 {
+	RKISP1FrameContext &frameContext = context_.frameContexts.get(frame);
+
 	const rkisp1_stat_buffer *stats =
 		reinterpret_cast<rkisp1_stat_buffer *>(
 			mappedBuffers_.at(bufferId).planes()[0].data());
@@ -301,9 +305,6 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId
 
 	unsigned int aeState = 0;
 
-	/* \todo Obtain the frame context to pass to process from the FCQueue */
-	RKISP1FrameContext frameContext;
-
 	for (auto const &algo : algorithms())
 		algo->process(context_, frameContext, stats);
 
-- 
2.34.1



More information about the libcamera-devel mailing list