From patchwork Tue Apr 27 06:35:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 12117 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 C2405BDE19 for ; Tue, 27 Apr 2021 06:35:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 301A468880; Tue, 27 Apr 2021 08:35:37 +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="VSSVO8g6"; 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 9855060512 for ; Tue, 27 Apr 2021 08:35:35 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.238.109.25]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3F5BDE9; Tue, 27 Apr 2021 08:35:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1619505335; bh=pb9TNupQJqbnl4CWsidw+aLTQ4E2Fr4NN5aPlD6I2Oo=; h=From:To:Cc:Subject:Date:From; b=VSSVO8g6FkrWMchx2IqlKILtd1AV8c3mFopSRc44xktUFa303DflczzJG9e6laYNS qUKp3FjYYSH29w2EDtl4goQwSaAn4SC4ssroge+xJ/C8xcHokRjARTyik7oCfn3b39 9jrBnxWl+u72a46O4Vh8ZTh1W/3T43itMBfRqOMk= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Tue, 27 Apr 2021 12:05:27 +0530 Message-Id: <20210427063527.219509-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH v2] ipa: ipu3: Introduce IPAConfigInfo in IPC 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" IPAConfigInfo is a consolidated data structure passed from IPU3 pipeline-handler to IPU3 IPA. This provides a streamlined and extensible way to provide the configuration data to IPA interface. The IPA interface should be common to both closed-source and open-source IPU3 IPAs. Hence, the structure encompasses additional configuration information required to init and configure the closed-source IPA as well. Signed-off-by: Umang Jain --- Changes in v2: - Mark as RFC(do not merge) as this is built upon Paul's [Fix support for core.mojom structs v3] - waiting for merge to master - Drop cropRegion_ from structure - this is provided from CameraSensorInfo itself. - Doxygen documentation of IPAConfigInfo. --- include/libcamera/ipa/ipu3.mojom | 46 ++++++++++++++++++++++++++-- src/ipa/ipu3/ipu3.cpp | 14 ++++----- src/libcamera/pipeline/ipu3/ipu3.cpp | 9 +++++- 3 files changed, 58 insertions(+), 11 deletions(-) diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom index a717b1e6..acd5cfa4 100644 --- a/include/libcamera/ipa/ipu3.mojom +++ b/include/libcamera/ipa/ipu3.mojom @@ -25,13 +25,55 @@ struct IPU3Action { libcamera.ControlList controls; }; +/** + * \struct IPAConfigInfo + * \brief Information to be passed from IPU3 pipeline-handler to IPA + * + * The IPAConfigInfo structure stores the data passed from IPU3 pipeline-handler + * to the IPAIPU3Interface::configure(). The structure provides extensibility + * for additional configuration data as required, for closed-source or + * open-source IPAs' configure() phases. + */ + +/** + * \var IPAConfigInfo::sensorInfo + * \brief Camera sensor information + * + * Provides the camera sensor information such as model name, pixel-rate, + * output-size and so on. Refer to libcamera::CameraSensorInfo for further + * details. + */ + + /** + * \var IPAConfigInfo::entityControls + * \brief Controls supported by the sensor + * + * A map of V4L2 controls supported by the sensor in order to read or write + * control values to them. + */ + + /** + * \var IPAConfigInfo::bdsOutputSize + * \brief Size of ImgU BDS rectangle + */ + + /** + * \var IPAConfigInfo::iif + * \brief Size of ImgU input-feeder rectangle + */ +struct IPAConfigInfo { + libcamera.CameraSensorInfo sensorInfo; + map entityControls; + libcamera.Size bdsOutputSize; + libcamera.Size iif; +}; + interface IPAIPU3Interface { init(libcamera.IPASettings settings) => (int32 ret); start() => (int32 ret); stop(); - configure(map entityControls, - libcamera.Size bdsOutputSize) => (); + configure(IPAConfigInfo configInfo); mapBuffers(array buffers); unmapBuffers(array ids); diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index f5343547..769c24d3 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -43,8 +43,7 @@ public: int start() override; void stop() override {} - void configure(const std::map &entityControls, - const Size &bdsOutputSize) override; + void configure(const IPAConfigInfo &configInfo) override; void mapBuffers(const std::vector &buffers) override; void unmapBuffers(const std::vector &ids) override; @@ -139,13 +138,12 @@ void IPAIPU3::calculateBdsGrid(const Size &bdsOutputSize) << (int)bdsGrid_.height << " << " << (int)bdsGrid_.block_height_log2 << ")"; } -void IPAIPU3::configure(const std::map &entityControls, - const Size &bdsOutputSize) +void IPAIPU3::configure(const IPAConfigInfo &configInfo) { - if (entityControls.empty()) + if (configInfo.entityControls.empty()) return; - ctrls_ = entityControls.at(0); + ctrls_ = configInfo.entityControls.at(0); const auto itExp = ctrls_.find(V4L2_CID_EXPOSURE); if (itExp == ctrls_.end()) { @@ -169,10 +167,10 @@ void IPAIPU3::configure(const std::map &entityControls params_ = {}; - calculateBdsGrid(bdsOutputSize); + calculateBdsGrid(configInfo.bdsOutputSize); awbAlgo_ = std::make_unique(); - awbAlgo_->initialise(params_, bdsOutputSize, bdsGrid_); + awbAlgo_->initialise(params_, configInfo.bdsOutputSize, bdsGrid_); agcAlgo_ = std::make_unique(); agcAlgo_->initialise(bdsGrid_); diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 73306cea..b1ff1dbe 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -635,7 +635,14 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) std::map entityControls; entityControls.emplace(0, data->cio2_.sensor()->controls()); - data->ipa_->configure(entityControls, config->imguConfig().bds); + + ipa::ipu3::IPAConfigInfo configInfo; + configInfo.sensorInfo = sensorInfo; + configInfo.entityControls = entityControls; + configInfo.bdsOutputSize = config->imguConfig().bds; + configInfo.iif = config->imguConfig().iif; + + data->ipa_->configure(configInfo); return 0; }