From patchwork Mon Aug 9 09:20:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 13252 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 8A0A8C3241 for ; Mon, 9 Aug 2021 09:20:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 36DF9687EB; Mon, 9 Aug 2021 11:20:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="J9FGTk16"; 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 1706968823 for ; Mon, 9 Aug 2021 11:20:16 +0200 (CEST) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:14c5:c0eb:b1fb:db22]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A670049A; Mon, 9 Aug 2021 11:20:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1628500815; bh=hOGLI3q4SOSC3OcV2W2qxHLsax8Do1MNf+KmmiGjdMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J9FGTk169QW78xNWaj7lHnDctkjIYaTPhg55vo9iUI+X8cAtglVFPeA85khvcz199 HV0+TsuQDA1DkssmbA+DSFsYD2RQ2JXTBeUWbz77CZWEUD9cw+CkVOSXYCnozw4zhW 4FvTpkHXBw4JATP3yUNAHhanhxWQjSHtXSw+6fuY= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Mon, 9 Aug 2021 11:20:03 +0200 Message-Id: <20210809092007.79067-2-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210809092007.79067-1-jeanmichel.hautbois@ideasonboard.com> References: <20210809092007.79067-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 1/5] ipa: ipu3: Introduce a Context structure 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" Passing parameters, statistics and all specific data each algorithm shares. As the ipu3_uapi_params are part of the IPA context referenced by the algorithms, move the structure into the IPAContext directly and adapt existing algorithm implementations. Signed-off-by: Kieran Bingham Signed-off-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham Reviewed-by: Umang Jain --- src/ipa/ipu3/ipa_context.h | 30 ++++++++++++++++++++++++++++++ src/ipa/ipu3/ipu3.cpp | 16 +++++++++------- 2 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 src/ipa/ipu3/ipa_context.h diff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h new file mode 100644 index 00000000..5d717be5 --- /dev/null +++ b/src/ipa/ipu3/ipa_context.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2021, Ideas On Board + * + * ipu3_ipa_context.h - IPU3 IPA Context + * + * Context information shared between the algorithms + */ +#ifndef __LIBCAMERA_IPU3_IPA_CONTEXT_H__ +#define __LIBCAMERA_IPU3_IPA_CONTEXT_H__ + +#include + +namespace libcamera { + +namespace ipa::ipu3 { + +struct IPAContext { + /* Input statistics from the previous frame */ + const ipu3_uapi_stats_3a *stats; + + /* Output Parameters which will be written to the hardware */ + ipu3_uapi_params params; +}; + +} /* namespace ipa::ipu3 */ + +} /* namespace libcamera*/ + +#endif /* __LIBCAMERA_IPU3_IPA_CONTEXT_H__ */ diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 71698d36..a714af85 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -22,6 +22,8 @@ #include "libcamera/internal/framebuffer.h" +#include "ipa_context.h" + #include "ipu3_agc.h" #include "ipu3_awb.h" #include "libipa/camera_sensor_helper.h" @@ -81,9 +83,8 @@ private: std::unique_ptr camHelper_; /* Local parameter storage */ - struct ipu3_uapi_params params_; - struct ipu3_uapi_grid_config bdsGrid_; + struct IPAContext context_; }; int IPAIPU3::init(const IPASettings &settings) @@ -94,6 +95,9 @@ int IPAIPU3::init(const IPASettings &settings) return -ENODEV; } + /* Reset all the hardware settings */ + context_.params = {}; + return 0; } @@ -193,12 +197,10 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo) defVBlank_ = itVBlank->second.def().get(); - params_ = {}; - calculateBdsGrid(configInfo.bdsOutputSize); awbAlgo_ = std::make_unique(); - awbAlgo_->initialise(params_, configInfo.bdsOutputSize, bdsGrid_); + awbAlgo_->initialise(context_.params, configInfo.bdsOutputSize, bdsGrid_); agcAlgo_ = std::make_unique(); agcAlgo_->initialise(bdsGrid_, sensorInfo_); @@ -276,9 +278,9 @@ void IPAIPU3::processControls([[maybe_unused]] unsigned int frame, void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params) { if (agcAlgo_->updateControls()) - awbAlgo_->updateWbParameters(params_, agcAlgo_->gamma()); + awbAlgo_->updateWbParameters(context_.params, agcAlgo_->gamma()); - *params = params_; + *params = context_.params; IPU3Action op; op.op = ActionParamFilled;