From patchwork Tue Mar 9 02:39:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 11525 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 5CC67BD80C for ; Tue, 9 Mar 2021 02:39:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C976068A9C; Tue, 9 Mar 2021 03:39:20 +0100 (CET) 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="hpZ8pH4n"; 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 D5A5A602E4 for ; Tue, 9 Mar 2021 03:39:19 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 62725527; Tue, 9 Mar 2021 03:39:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1615257559; bh=ejbWlZBb92kwIHUCSHu6hmQgd9Pi1RwL95a1lNYIZFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hpZ8pH4nlrWK18MeXHGivNEzDnSPM5h+sH1W4sVgZC6Cg2TMicaj1c8lCRTGaXY2I YQjw1Ct4P1YKsc8MPcMDRwFwZ+k7+mCOFVDvbgapjoxun/hoGyfUsf92D52gPzENl3 Gy3qtCRW+HgDQwT13kpSwnqfTOQHLiKEaNJ6Gb+4= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Tue, 9 Mar 2021 11:39:07 +0900 Message-Id: <20210309023907.83798-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210308074828.13228-4-paul.elder@ideasonboard.com> References: <20210308074828.13228-4-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2.1] ipa: raspberrypi: Use direct return value for 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" Now that we support returning int directly in addition to other output parameters, improve the configure() function in the raspberrypi IPA interface. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Naushir Patuck --- Changes in v2.1: - remove init() changes, keep configure changes --- include/libcamera/ipa/raspberrypi.mojom | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 34 ++++++++----------- .../pipeline/raspberrypi/raspberrypi.cpp | 5 ++- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index c3d614b8..eb427697 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -77,7 +77,7 @@ interface IPARPiInterface { map streamConfig, map entityControls, ConfigInput ipaConfig) - => (ConfigOutput results, int32 ret); + => (int32 ret, ConfigOutput results); /** * \fn mapBuffers() diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 85a2b846..7904225a 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -84,11 +84,11 @@ public: ipa::RPi::StartControls *result) override; void stop() override {} - void configure(const CameraSensorInfo &sensorInfo, - const std::map &streamConfig, - const std::map &entityControls, - const ipa::RPi::ConfigInput &data, - ipa::RPi::ConfigOutput *response, int32_t *ret) override; + int configure(const CameraSensorInfo &sensorInfo, + const std::map &streamConfig, + const std::map &entityControls, + const ipa::RPi::ConfigInput &data, + ipa::RPi::ConfigOutput *response) override; void mapBuffers(const std::vector &buffers) override; void unmapBuffers(const std::vector &ids) override; void signalStatReady(const uint32_t bufferId) override; @@ -290,16 +290,15 @@ void IPARPi::setMode(const CameraSensorInfo &sensorInfo) mode_.max_frame_length = sensorInfo.maxFrameLength; } -void IPARPi::configure(const CameraSensorInfo &sensorInfo, - [[maybe_unused]] const std::map &streamConfig, - const std::map &entityControls, - const ipa::RPi::ConfigInput &ipaConfig, - ipa::RPi::ConfigOutput *result, int32_t *ret) +int IPARPi::configure(const CameraSensorInfo &sensorInfo, + [[maybe_unused]] const std::map &streamConfig, + const std::map &entityControls, + const ipa::RPi::ConfigInput &ipaConfig, + ipa::RPi::ConfigOutput *result) { if (entityControls.size() != 2) { LOG(IPARPI, Error) << "No ISP or sensor controls found."; - *ret = -1; - return; + return -1; } result->params = 0; @@ -309,14 +308,12 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, if (!validateSensorControls()) { LOG(IPARPI, Error) << "Sensor control validation failed."; - *ret = -1; - return; + return -1; } if (!validateIspControls()) { LOG(IPARPI, Error) << "ISP control validation failed."; - *ret = -1; - return; + return -1; } /* Setup a metadata ControlList to output metadata. */ @@ -334,8 +331,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, if (!helper_) { LOG(IPARPI, Error) << "Could not create camera helper for " << cameraName; - *ret = -1; - return; + return -1; } /* @@ -403,7 +399,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo, lastMode_ = mode_; - *ret = 0; + return 0; } void IPARPi::mapBuffers(const std::vector &buffers) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 6387fae5..0f01ce8f 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1250,9 +1250,8 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) /* Ready the IPA - it must know about the sensor resolution. */ ipa::RPi::ConfigOutput result; - ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig, - &result, &ret); - + ret = ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig, + &result); if (ret < 0) { LOG(RPI, Error) << "IPA configuration failed!"; return -EPIPE;