[libcamera-devel,v5,05/33] ipa: libipa: Provide a common base for frame contexts
diff mbox series

Message ID 20220927023642.12341-6-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • ipa: Frame context queue, IPU3 & RkISP consolidation, and RkISP1 improvements
Related show

Commit Message

Laurent Pinchart Sept. 27, 2022, 2:36 a.m. UTC
From: Kieran Bingham <kieran.bingham@ideasonboard.com>

Provide a common FrameContext as a base for IPA modules to inherit from.

This will allow having a common set of parameters for every frame
context managed by the FCQueue implementation.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
---
Changes since v4:

- Move documentation paragraph from previous patch to this one
- Rename IPAFrameContext to FrameContext in documentation

Changes since v3:

- Rename structure from IPAFrameContext to FrameContext
- Move changes to IPA modules to separate patches
- Make the FrameContext::frame member private
---
 src/ipa/libipa/fc_queue.cpp | 22 ++++++++++++++++++++++
 src/ipa/libipa/fc_queue.h   | 10 ++++++++++
 2 files changed, 32 insertions(+)

Patch
diff mbox series

diff --git a/src/ipa/libipa/fc_queue.cpp b/src/ipa/libipa/fc_queue.cpp
index 57a369512554..e812faa505a5 100644
--- a/src/ipa/libipa/fc_queue.cpp
+++ b/src/ipa/libipa/fc_queue.cpp
@@ -20,6 +20,24 @@  namespace ipa {
  * \brief Queue of per-frame contexts
  */
 
+/**
+ * \struct FrameContext
+ * \brief Context for a frame
+ *
+ * The frame context stores data specific to a single frame processed by the
+ * IPA module. Each frame processed by the IPA module has a context associated
+ * with it, accessible through the Frame Context Queue.
+ *
+ * Fields in the frame context should reflect values and controls associated
+ * with the specific frame as requested by the application, and as configured by
+ * the hardware. Fields can be read by algorithms to determine if they should
+ * update any specific action for this frame, and finally to update the metadata
+ * control lists when the frame is fully completed.
+ *
+ * \var FrameContext::frame
+ * \brief The frame number
+ */
+
 /**
  * \class FCQueue
  * \brief A support class for managing FrameContext instances in IPA modules
@@ -65,6 +83,10 @@  namespace ipa {
  * allowed to overflow, which must be ensured by pipeline handlers never
  * queuing more in-flight requests to the IPA module than the queue size. If an
  * overflow condition is detected, the queue will log a fatal error.
+ *
+ * IPA module-specific frame context implementations shall inherit from the
+ * FrameContext base class to support the minimum required features for a
+ * FrameContext.
  */
 
 /**
diff --git a/src/ipa/libipa/fc_queue.h b/src/ipa/libipa/fc_queue.h
index 4f5cb5d35253..a589e7e1031b 100644
--- a/src/ipa/libipa/fc_queue.h
+++ b/src/ipa/libipa/fc_queue.h
@@ -7,6 +7,7 @@ 
 
 #pragma once
 
+#include <stdint.h>
 #include <vector>
 
 #include <libcamera/base/log.h>
@@ -17,6 +18,15 @@  LOG_DECLARE_CATEGORY(FCQueue)
 
 namespace ipa {
 
+template<typename FrameContext>
+class FCQueue;
+
+struct FrameContext {
+private:
+	template<typename T> friend class FCQueue;
+	uint32_t frame;
+};
+
 template<typename FrameContext>
 class FCQueue
 {