From patchwork Mon Mar 28 09:24:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 15564 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 6ECF6C3256 for ; Mon, 28 Mar 2022 09:24:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 937796563A; Mon, 28 Mar 2022 11:24:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1648459483; bh=NhCazlqMoha0m10Fd7/+krMZZzST5W4Cn1YefZ60kgA=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=RsGPESc1WIhTJkTw87K2h6uS5o+r7u0qOXAU25zVHyVKWKwYxGYnowoDltKcgnnX7 8xjqdY/oxu68wz9R1CNDo6jW9v2OVZdw594yOhxPgT3yAbr6OAM+BLq23zAXv5uORI IZCY7izp5k0MJlEa5H7fUQ5M7I9R2+b7W2JAGpFD1eDi2fCXyA8h38m34V6INFzxkS YIHpzY/tvXpWC9fviYMDLZGHrePjZ3Ta+giAo3cyXJbF/yiemXKsnDVevLNPsi0h3h Eq8wIKG7MeuzJntSJMMIbjTynGRq9E73Lnzq76O3LlgHC0moUcgFirIPmMma9SSqxy OjfkE3qHsAf4A== 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 EE550604BF for ; Mon, 28 Mar 2022 11:24:41 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jAiPKUoR"; dkim-atps=neutral Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:4f49:c672:4655:7dbb]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 669FFB9C; Mon, 28 Mar 2022 11:24:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1648459481; bh=NhCazlqMoha0m10Fd7/+krMZZzST5W4Cn1YefZ60kgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jAiPKUoRCwGRPy2V428wHI53Tokqb0MffKbN8Hbg0mfbAo90MDKp23H7s/wCO6HAS G2bTd+90K4o0VS5xBXPBPk8qXvSHwIcZAxeBXxh9qXDHdnFDI2dmac7WtDfiUz1NZ9 NDQkjsVT5CwclWCHjJ0oZDNZGco5gMJbvEBGP0lc= To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Mar 2022 11:24:29 +0200 Message-Id: <20220328092433.69856-2-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220328092433.69856-1-jeanmichel.hautbois@ideasonboard.com> References: <20220328092433.69856-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 1/5] ipa: rkisp1: Use frame counter for the request queued 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: Jean-Michel Hautbois via libcamera-devel From: Jean-Michel Hautbois Reply-To: Jean-Michel Hautbois Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Introduce a frameCount variable in the IPAFrameContext which increments each time a request is queued. It is reset at configure call, when the camera is started. This will allow the frameCount to be used by other algorithms, without having to keep multiple private frame counters. Signed-off-by: Jean-Michel Hautbois Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- src/ipa/rkisp1/ipa_context.cpp | 11 ++++++++++- src/ipa/rkisp1/ipa_context.h | 4 +++- src/ipa/rkisp1/rkisp1.cpp | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/ipa/rkisp1/ipa_context.cpp b/src/ipa/rkisp1/ipa_context.cpp index 9cb2a9fd..c22e02d5 100644 --- a/src/ipa/rkisp1/ipa_context.cpp +++ b/src/ipa/rkisp1/ipa_context.cpp @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ /* - * Copyright (C) 2021, Ideas On Board + * Copyright (C) 2021-2022, Ideas On Board * * ipa_context.cpp - RkISP1 IPA Context */ @@ -113,4 +113,13 @@ namespace libcamera::ipa::rkisp1 { * \brief Analogue gain multiplier */ +/** + * \var IPAFrameContext::frameCount + * \brief Counter of requests queued to the IPA module + * + * The counter is reset to 0 when the IPA module is configured, and is + * incremented for each request being queued, after calling the + * Algorithm::prepare() function of all algorithms. + */ + } /* namespace libcamera::ipa::rkisp1 */ diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h index b94ade0c..212fa052 100644 --- a/src/ipa/rkisp1/ipa_context.h +++ b/src/ipa/rkisp1/ipa_context.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ /* - * Copyright (C) 2021, Ideas On Board + * Copyright (C) 2021-2022, Ideas On Board * * ipa_context.h - RkISP1 IPA Context * @@ -43,6 +43,8 @@ struct IPAFrameContext { uint32_t exposure; double gain; } sensor; + + unsigned int frameCount; }; struct IPAContext { diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 2225a84d..493811d9 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -190,6 +190,8 @@ int IPARkISP1::configure([[maybe_unused]] const IPACameraSensorInfo &info, context_.configuration.agc.minAnalogueGain = camHelper_->gain(minGain); context_.configuration.agc.maxAnalogueGain = camHelper_->gain(maxGain); + context_.frameContext.frameCount = 0; + for (auto const &algo : algorithms_) { int ret = algo->configure(context_, info); if (ret) @@ -243,6 +245,7 @@ void IPARkISP1::queueRequest(const uint32_t frame, const uint32_t bufferId, algo->prepare(context_, params); paramsBufferReady.emit(frame); + context_.frameContext.frameCount++; } void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId,