From patchwork Fri Jun 11 12:52:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 12571 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 DD8BDC320B for ; Fri, 11 Jun 2021 12:52:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 478AE6892C; Fri, 11 Jun 2021 14:52:46 +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="ryFg75cG"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 259086029E for ; Fri, 11 Jun 2021 14:52:44 +0200 (CEST) Received: from Monstersaurus.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7F7AA4AD; Fri, 11 Jun 2021 14:52:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1623415963; bh=bmVutysiOax/Rzx0KiLqNTZz8gzQwzMXDfrs1UK/TyU=; h=From:To:Cc:Subject:Date:From; b=ryFg75cGft+Z6/+lvtE3vzwndD8OfLptXb63z1ajNdTH+DRrQkyGAAWEVNs3wob3D a/I+LQ8r4KONp5ueRB82QUFs1ybO/sYNqAgku1yXq3EvildnvQ/BmlJadp/P4KAXU/ 2VT7OZRR6y7u/DmZVQ4NGcc9CQ1Ryfl8CIvqzkaU= From: Kieran Bingham To: libcamera devel , Umang Jain , Jean-Michel Hautbois Date: Fri, 11 Jun 2021 13:52:39 +0100 Message-Id: <20210611125239.1021944-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] ipa: ipu3: Support return values from configure() 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" The IPU3 IPA interface does not define a return value from configure(). This prevents errors from being reported back to the pipeline handler when they occur in the IPA. Update the IPU3 IPA interface and add return values to the checks in IPAIPU3::configure() accordingly Signed-off-by: Kieran Bingham Reviewed-by: Paul Elder Reviewed-by: Umang Jain --- include/libcamera/ipa/ipu3.mojom | 2 +- src/ipa/ipu3/ipu3.cpp | 18 +++++++++++------- src/libcamera/pipeline/ipu3/ipu3.cpp | 6 +++++- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom index 000c494dbff9..911a3a072464 100644 --- a/include/libcamera/ipa/ipu3.mojom +++ b/include/libcamera/ipa/ipu3.mojom @@ -42,7 +42,7 @@ interface IPAIPU3Interface { start() => (int32 ret); stop(); - configure(IPAConfigInfo configInfo) => (); + configure(IPAConfigInfo configInfo) => (int32 ret); mapBuffers(array buffers); unmapBuffers(array ids); diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 415ea9e58cf4..8b4c7351e9db 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -43,7 +43,7 @@ public: int start() override; void stop() override {} - void configure(const IPAConfigInfo &configInfo) override; + int configure(const IPAConfigInfo &configInfo) override; void mapBuffers(const std::vector &buffers) override; void unmapBuffers(const std::vector &ids) override; @@ -142,10 +142,12 @@ void IPAIPU3::calculateBdsGrid(const Size &bdsOutputSize) << (int)bdsGrid_.height << " << " << (int)bdsGrid_.block_height_log2 << ")"; } -void IPAIPU3::configure(const IPAConfigInfo &configInfo) +int IPAIPU3::configure(const IPAConfigInfo &configInfo) { - if (configInfo.entityControls.empty()) - return; + if (configInfo.entityControls.empty()) { + LOG(IPAIPU3, Error) << "No controls provided"; + return -ENODATA; + } sensorInfo_ = configInfo.sensorInfo; @@ -154,19 +156,19 @@ void IPAIPU3::configure(const IPAConfigInfo &configInfo) const auto itExp = ctrls_.find(V4L2_CID_EXPOSURE); if (itExp == ctrls_.end()) { LOG(IPAIPU3, Error) << "Can't find exposure control"; - return; + return -EINVAL; } const auto itGain = ctrls_.find(V4L2_CID_ANALOGUE_GAIN); if (itGain == ctrls_.end()) { LOG(IPAIPU3, Error) << "Can't find gain control"; - return; + return -EINVAL; } const auto itVBlank = ctrls_.find(V4L2_CID_VBLANK); if (itVBlank == ctrls_.end()) { LOG(IPAIPU3, Error) << "Can't find VBLANK control"; - return; + return -EINVAL; } minExposure_ = std::max(itExp->second.min().get(), 1); @@ -188,6 +190,8 @@ void IPAIPU3::configure(const IPAConfigInfo &configInfo) agcAlgo_ = std::make_unique(); agcAlgo_->initialise(bdsGrid_, sensorInfo_); + + return 0; } void IPAIPU3::mapBuffers(const std::vector &buffers) diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index b986bb7035fa..87f6bac83927 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -642,7 +642,11 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c) configInfo.bdsOutputSize = config->imguConfig().bds; configInfo.iif = config->imguConfig().iif; - data->ipa_->configure(configInfo); + ret = data->ipa_->configure(configInfo); + if (ret) { + LOG(IPU3, Error) << "Failed to configure IPA"; + return ret; + } return 0; }