From patchwork Thu Mar 31 16:30:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 15595 X-Patchwork-Delegate: umang.jain@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 69D19C3256 for ; Thu, 31 Mar 2022 16:31:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 12B826563A; Thu, 31 Mar 2022 18:31:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1648744279; bh=loseBciBXbXDa57acsv32QPhI9u/TYHzc6qK45tZQlY=; 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=ckqr9p+zenZo757u7ge8havhT7yzY2HUwaAb9enbB8nnokFOP5YsXY2vp7Szadu8i 88y1JX118N/LAMnLHv9VSfqgaLk16oKG4r63dEbmUncxzbc0cg5mpxAjdW9RIecW8U yN6Obkm5urWJim/RNiyO2/9Xsp/CnuVPWx86FXfeaDohWb7Rtt8RYj+m8E66HYttGb wMVQ87pDZGwg+k2BBObcyGqRfPhXizH1W6DuhCojPBP4Jrs6eI5O5SPSmBikC5x+Ka xHOgEzc4ZaC8/WTvnr0tzL916rqgHdTg0zK9ffPgunsQ9dnIbc8OcQmeFHwq03D+I/ 7/A0UDhaqH0iA== 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 A1E646563D for ; Thu, 31 Mar 2022 18:31:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="f1L1N9kp"; dkim-atps=neutral Received: from perceval.ideasonboard.com (unknown [103.74.73.150]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5D838486; Thu, 31 Mar 2022 18:31:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1648744277; bh=loseBciBXbXDa57acsv32QPhI9u/TYHzc6qK45tZQlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f1L1N9kpo/1QiBj5JEao3Pvnk9pM59v+2LHwAVVOu5GAmLv/NpDiTdK2tPtho+yPT N8mX6+Umb5w9VAVYJ1w8vF7EPUxx+qsyKq0cqw6EgFo8sYzbguv+UNzVKrsLEhtUWy zCahd2eprsTRFBwA+fyZJzu5E6sDEHMBo49R/1qI= To: libcamera-devel@lists.libcamera.org Date: Thu, 31 Mar 2022 22:00:54 +0530 Message-Id: <20220331163058.171418-3-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220331163058.171418-1-umang.jain@ideasonboard.com> References: <20220331163058.171418-1-umang.jain@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 2/6] ipa: ipu3: Inlink fillParams() in fillParamsBuffer() 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: Umang Jain via libcamera-devel From: Umang Jain Reply-To: Umang Jain Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Since we have moved away from switch/case on the operation ID, there's little reason to split the operation in two functions. Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart --- src/ipa/ipu3/ipu3.cpp | 47 +++++++++++++++++-------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 7779ad58..23a9033e 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -157,7 +157,6 @@ private: ControlInfoMap *ipaControls); void updateSessionConfiguration(const ControlInfoMap &sensorControls); - void fillParams(unsigned int frame, ipu3_uapi_params *params); void parseStatistics(unsigned int frame, int64_t frameTimestamp, const ipu3_uapi_stats_3a *stats); @@ -514,6 +513,9 @@ void IPAIPU3::unmapBuffers(const std::vector &ids) * \brief Fill and return a buffer with ISP processing parameters for a frame * \param[in] frame The frame number * \param[in] bufferId ID of the parameter buffer to fill + * + * Algorithms are expected to fill the IPU3 parameter buffer for the next + * frame given their most recent processing of the ImgU statistics. */ void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) { @@ -527,7 +529,21 @@ void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) ipu3_uapi_params *params = reinterpret_cast(mem.data()); - fillParams(frame, params); + /* + * The incoming params buffer may contain uninitialised data, or the + * parameters of previously queued frames. Clearing the entire buffer + * may be an expensive operation, and the kernel will only read from + * structures which have their associated use-flag set. + * + * It is the responsibility of the algorithms to set the use flags + * accordingly for any data structure they update during prepare(). + */ + params->use = {}; + + for (auto const &algo : algorithms_) + algo->prepare(context_, params); + + paramsBufferReady.emit(frame); } /** @@ -570,33 +586,6 @@ void IPAIPU3::queueRequest(const uint32_t frame, /* \todo Start processing for 'frame' based on 'controls'. */ } -/** - * \brief Fill the ImgU parameter buffer for the next frame - * \param[in] frame The number of the latest frame processed - * \param[out] params The parameter buffer to fill - * - * Algorithms are expected to fill the IPU3 parameter buffer for the next - * frame given their most recent processing of the ImgU statistics. - */ -void IPAIPU3::fillParams(unsigned int frame, ipu3_uapi_params *params) -{ - /* - * The incoming params buffer may contain uninitialised data, or the - * parameters of previously queued frames. Clearing the entire buffer - * may be an expensive operation, and the kernel will only read from - * structures which have their associated use-flag set. - * - * It is the responsibility of the algorithms to set the use flags - * accordingly for any data structure they update during prepare(). - */ - params->use = {}; - - for (auto const &algo : algorithms_) - algo->prepare(context_, params); - - paramsBufferReady.emit(frame); -} - /** * \brief Process the statistics generated by the ImgU * \param[in] frame The number of the latest frame processed