From patchwork Thu May 19 14:16:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 15988 X-Patchwork-Delegate: kieran.bingham@ideasonboard.com 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 9F577C3256 for ; Thu, 19 May 2022 14:16:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C7C9065665; Thu, 19 May 2022 16:16:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652969789; bh=T7QFH4KcPrGBti7IvATH8DZXW9DkbCRecgilCkkUgHg=; h=To:Date:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Be2/3viSWOy4+CLlHE3217dqqFk10onv8wQRyVPW1FufSgmN7rHqrVjXKeLD6N422 yNiQDQPOJDsJCRwNW3Graude379Ii7QySaN5C3hkCRraLAmbnHlvEGVC0j0/cwCuG2 ulORUeK+RzR85+N7Hi1vUbXzWe5Mb6D6n8KzXmLiPz3rFmIX2Q1iXuXpCFje8ZCXWj ZhTEGEZv8DKgVBLFOltdi57+UOF1KiYisgQMiUiHZ7CAy1MUjmz7NBQeeX1T4rJDFW 3PPzIDdTIOKZiGi5eKns7iupL8f0B+l5VWxsn0E9ce+cOYe4Buufls67fSXBxlMRoa OYzGnjZVG2u6w== 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 069DE60420 for ; Thu, 19 May 2022 16:16:28 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ePSAcWuH"; dkim-atps=neutral Received: from localhost.localdomain (unknown [45.131.31.124]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 49EA99DA; Thu, 19 May 2022 16:16:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652969787; bh=T7QFH4KcPrGBti7IvATH8DZXW9DkbCRecgilCkkUgHg=; h=From:To:Cc:Subject:Date:From; b=ePSAcWuHDKeugsRN8Jp5YtQrA9h1TKbpLSxjFeUB7M/H41K0d9mz+QPRIugXMgYuO gTaDEGdcm19OdvUlUXCqhdX3DWKD97OycQe7Ig2UwB/JJBdgEKwtA5hXaGXan+jI+1 CRHRf9zLD2OeAHyVpLgmAl+C7+mk3jAOXLMF8Y54= To: libcamera devel Date: Thu, 19 May 2022 16:16:42 +0200 Message-Id: <20220519141642.1043792-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH] ipa: ipu3: Retain request controls in the IPA 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: , X-Patchwork-Original-From: Kieran Bingham via libcamera-devel From: Kieran Bingham Reply-To: Kieran Bingham Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" To ensure consistency in processing control lists, an application does not have to continually set controls that were already set, but not expected to change. To ensure we keep that state, merge incoming request control lists with a stored ControlList that is owned by the IPA and store the state of that merged list to the per frame FrameContext so that algorithms know the full expected control state at that time. Signed-off-by: Kieran Bingham Reviewed-by: Paul Elder --- RFC: 1) If ControlList.update() were implemented like .merge, but with overriding existing values, instead of leaving them then this could be simplified to : + retainedControls_.update(controls); + context_.frameContexts[frame % kMaxFrameContexts] = { frame, std::copy(retainedControls_) }; Not yet sure if that's more efficient or if it doesn't make much difference. 2) This will not support triggered controls that are set once to 'fire'... Do we have / plan to have any of those? 3) Do we want to keep both a delta control list (the incoming controls) as well as the merged/retained list for full state so IPA's can know if something was changed? Signed-off-by: Kieran Bingham --- src/ipa/ipu3/ipu3.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 2f6bb672f7bb..89fc34f86e46 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -176,6 +176,9 @@ private: /* Local parameter storage */ struct IPAContext context_; + + /* Control retention to maintain mode states */ + ControlList retainedControls_; }; /** @@ -456,6 +459,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo, /* Clean IPAActiveState at each reconfiguration. */ context_.activeState = {}; + retainedControls_.clear(); + IPAFrameContext initFrameContext; context_.frameContexts.fill(initFrameContext); @@ -617,8 +622,24 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame, */ void IPAIPU3::queueRequest(const uint32_t frame, const ControlList &controls) { + /* + * Controls are retained, to ensure any mode updates are persistant. + * We merge them into our class control storage before assigning to + * the frame context. + * + * \todo This will not support trigger controls and may need rework if + * we add any to prevent continually retriggering. + * + * \todo We may wish to store both the full merged control list, as well + * as the delta (\a controls) to facilitate algorithms identifying + * when things have changed. + */ + ControlList mergeControls = controls; + mergeControls.merge(retainedControls_); + retainedControls_ = mergeControls; + /* \todo Start processing for 'frame' based on 'controls'. */ - context_.frameContexts[frame % kMaxFrameContexts] = { frame, controls }; + context_.frameContexts[frame % kMaxFrameContexts] = { frame, std::move(mergeControls) }; } /**