From patchwork Tue Sep 8 11:00:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Danius Kalvaitis X-Patchwork-Id: 28202 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 918FBC3257 for ; Tue, 8 Sep 2026 11:01:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 699EB68622; Tue, 8 Sep 2026 13:01:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=kurokesu.com header.i=@kurokesu.com header.b="Z+DENeFA"; dkim-atps=neutral Received: from srv2.kurokesu.com (srv2.kurokesu.com [IPv6:2a02:7b40:592f:a62d::1]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4D5F668244 for ; Tue, 8 Sep 2026 13:01:47 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by srv2.kurokesu.com (Postfix) with ESMTP id 7661733D4; Tue, 8 Sep 2026 14:01:46 +0300 (EEST) Authentication-Results: srv2.kurokesu.com (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=kurokesu.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurokesu.com; h= content-transfer-encoding:mime-version:x-mailer:message-id:date :date:subject:subject:from:from; s=default; t=1788865306; x= 1790679707; bh=8p1yNIEmB8k/vvTg+vniGWpvajXaay2Vw/4OJt55X7s=; b=Z +DENeFAUgogc/H6FgF/Rc3mG+0uRN2XIg825P+oxRbi/Qqx00A+MyolO6L/90wPQ Bb2HoHAKNU+YDe5JY2uDKv66l4ON/7M5SdGtn+5QVOFAtB7E5QrFsyrc8Idpysx1 6fP0L6zNcTuFqx8sYketzEWp1qgJtbnh8Xt0dbmMr4= X-Virus-Scanned: Debian amavisd-new at srv2.kurokesu.com Received: from srv2.kurokesu.com ([127.0.0.1]) by localhost (srv2.kurokesu.com [127.0.0.1]) (amavisd-new, port 10026) with LMTP id bLbi28nbetA9; Tue, 8 Sep 2026 14:01:46 +0300 (EEST) Received: from shelfpi.vpn2.kurokesu.com (unknown [IPv6:2a00:f502:272:c9bd:a2fd:62f3:5793:4]) (Authenticated sender: danius@kurokesu.com) by srv2.kurokesu.com (Postfix) with ESMTPSA id B19DD1B2A; Tue, 8 Sep 2026 14:01:44 +0300 (EEST) From: Danius Kalvaitis To: libcamera-devel@lists.libcamera.org Cc: David Plowman , Naushir Patuck , Jacopo Mondi , Danius Kalvaitis Subject: [PATCH] pipeline: rpi: Clear immediate controls queue on stop Date: Tue, 8 Sep 2026 14:00:37 +0300 Message-ID: <20260908110037.34655-1-danius@kurokesu.com> X-Mailer: git-send-email 2.47.3 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" Immediate controls wait in a queue keyed by request sequence until delayContext catches up. The queue was not cleared on stop while request sequence numbers restart from zero, so stale entries blocked every immediate control of the next session until it outlasted the old one. Fixes: b0dbd5100b1b ("pipeline: rpi: Make control lists in requests properly atomic") Signed-off-by: Danius Kalvaitis --- Reproduced on a Pi 5 with an IMX477, where ColourGains sent through a request after a restart took as many frames to apply as the previous session had run. David, this overlaps with your ControlList queues in https://github.com/raspberrypi/libcamera/pull/351, which probably need clearing on stop too. src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 6 ++++++ src/libcamera/pipeline/rpi/common/pipeline_base.h | 1 + 2 files changed, 7 insertions(+) base-commit: aebe4861c087ce9a0cb417151d5316a1fdb2e792 diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index 71f3f26a..83a684bd 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -734,6 +734,7 @@ void PipelineHandlerBase::stopDevice(Camera *camera) data->frontendDevice()->setFrameStartEnabled(false); data->clearIncompleteRequests(); + data->clearImmediateControls(); /* Stop the IPA. */ data->ipa_->stop(); @@ -1426,6 +1427,11 @@ void CameraData::clearIncompleteRequests() } } +void CameraData::clearImmediateControls() +{ + immediateControls_ = {}; +} + void CameraData::handleStreamBuffer(FrameBuffer *buffer, RPi::Stream *stream) { /* diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h index ca12a487..7b872555 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.h +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h @@ -89,6 +89,7 @@ public: void frameStarted(uint32_t sequence); void clearIncompleteRequests(); + void clearImmediateControls(); void handleStreamBuffer(FrameBuffer *buffer, Stream *stream); void handleState();