From patchwork Tue Mar 24 14:32:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 26324 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A40A3C32DE for ; Tue, 24 Mar 2026 15:17:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DFD7762790; Tue, 24 Mar 2026 16:17:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="lHZ8tF6X"; dkim-atps=neutral Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F0E566277D for ; Tue, 24 Mar 2026 16:17:18 +0100 (CET) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-486ff3a0fc1so35172645e9.2 for ; Tue, 24 Mar 2026 08:17:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1774365438; x=1774970238; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6aADIWBAWxWqOxkg3S/oIUwyQIh5VxmPUzgQyo+Vg5M=; b=lHZ8tF6X3107F424gmPji4pT542umVZgTImJvuu4tZUEt7hBRqW6SGtzSHY/sWj+7q As+IQJrrkY+2Z2MtuanaEmYyvbTfM+OnCwr+EU8JMUxfoFyZkQmx+JC2v5yXB8qPb5HX KQQPwWcK8zOEB+4i01ZWfYZD4IXmnOrsOfGR2WrVqcf7xqRIJ3RI2I/u4/zejOd/Pbhl e3mgVj3TOnkn52YCopCH9OZFjKziscDqFiToQ6QY0TuPBBf1ZNnUv2OJQ+ULdyQOok2F e87YnQR1EGappiVa864zZWogbmibK7r8eZPkNZFaJBPFfZ6/8Jt526hnEoD6xDhT1Ig5 wRCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774365438; x=1774970238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=6aADIWBAWxWqOxkg3S/oIUwyQIh5VxmPUzgQyo+Vg5M=; b=SmAikSdcZ4xjWfyHiE7ONlKpdUdfwyce4d7fm1bVzxg3Ua6wTK0XW0pnilKu3FM/1F OnrkrtpDLdRS/+E353h9vzWEiwwMdxc4RjhMD6y8yubBgsRYZkyXkTyPbolh7hWIpsof b37j3ZpOgySlHML6UsINtGzMYQTtXkcNXqOFwZfExLqz7scxoXE04MxsWW2cXqs1KPe1 T0AvQTVs98mGrDw6eorpokr4/Pw2/1scV0iA8jLcfQGnduwC8JpSbi8hXHgT/TCFv/x/ gy502HzR88ELZ2zk1DRfwZQaNOov8thkIZiloQA4C+uCfDJacpjj6s/KaO9pFMMS+6si HDwQ== X-Gm-Message-State: AOJu0YzOkEz0Ogu1S9WSTU2KuLY07fn5h44BdiEQebITog3aZrzMa7Da CnaPKm6FRrjtHdiw1VG2sViIrPsVCFZv7TT2aeiRSImketQiMysogvU6EiABL/bJhgqxift5VPx MYXyZ X-Gm-Gg: ATEYQzxVfWe8+nH3LHfPIhTJpdI7LH9ffRLJwqIdYBa+jCNcZX2Y5MCFKkYW8s01+Cf BRjzdt0Kg+MFYJPGSyDLiiqfTI3HR86xjb7HORrBvAK4+N35BjGfTImP67WPiTDBqzWIV7F6Hv7 04pHqaFpQLthYLDcKiY7pjRtF6D/5FjwGWolWrja5FaMTQje2s8MuSSfKWdP439ougtvVeBU8d8 lAy8yGQB1kjuE14t11bU+AOy/IRXNm3e57QX9mAkCcUZC9Rf7Zd3hh1S2eiyo3riq8TAmrzHAC7 +zcj2QrxpZXCH3zqWGpRZoEcMcYaoezkyLW03oDyrywk5JaFcezIxEdY86YSR5GiJABF0DM81BK Q6J5SphQNvWRd/XGLVP4EDVgXYTYEu+9IGb+0nfOScA5Nn5KFfHCyR25B7Glp7rwfqonWWZuxUV uQQNm7+o1l0sH9v4P6XyX9G8WqQb0S4Utez4ZB49NSpqEKhh/0wsA4J+xvLHYJWczeyKeqNK6uW QEcJeB0S+gaZwmgF9OOf7StXPrxsmj4t/NFpiCJDg== X-Received: by 2002:a05:600c:1d02:b0:487:716:2fa2 with SMTP id 5b1f17b1804b1-48716039accmr1911365e9.16.1774365438088; Tue, 24 Mar 2026 08:17:18 -0700 (PDT) Received: from davidp-pi5.pitowers.org ([2a00:1098:3142:1f:88ea:c658:5b20:5e46]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-487116c44bfsm63826065e9.9.2026.03.24.08.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 08:17:17 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Cc: David Plowman Subject: [PATCH v1 1/3] pipeline: rpi: Simplify delayed controls Date: Tue, 24 Mar 2026 14:32:07 +0000 Message-ID: <20260324151714.3345-2-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260324151714.3345-1-david.plowman@raspberrypi.com> References: <20260324151714.3345-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The queueCount field in the DelayedControls is actually redundant. Remove it. Signed-off-by: David Plowman --- .../pipeline/rpi/common/delayed_controls.cpp | 22 +++++++++---------- .../pipeline/rpi/common/delayed_controls.h | 1 - 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/libcamera/pipeline/rpi/common/delayed_controls.cpp b/src/libcamera/pipeline/rpi/common/delayed_controls.cpp index 19c71946..c06bd784 100644 --- a/src/libcamera/pipeline/rpi/common/delayed_controls.cpp +++ b/src/libcamera/pipeline/rpi/common/delayed_controls.cpp @@ -119,7 +119,6 @@ DelayedControls::DelayedControls(V4L2Device *device, */ void DelayedControls::reset(unsigned int cookie) { - queueCount_ = 1; writeCount_ = 0; cookies_[0] = cookie; @@ -155,8 +154,8 @@ bool DelayedControls::push(const ControlList &controls, const unsigned int cooki { /* Copy state from previous frame. */ for (auto &ctrl : values_) { - Info &info = ctrl.second[queueCount_]; - info = values_[ctrl.first][queueCount_ - 1]; + Info &info = ctrl.second[writeCount_]; + info = values_[ctrl.first][writeCount_ - 1]; info.updated = false; } @@ -175,18 +174,17 @@ bool DelayedControls::push(const ControlList &controls, const unsigned int cooki if (controlParams_.find(id) == controlParams_.end()) return false; - Info &info = values_[id][queueCount_]; + Info &info = values_[id][writeCount_]; info = Info(control.second); LOG(RPiDelayedControls, Debug) << "Queuing " << id->name() << " to " << info.toString() - << " at index " << queueCount_; + << " at index " << writeCount_; } - cookies_[queueCount_] = cookie; - queueCount_++; + cookies_[writeCount_] = cookie; return true; } @@ -277,12 +275,12 @@ void DelayedControls::applyControls(uint32_t sequence) } } - writeCount_ = sequence + 1; - - while (writeCount_ > queueCount_) { + while (writeCount_ < sequence + 1) { + writeCount_++; LOG(RPiDelayedControls, Debug) - << "Queue is empty, auto queue no-op."; - push({}, cookies_[queueCount_ - 1]); + << "Pushing noop with for index " << writeCount_ + << " with cookie " << cookies_[writeCount_ - 1]; + push({}, cookies_[writeCount_ - 1]); } device_->setControls(&out); diff --git a/src/libcamera/pipeline/rpi/common/delayed_controls.h b/src/libcamera/pipeline/rpi/common/delayed_controls.h index 487b0057..48ad5a0f 100644 --- a/src/libcamera/pipeline/rpi/common/delayed_controls.h +++ b/src/libcamera/pipeline/rpi/common/delayed_controls.h @@ -76,7 +76,6 @@ private: std::unordered_map controlParams_; unsigned int maxDelay_; - uint32_t queueCount_; uint32_t writeCount_; std::unordered_map> values_; RingBuffer cookies_;