From 35fdd26eebef3e73a0e227bab407124cce8917b8 Mon Sep 17 00:00:00 2001 From: Jacopo Mondi Date: Wed, 16 Oct 2024 11:42:31 +0200 Subject: 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 --- src/ipa/libipa/fc_queue.cpp | 10 ++++++++++ src/ipa/libipa/fc_queue.h | 18 +++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) (limited to 'src/ipa/libipa') diff --git a/src/ipa/libipa/fc_queue.cpp b/src/ipa/libipa/fc_queue.cpp index 0365e919..41c563dd 100644 --- a/src/ipa/libipa/fc_queue.cpp +++ b/src/ipa/libipa/fc_queue.cpp @@ -38,6 +38,16 @@ namespace ipa { * \brief The frame number */ +/** + * \fn FrameContext::init() + * \param[in] frameNum The frame number to assign to this FrameContext + * \brief Initialize a frame context + * + * 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 diff --git a/src/ipa/libipa/fc_queue.h b/src/ipa/libipa/fc_queue.h index 24d9e82b..573ef1e0 100644 --- a/src/ipa/libipa/fc_queue.h +++ b/src/ipa/libipa/fc_queue.h @@ -22,6 +22,12 @@ template class FCQueue; struct FrameContext { +protected: + virtual void init(const uint32_t frameNum) + { + frame = frameNum; + } + private: template 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; - } - +protected: std::vector contexts_; }; -- cgit v1.2.1