[libcamera-devel,3/4] ipa: ipu3: Mark the beginning and end of a frame
diff mbox series

Message ID 20220103170956.323025-4-umang.jain@ideasonboard.com
State Superseded
Delegated to: Umang Jain
Headers show
Series
  • IPAIPU3 - Rework interface and introduce context
Related show

Commit Message

Umang Jain Jan. 3, 2022, 5:09 p.m. UTC
From: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>

Introduce the skeleton for two functions which will be used to
instantiate a frame context, and do everything needed when a frame is
received. Do the same for the other end, once the algorithms have run
and updated the frame context to later deallocate the corresponding
frame context.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
---
 src/ipa/ipu3/ipu3.cpp | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Patch
diff mbox series

diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp
index 4f03d7e9..fa40c41f 100644
--- a/src/ipa/ipu3/ipu3.cpp
+++ b/src/ipa/ipu3/ipu3.cpp
@@ -162,6 +162,14 @@  private:
 	void setControls(unsigned int frame);
 	void calculateBdsGrid(const Size &bdsOutputSize);
 
+	/*
+	 * Internal events that mark the beginning of processing a new frame
+	 * to the point that it has successfully completed processing its
+	 * statistics.
+	 */
+	void frameStarted(const uint32_t frame);
+	void frameCompleted(const uint32_t frame);
+
 	std::map<unsigned int, MappedFrameBuffer> buffers_;
 
 	ControlInfoMap ctrls_;
@@ -508,6 +516,14 @@  void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)
 	}
 }
 
+void IPAIPU3::frameStarted([[maybe_unused]] const uint32_t frame)
+{
+}
+
+void IPAIPU3::frameCompleted([[maybe_unused]] const uint32_t frame)
+{
+}
+
 /**
  * \brief Prepare the ISP to process the Request
  * \param[in] frame The frame number
@@ -566,6 +582,15 @@  void IPAIPU3::processControls(const uint32_t frame,
 			      [[maybe_unused]] const ControlList &controls)
 {
 	/* \todo Start processing for 'frame' based on 'controls'. */
+
+	/*
+	 * To save incurring extra IPC calls, we do not send explicit events
+	 * when a new request is started or completed.
+	 * ProcessControls is the first event handled upon receipt of a new
+	 * request, so we can handle all actions required to start processing
+	 * a new frame.
+	 */
+	frameStarted(frame);
 }
 
 /**
@@ -635,6 +660,14 @@  void IPAIPU3::parseStatistics(unsigned int frame,
 	 */
 
 	metadataReady.emit(frame, ctrls);
+
+	/*
+	 * To save incurring extra IPC calls, we do not send explicit events
+	 * when we have completed all handling of a request.
+	 * Once the statistics are fully processed, we will no longer handle this
+	 * frame.
+	 */
+	frameCompleted(frame);
 }
 
 /**