[libcamera-devel] [PATCH v3 04/17] ipa: rkisp1: Convert to use the FCQueue

Jacopo Mondi jacopo at jmondi.org
Thu Aug 18 11:43:57 CEST 2022


From: Kieran Bingham via libcamera-devel <libcamera-devel at lists.libcamera.org>

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>
Signed-off-by: Jacopo Mondi <jacopo at jmondi.org>
Reviewed-by: Umang Jain <umang.jain at ideasonboard.com>
---
 src/ipa/rkisp1/ipa_context.h |  2 ++
 src/ipa/rkisp1/rkisp1.cpp    | 15 ++++++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h
index c42bcd73b314..dd756f4025d1 100644
--- a/src/ipa/rkisp1/ipa_context.h
+++ b/src/ipa/rkisp1/ipa_context.h
@@ -86,6 +86,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 c3aa49329693..3d6a6b78bb8d 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -46,7 +46,7 @@ public:
 	int init(const IPASettings &settings, unsigned int hwRevision,
 		 ControlInfoMap *ipaControls) override;
 	int start() override;
-	void stop() override {}
+	void stop() override;
 
 	int configure(const IPACameraSensorInfo &info,
 		      const std::map<uint32_t, IPAStream> &streamConfig,
@@ -186,6 +186,11 @@ int IPARkISP1::start()
 	return 0;
 }
 
+void IPARkISP1::stop()
+{
+	context_.frameContexts.clear();
+}
+
 /**
  * \todo The RkISP1 pipeline currently provides an empty IPACameraSensorInfo
  * if the connected sensor does not provide enough information to properly
@@ -225,7 +230,8 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info,
 		<< "Exposure: " << minExposure << "-" << maxExposure
 		<< " Gain: " << minGain << "-" << maxGain;
 
-	/* Clean context at configuration */
+	/* Clear the IPA context before the streaming session. */
+	context_.frameContexts.clear();
 	context_ = {};
 
 	/* Set the hardware revision for the algorithms. */
@@ -312,6 +318,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());
@@ -323,9 +331,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.37.2



More information about the libcamera-devel mailing list