[v3,35/41] libipa: fc_queue: Early out on first context
diff mbox series

Message ID 20260914140309.3354666-36-stefan.klug@ideasonboard.com
State New
Headers show
Series
  • rkisp1: pipeline rework for PFC
Related show

Commit Message

Stefan Klug Sept. 14, 2026, 2:02 p.m. UTC
Handle the special case of an uninitialized FCQueue separately, to make
the following logic easier to follow. This is a preparatory patch and no
functional changes are intended.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
---
 src/ipa/libipa/fc_queue.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/src/ipa/libipa/fc_queue.h b/src/ipa/libipa/fc_queue.h
index 633bf646d88d..796ab656cf40 100644
--- a/src/ipa/libipa/fc_queue.h
+++ b/src/ipa/libipa/fc_queue.h
@@ -59,6 +59,14 @@  public:
 		FC &fc = contexts_[frame % contexts_.size()];
 		FrameContext &frameContext = fc;
 
+		if (!initialized_) {
+			fc = {};
+			frameContext.frame_ = frame;
+			initCallback_(fc, controls);
+			initialized_ = true;
+			return fc;
+		}
+
 		/*
 		 * If the IPA algorithms try to access a frame context slot which
 		 * has been already overwritten by a newer context, it means the
@@ -72,7 +80,7 @@  public:
 					    << " has been overwritten by "
 					    << frameContext.frame_;
 
-		if (initialized_ && frame == frameContext.frame_) {
+		if (frame == frameContext.frame_) {
 			if (!controls.empty()) {
 				/* Too late to apply the controls. Store them for later. */
 				LOG(FCQueue, Warning)
@@ -97,7 +105,6 @@  public:
 		fc = {};
 		frameContext.frame_ = frame;
 		initCallback_(fc, *controls2);
-		initialized_ = true;
 		controlsToApply_.clear();
 
 		return fc;