summaryrefslogtreecommitdiff
path: root/src/ipa/libipa
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>2024-10-16 11:42:31 +0200
committerJacopo Mondi <jacopo.mondi@ideasonboard.com>2024-10-30 15:48:18 +0100
commit38eee6c0ad64abf554235460d55d85a3be74ae9f (patch)
tree15df82e572872d0e42868647eb6b2db295facff3 /src/ipa/libipa
parentff069d87e263cd41f9d5d74774609c8b0ecbcb2a (diff)
libipa: FrameContext: Move init() to FrameContext
The FCtQueue structure initializes a new FrameContext using its init() function. In case of request underrun, where a FrameContext is initialized without application's controls being supplied, the FrameContext needs to be initialized to default values. In order to allow the single IPAs to initialize a FrameContext to the desired default values, move the init() function to the FrameContext structure, which each IPA derives to a per-IPA type. In this way each IPA can override the FrameContext::init() function and initialize the FrameContext to the desired default values. Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Diffstat (limited to 'src/ipa/libipa')
-rw-r--r--src/ipa/libipa/fc_queue.cpp10
-rw-r--r--src/ipa/libipa/fc_queue.h16
2 files changed, 18 insertions, 8 deletions
diff --git a/src/ipa/libipa/fc_queue.cpp b/src/ipa/libipa/fc_queue.cpp
index 0365e919..fa2454fd 100644
--- a/src/ipa/libipa/fc_queue.cpp
+++ b/src/ipa/libipa/fc_queue.cpp
@@ -39,6 +39,16 @@ namespace ipa {
*/
/**
+ * \fn FrameContext::init()
+ * \brief Initialize a frame context
+ * \param[in] frameNum The frame number to assign to this FrameContext
+ *
+ * This function initializes a frame context by assigning it a frame number.
+ * The single IPA modules are expected to override this function to initialize
+ * their derived FrameContext implementation to their desired default values.
+ */
+
+/**
* \class FCQueue
* \brief A support class for managing FrameContext instances in IPA modules
* \tparam FrameContext The IPA module-specific FrameContext derived class type
diff --git a/src/ipa/libipa/fc_queue.h b/src/ipa/libipa/fc_queue.h
index 24d9e82b..b1e8bc14 100644
--- a/src/ipa/libipa/fc_queue.h
+++ b/src/ipa/libipa/fc_queue.h
@@ -22,6 +22,12 @@ template<typename FrameContext>
class FCQueue;
struct FrameContext {
+protected:
+ virtual void init(const uint32_t frameNum)
+ {
+ frame = frameNum;
+ }
+
private:
template<typename T> friend class FCQueue;
uint32_t frame;
@@ -61,7 +67,7 @@ public:
LOG(FCQueue, Warning)
<< "Frame " << frame << " already initialised";
else
- init(frameContext, frame);
+ frameContext.init(frame);
return frameContext;
}
@@ -98,18 +104,12 @@ public:
LOG(FCQueue, Warning)
<< "Obtained an uninitialised FrameContext for " << frame;
- init(frameContext, frame);
+ frameContext.init(frame);
return frameContext;
}
private:
- void init(FrameContext &frameContext, const uint32_t frame)
- {
- frameContext = {};
- frameContext.frame = frame;
- }
-
std::vector<FrameContext> contexts_;
};