From patchwork Tue Mar 19 12:05:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 19749 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 3A0D8C32C6 for ; Tue, 19 Mar 2024 12:05:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AE83362D3B; Tue, 19 Mar 2024 13:05:40 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="t1oPXfi9"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id AC24B62D2B for ; Tue, 19 Mar 2024 13:05:29 +0100 (CET) Received: from jasper.fritz.box (unknown [IPv6:2a00:6020:448c:6c00:1478:344b:8fcb:baf5]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0A161480; Tue, 19 Mar 2024 13:05:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1710849903; bh=dPKmjSnAJz5mm9u/EZMLMt1WGbC78RUn68Vf+zv7Jx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t1oPXfi9OgEQvt/pBRh3gAa702elI+U3DMjX9Iycy8jFlMhFqyYsjKuCc8nv3+xa5 8RatR/J1tLj6gErVwWUMmhfvwP0zdsBXFd8GQBi1xtewJTzKhvllCl20gcXfWPa28J 5Jk2pf2gOhJzs+nkCcGlw1weG6krOm/Ehfll2zUs= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v3 09/16] libcamera: delayed_controls: Add sourceSequence property Date: Tue, 19 Mar 2024 13:05:10 +0100 Message-Id: <20240319120517.362082-10-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240319120517.362082-1-stefan.klug@ideasonboard.com> References: <20240319120517.362082-1-stefan.klug@ideasonboard.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" This is necessary for the upcoming rework. It allows to track the sequence number from which a request stems. The use case where this is needed is as follows: Assume for frame 10 a manual ExposureTime=42 is queued because the user wants manual exposure. Now the agc gets the stats for frame 8 (where auto regulation is still active) and pushes a new ExposureTime for frame 9. Frame 9 was already sent out, so it gets delayed to frame 11 (assuming a delay of 2 on ExposureTime). This would revert the request from frame 10. Taking the sourceSequence into account, the delayed request from frame 9 will be discarded, which is correct. Signed-off-by: Stefan Klug --- include/libcamera/internal/delayed_controls.h | 8 +++++--- src/libcamera/delayed_controls.cpp | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h index 224c1f7e..5a0428e0 100644 --- a/include/libcamera/internal/delayed_controls.h +++ b/include/libcamera/internal/delayed_controls.h @@ -39,16 +39,18 @@ private: { public: Info() - : updated(false) + : updated(false), sourceSequence(0) { } - Info(const ControlValue &v, bool updated_ = true) - : ControlValue(v), updated(updated_) + Info(const ControlValue &v, uint32_t sourceSeq, bool updated_ = true) + : ControlValue(v), updated(updated_), sourceSequence(sourceSeq) { } bool updated; + /* The sequence id for which this value was requested */ + uint32_t sourceSequence; }; /* \todo Make the listSize configurable at instance creation time. */ diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp index 6f06950e..8cfa6bbb 100644 --- a/src/libcamera/delayed_controls.cpp +++ b/src/libcamera/delayed_controls.cpp @@ -147,7 +147,7 @@ void DelayedControls::reset(ControlList *controls) * Do not mark this control value as updated, it does not need * to be written to to device on startup. */ - values_[id][0] = Info(ctrl.second, false); + values_[id][0] = Info(ctrl.second, 0, false); } } @@ -220,7 +220,7 @@ bool DelayedControls::push(const ControlList &controls) Info &info = values_[id][queueIndex_]; - info = Info(control.second); + info = Info(control.second, 0); LOG(DelayedControls, Debug) << "Queuing " << id->name()