From patchwork Fri Jun 26 00:37:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Allen X-Patchwork-Id: 27038 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 AB9EAC3264 for ; Fri, 26 Jun 2026 00:37:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 73062658D1; Fri, 26 Jun 2026 02:37:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=googlemail.com header.i=@googlemail.com header.b="k+3J6B7L"; dkim-atps=neutral Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2B704658C5 for ; Fri, 26 Jun 2026 02:37:16 +0200 (CEST) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-46cacc39191so101764f8f.0 for ; Thu, 25 Jun 2026 17:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20251104; t=1782434236; x=1783039036; darn=lists.libcamera.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=rWAwHULZ1wiKIxC9iBzivs8WOUmYC1Q6/xiTdP58SIg=; b=k+3J6B7LEe1vizSSa4FQJ60pH47v3FTBKbN5HDQHaR84eGW3Fa3r1rqQvdNZx2hgTT 6s3lFxz3S1pOBmX2MpOw6JkfR6joRWyB/sJ2q4uO5glhWA+Rv7PSpE6VqwZND9sG8+91 S6fYQVaOT5CwH0N0QHFZVADpo8h4Amgf29J27twPkDMmKDxdAFxr99tok9Qc7E9R5YF1 xkpgFlrGZq2WAzOEKEZ8GasyH9cfnsSo5V7FiPp+g5oy6F+lRlBExLzipJ8snvNvX29b n5lrfCoOGjN/JUSq8dhxFmQ1jxNs+fo4aPbl6pQObolURKqmPIJuM71q+pO5YNxmFrWf pbAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782434236; x=1783039036; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=rWAwHULZ1wiKIxC9iBzivs8WOUmYC1Q6/xiTdP58SIg=; b=A2B5XoP2EezF9Lvq2xIz0ETUflZ91SHBMbJ/Kqgg+TdYbsnBkt4ftqiPsxlGGtfl49 ZTxsibrI+Vc7wI8L+qxvbZTXb9qwzlJlJcJeAyJ7Qum1E6h23J373OBL77C4dPGQgDv5 prats9UrPq65xK5Uqs2IGmkMuR/yzVOC6axsA3m4OfixzgNwM2fbBTZuN3zVQZMOI4eR mMyhdDjS7KXYl1dU5t32VlT79BiSu83hyPXmoYCiZAS8TpXqYVcIfrMkn5WKuVF7bwUn FPWZWKes2D5sGjoHzHl14D4D9ftOqSsxF1SAhau5HG/EzGqP0STW6a6o450f9vSmvXD4 y2Og== X-Gm-Message-State: AOJu0Yzy3Kx8pYFDZ1ADN/d/i06zK7OoTT2R+cR+LBeJfFe1v3VdU9rk oUCvXa8QadFjWY2TqfcNjRjVjSf/jFHfCBCw5fjRz6H+QVhazbkil+kIQOIcng== X-Gm-Gg: AfdE7ckenEj57VCXB+elzA3eSW8bznN5m+k0OcfP3Y42TKDN2KgNZ54q5xPOyEmUtQ3 8Cjy89srrveQPEiBy2ZdGjSMw4cJMbz2s2/kiL+tcQ7dq0GMlS1cswZ4cQvQc8zpmhR9hTGuPjS jGJKD4p7t2TUh7tQtZszRNTMu67B21MUA6H/UaU4iENOXpFR3tv3JlenoR6z0Q0guY6dw3EDAPt V/iSWoQzWHGiANugV8LUyVbqs6fAIK68UqNO7ctIis/8U6MX6qWwyK52OlItrXVEK6B5v7Naksq +zsaEXHlxNEVUVOzqc75i7uqkTae016/7G784ZG7mgj85VRC1BroniDMtaLBrNg+BN8BwbaRvi0 CDKcJxBG0RDS8AI/v4dRtdtKXRde1+/Dx3YNQl4vR8sHhruCyzDKrHX/KZF4A6ChyYqiRhbeAuP t/vVzPDbUZvJWpxNjLp6Nm+GXB9Iw7V9XcRHAdMhFTmdVk4ujIGhClG18N5dmi+Stpv6x5kNPcB nqiTy3DseSHNB25 X-Received: by 2002:a05:6000:2904:b0:462:caf6:8d06 with SMTP id ffacd0b85a97d-46a7e9f3ea0mr25572542f8f.3.1782434235674; Thu, 25 Jun 2026 17:37:15 -0700 (PDT) Received: from localhost.localdomain (p5ddcc513.dip0.t-ipconnect.de. [93.220.197.19]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-46f0db007b3sm762055f8f.2.2026.06.25.17.37.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2026 17:37:15 -0700 (PDT) From: Bruce Allen To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1 1/2] rpi: Add SensorSequence vendor control Date: Fri, 26 Jun 2026 02:37:11 +0200 Message-ID: <20260626003712.26624-2-ballen4705@googlemail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260626003712.26624-1-ballen4705@googlemail.com> References: <20260626003712.26624-1-ballen4705@googlemail.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" Expose the Unicam frontend FrameBuffer sequence as controls::rpi::SensorSequence (int64_t, out) in request metadata on the VC4 pipeline. Signed-off-by: Bruce Allen --- src/libcamera/control_ids_rpi.yaml | 11 +++++++++++ src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 2 ++ src/libcamera/pipeline/rpi/vc4/vc4.cpp | 8 +++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml index 0b7da5b..5348060 100644 --- a/src/libcamera/control_ids_rpi.yaml +++ b/src/libcamera/control_ids_rpi.yaml @@ -192,4 +192,15 @@ controls: just been applied. Controls normally take several frames to apply, so the number here will refer to a request submitted a number of frames earlier. + + - SensorSequence: + type: int64_t + direction: out + description: | + Monotonic frontend/Unicam sequence number for the sensor frame. + + Any break in this sequence number indicates that frames were not + captured into the frontend stream before this request completed. This + value is Raspberry Pi pipeline metadata and is intended for diagnostics + of sensor-side frame continuity. ... diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp index 5a5acf6..22327bd 100644 --- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp +++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp @@ -1516,6 +1516,8 @@ void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request request->_d()->metadata().set(controls::SensorTimestamp, *x); if (auto x = bufferControls.get(controls::FrameWallClock)) request->_d()->metadata().set(controls::FrameWallClock, *x); + if (auto x = bufferControls.get(controls::rpi::SensorSequence)) + request->_d()->metadata().set(controls::rpi::SensorSequence, *x); if (cropParams_.size()) { std::vector crops; diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp index 3e9a490..0f437b2 100644 --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp @@ -777,16 +777,18 @@ void Vc4CameraData::unicamBufferDequeue(FrameBuffer *buffer) */ auto [ctrl, delayContext] = delayedCtrls_->get(buffer->metadata().sequence); /* - * Add the frame timestamp to the ControlList for the IPA to use - * as it does not receive the FrameBuffer object. Also derive a - * corresponding wallclock value. + * Add the frame timestamp and sequence number to the ControlList + * for the IPA to use as it does not receive the FrameBuffer object. + * Also derive a corresponding wallclock value. */ wallClockRecovery_.addSample(); uint64_t sensorTimestamp = buffer->metadata().timestamp; uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp); + unsigned int sensorSequence = buffer->metadata().sequence; ctrl.set(controls::SensorTimestamp, sensorTimestamp); ctrl.set(controls::FrameWallClock, wallClockTimestamp); + ctrl.set(controls::rpi::SensorSequence, sensorSequence); bayerQueue_.push({ buffer, std::move(ctrl), delayContext }); } else { embeddedQueue_.push(buffer);