[libcamera-devel,v3,07/17] ipa: libipa: algorithm: queueRequest(): Pass frame context
diff mbox series

Message ID 20220818094410.1671-8-jacopo@jmondi.org
State Accepted
Headers show
Series
  • libcamera: Align IPU3 and RKISP1 interfaces
Related show

Commit Message

Jacopo Mondi Aug. 18, 2022, 9:44 a.m. UTC
From: Kieran Bingham via libcamera-devel <libcamera-devel@lists.libcamera.org>

IPA modules have access to incoming Request's controls list and
need to store them in the frame context at queueRequest() time.

As each algorithm is expected to have ownership of a certain set of
controls it should have access to the frame context where they have been
stored, and where the algorithm computation results can be stored to
later populate metadata.

Now that both the IPU3 and RkISP1 IPA modules comply with the same
interface, propagate the queueRequest() call to algorithms in the IPU3
IPA module.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
---
 src/ipa/ipu3/ipu3.cpp                | 5 ++---
 src/ipa/libipa/algorithm.cpp         | 1 +
 src/ipa/libipa/algorithm.h           | 1 +
 src/ipa/rkisp1/algorithms/cproc.cpp  | 1 +
 src/ipa/rkisp1/algorithms/cproc.h    | 1 +
 src/ipa/rkisp1/algorithms/filter.cpp | 1 +
 src/ipa/rkisp1/algorithms/filter.h   | 1 +
 src/ipa/rkisp1/rkisp1.cpp            | 4 +++-
 8 files changed, 11 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index 874d82c873ed..eabf179aaa0a 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -658,9 +658,8 @@  void IPAIPU3::queueRequest(const uint32_t frame, const ControlList &controls)
 	/* \todo Start processing for 'frame' based on 'controls'. */
 	IPU3FrameContext &frameContext = context_.frameContexts.initialise(frame);
 
-	/* \todo Implement queueRequest to each algorithm. */
-	(void)frameContext;
-	(void)controls;
+	for (auto const &algo : algorithms())
+		algo->queueRequest(context_, frame, frameContext, controls);
 }
 
 /**
diff --git a/src/ipa/libipa/algorithm.cpp b/src/ipa/libipa/algorithm.cpp
index 30eab67f71fc..c152b885aee1 100644
--- a/src/ipa/libipa/algorithm.cpp
+++ b/src/ipa/libipa/algorithm.cpp
@@ -88,6 +88,7 @@  namespace ipa {
  * \brief Provide control values to the algorithm
  * \param[in] context The shared IPA context
  * \param[in] frame The frame number to apply the control values
+ * \param[in] frameContext The current frame's context
  * \param[in] controls The list of user controls
  *
  * This function is called for each request queued to the camera. It provides
diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h
index c2d990707b25..f92829ad7ac6 100644
--- a/src/ipa/libipa/algorithm.h
+++ b/src/ipa/libipa/algorithm.h
@@ -46,6 +46,7 @@  public:
 
 	virtual void queueRequest([[maybe_unused]] typename Module::Context &context,
 				  [[maybe_unused]] const uint32_t frame,
+				  [[maybe_unused]] typename Module::FrameContext &frameContext,
 				  [[maybe_unused]] const ControlList &controls)
 	{
 	}
diff --git a/src/ipa/rkisp1/algorithms/cproc.cpp b/src/ipa/rkisp1/algorithms/cproc.cpp
index edaf2d10e850..c0792926f9eb 100644
--- a/src/ipa/rkisp1/algorithms/cproc.cpp
+++ b/src/ipa/rkisp1/algorithms/cproc.cpp
@@ -38,6 +38,7 @@  LOG_DEFINE_CATEGORY(RkISP1CProc)
  */
 void ColorProcessing::queueRequest(IPAContext &context,
 				   [[maybe_unused]] const uint32_t frame,
+				   [[maybe_unused]] RKISP1FrameContext &frameContext,
 				   const ControlList &controls)
 {
 	auto &cproc = context.activeState.cproc;
diff --git a/src/ipa/rkisp1/algorithms/cproc.h b/src/ipa/rkisp1/algorithms/cproc.h
index fde83f3c965c..13f8967e70a8 100644
--- a/src/ipa/rkisp1/algorithms/cproc.h
+++ b/src/ipa/rkisp1/algorithms/cproc.h
@@ -22,6 +22,7 @@  public:
 	~ColorProcessing() = default;
 
 	void queueRequest(IPAContext &context, const uint32_t frame,
+			  RKISP1FrameContext &frameContext,
 			  const ControlList &controls) override;
 	void prepare(IPAContext &context, unsigned int frame,
 		     RKISP1FrameContext &frameContext,
diff --git a/src/ipa/rkisp1/algorithms/filter.cpp b/src/ipa/rkisp1/algorithms/filter.cpp
index f6577046442a..8c5af213d6d0 100644
--- a/src/ipa/rkisp1/algorithms/filter.cpp
+++ b/src/ipa/rkisp1/algorithms/filter.cpp
@@ -44,6 +44,7 @@  static constexpr uint32_t kFiltModeDefault = 0x000004f2;
  */
 void Filter::queueRequest(IPAContext &context,
 			  [[maybe_unused]] const uint32_t frame,
+			  [[maybe_unused]] RKISP1FrameContext &frameContext,
 			  const ControlList &controls)
 {
 	auto &filter = context.activeState.filter;
diff --git a/src/ipa/rkisp1/algorithms/filter.h b/src/ipa/rkisp1/algorithms/filter.h
index 1fbe785a3cab..b10efa208a48 100644
--- a/src/ipa/rkisp1/algorithms/filter.h
+++ b/src/ipa/rkisp1/algorithms/filter.h
@@ -22,6 +22,7 @@  public:
 	~Filter() = default;
 
 	void queueRequest(IPAContext &context, const uint32_t frame,
+			  RKISP1FrameContext &frameContext,
 			  const ControlList &controls) override;
 	void prepare(IPAContext &context, unsigned int frame,
 		     RKISP1FrameContext &frameContext,
diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp
index 7ed69ca15960..724b0ffb6ace 100644
--- a/src/ipa/rkisp1/rkisp1.cpp
+++ b/src/ipa/rkisp1/rkisp1.cpp
@@ -295,8 +295,10 @@  void IPARkISP1::unmapBuffers(const std::vector<unsigned int> &ids)
 
 void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls)
 {
+	RKISP1FrameContext &frameContext = context_.frameContexts.initialise(frame);
+
 	for (auto const &algo : algorithms())
-		algo->queueRequest(context_, frame, controls);
+		algo->queueRequest(context_, frame, frameContext, controls);
 }
 
 void IPARkISP1::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)