From patchwork Wed Mar 17 10:02:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11604 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 6CFA7BD80C for ; Wed, 17 Mar 2021 10:02:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0DAD468D6F; Wed, 17 Mar 2021 11:02:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="k30veogi"; dkim-atps=neutral Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 198CF68D6F for ; Wed, 17 Mar 2021 11:02:23 +0100 (CET) Received: by mail-ed1-x52d.google.com with SMTP id e7so1460832edu.10 for ; Wed, 17 Mar 2021 03:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FiNZ1SciFIOdshBjGE/x40KQu+usIIXzXc0GHR1wiiE=; b=k30veogiGCVBG5vA/r18W6lD+HLr9XHXiRInKhlmgz6kv5lRyQJk7N4L/R8Jy0xPvU ApZt+2tqYSEmxLH13iYYvmajtfQpD1WQsDZsYxbDFjmiO/E6W53B9dRNupKKBa47b2xW vrN4Sy8pVsZAzsbGHtSC/MLfqMQhXj8csyUk1LUwqzK7HAF4SN476I8dO6GpviV15b2C 1SpQzx5kksRN1d8FCLn7WeiIWXb64uCDyr93QkDhT+s0iwGiQVujkv4fZUrBZBlwE0Qq MJ9skP/sMZBPQG//hsuJbXO3GIatI6CSwMGiJAS5gkTNRNCnEcFjsn1DGIALWn67uUgy SWQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FiNZ1SciFIOdshBjGE/x40KQu+usIIXzXc0GHR1wiiE=; b=l9DdlG0ClzZkoXSdVcemwMmmWN72TOzx8QZdf8V5IE3aCqEnBVhQq3xpWz+dpP58Er JN8b5/ybDR7ku25gEIgZaCUwWbkcG9LnHPN8nUcQvkbIrzSMvbAVX/9A6mEJVqwYnXhj CYfBDi4hQrXFwms4eMIAaS0HPUGJ6BWtjEsr61Ax7Pp+wRqyeJTegzssNQYWmnGze9SF gbp/BP0ohGKaCjyWCIoPMS9xvTX8f5B9d1pOR0bs8DBEhy4hNz3GL2pSvfXUSqKCkEbL sKC/P656tt5ir0YaFqUEZH/rh12FE+cGpPm/jiYunvGretUoLNTKM+sRk+Iiga+n4xYT Ehkg== X-Gm-Message-State: AOAM532fwpIH24CbodRq6dzMH24H69FKgwjFxtoftce/tYASsZhcPMz8 uqpRhMSAyfLhhc8pK9tWtbu/fqu5crlpHQ== X-Google-Smtp-Source: ABdhPJyNrQ/VwhH+yPcuvU7gKJFh8CUZpg3BPs967QVYsaYHoeOcG3kBzUFV10wWt3OWNHUR6o8Yrg== X-Received: by 2002:aa7:c74a:: with SMTP id c10mr40481270eds.332.1615975338033; Wed, 17 Mar 2021 03:02:18 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id p24sm12061179edt.5.2021.03.17.03.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 03:02:17 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 17 Mar 2021 10:02:05 +0000 Message-Id: <20210317100211.1067585-2-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317100211.1067585-1-naush@raspberrypi.com> References: <20210317100211.1067585-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/7] ipa: Add sensor model string to IPASettings 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" Pass the sensor model string to the IPA init() method through the IPASettings structure. Signed-off-by: Naushir Patuck --- include/libcamera/ipa/core.mojom | 8 ++++++++ src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 ++- src/libcamera/pipeline/vimc/vimc.cpp | 2 +- test/ipa/ipa_interface_test.cpp | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom index 5236a672461c..5363f1c5b48b 100644 --- a/include/libcamera/ipa/core.mojom +++ b/include/libcamera/ipa/core.mojom @@ -145,8 +145,16 @@ struct IPABuffer { * This field may be an empty string if the IPA doesn't require a configuration * file. */ + + /** + * \var IPASettings::sensorModel + * \brief The sensor model name + * + * Provides the sensor model name to the IPA. + */ struct IPASettings { string configurationFile; + string sensorModel; }; /** diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 00fa62c972ed..2c8ae31a28ad 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1227,7 +1227,8 @@ int RPiCameraData::loadIPA() ipa_->setIspControls.connect(this, &RPiCameraData::setIspControls); ipa_->setDelayedControls.connect(this, &RPiCameraData::setDelayedControls); - IPASettings settings(ipa_->configurationFile(sensor_->model() + ".json")); + IPASettings settings(ipa_->configurationFile(sensor_->model() + ".json"), + sensor_->model()); return ipa_->init(settings); } diff --git a/src/libcamera/pipeline/vimc/vimc.cpp b/src/libcamera/pipeline/vimc/vimc.cpp index 57c65b021c46..2dfb63ecf2ef 100644 --- a/src/libcamera/pipeline/vimc/vimc.cpp +++ b/src/libcamera/pipeline/vimc/vimc.cpp @@ -425,7 +425,7 @@ bool PipelineHandlerVimc::match(DeviceEnumerator *enumerator) data->ipa_ = IPAManager::createIPA(this, 0, 0); if (data->ipa_ != nullptr) { std::string conf = data->ipa_->configurationFile("vimc.conf"); - data->ipa_->init(IPASettings{ conf }); + data->ipa_->init(IPASettings{ conf, data->sensor_->model() }); } else { LOG(VIMC, Warning) << "no matching IPA found"; } diff --git a/test/ipa/ipa_interface_test.cpp b/test/ipa/ipa_interface_test.cpp index 4b88806f8f67..d6ca6f5137b0 100644 --- a/test/ipa/ipa_interface_test.cpp +++ b/test/ipa/ipa_interface_test.cpp @@ -104,7 +104,7 @@ protected: /* Test initialization of IPA module. */ std::string conf = ipa_->configurationFile("vimc.conf"); - int ret = ipa_->init(IPASettings{ conf }); + int ret = ipa_->init(IPASettings{ conf, "vimc" }); if (ret < 0) { cerr << "IPA interface init() failed" << endl; return TestFail; From patchwork Wed Mar 17 10:02:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11599 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 C5B7BBD80C for ; Wed, 17 Mar 2021 10:02:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C4A2368D63; Wed, 17 Mar 2021 11:02:20 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Mz7apkiw"; dkim-atps=neutral Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B35C16084D for ; Wed, 17 Mar 2021 11:02:19 +0100 (CET) Received: by mail-ed1-x536.google.com with SMTP id w18so1525227edc.0 for ; Wed, 17 Mar 2021 03:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WKPDbQVEm77UntYvf9XLAzDmJH8wdZX3/OhhnGXC8so=; b=Mz7apkiw9wYt23K3kNuFupiDK58T+2K0TiO020iQXLo9nixxBqc5nB5ngsx4QEws1o URLu8iAmOZcU+wIMdNxYXXBGk6MuaXiEQ/3OaWYmXnb9mY48hQo7acuXmCv/cZcGiSeJ TZcOLn2Od8DheUd+rbqdtfwMEUsCxig83qoVzKDMvh0GnUSrYyqtTIftMuXvvv8QJIUq jvo2dZp67yn0bizbUQgHaqiE2y7c6TOdSBB7RLOOzaSDyGAxJzksUesvWUF2FTJ/kTvi RluGbA3if8qObX9ApwyJ3TiuYP9MWJrNDOFlP9hCuYFwMVKmr8qDVZYvDavEXsmV0rLk yJkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WKPDbQVEm77UntYvf9XLAzDmJH8wdZX3/OhhnGXC8so=; b=JxTWEvulNgbDZD10JpYp7E34h3rscEcKwfCObjBaUMaU30n/1BrcMTwXFsim4g1ULa 1uWHkt0oQNhNjbxH2O7K+r0n5fdswL452vP/U+V/+45XAdKK2FAyU0OQ9OEF5s4qgrwj E3wIcc5/8ODN6eRJCmooMK+n4DJAWUQaQGUorQj/pOhs4I8tjRc4S0VRjmAb5jmHrmYT FyJRnn67UzsO4UUKu5OIQUQVV4JyzNHyFsL9ZCkcv53f7R+qfdIt2q0thpHtFiMx6R3g 6inoYcwKd7wAt3s3VuUgJkGyF6LIWv068snOlXMRLKtAz8L+ovaIOQepWmC07Gp8oX1t poxQ== X-Gm-Message-State: AOAM53330ZnqHGjDq2PV9fCn/xx70VM5AHHV9Z1l3Uqnr+fpmNJ2rFA0 /0DhG20iSKHkj7iNVITPjCL7vuVr8kJwWw== X-Google-Smtp-Source: ABdhPJzvOUXl2eceQhWTm8kdwmH075WT9v/znUJitKvM4mRv4yZTKQIX4b2k55hUb/SRFnZtcSocMw== X-Received: by 2002:a05:6402:6cb:: with SMTP id n11mr41677975edy.198.1615975338727; Wed, 17 Mar 2021 03:02:18 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id p24sm12061179edt.5.2021.03.17.03.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 03:02:18 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 17 Mar 2021 10:02:06 +0000 Message-Id: <20210317100211.1067585-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317100211.1067585-1-naush@raspberrypi.com> References: <20210317100211.1067585-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/7] pipeline: ipa: raspberrypi: Open the CamHelper on ipa::init() 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" Move the opening of the CamHelper from ipa::configure() to ipa::init(). This allows the pipeline handler to get the sensor specific parameters in in pipeline_handler::match() where the ipa is initialised. Having the sensor parameters available earlier will allow selective use of the embedded data node in a future change. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/raspberrypi.mojom | 7 +-- src/ipa/raspberrypi/raspberrypi.cpp | 60 +++++++++---------- .../pipeline/raspberrypi/raspberrypi.cpp | 36 ++++++----- 3 files changed, 46 insertions(+), 57 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index eb427697d349..a713c88eee19 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -15,10 +15,6 @@ enum BufferMask { /* Size of the LS grid allocation. */ const uint32 MaxLsGridSize = 0x8000; -enum ConfigOutputParameters { - ConfigSensorParams = 0x01, -}; - struct SensorConfig { uint32 gainDelay; uint32 exposureDelay; @@ -41,7 +37,6 @@ struct ConfigInput { struct ConfigOutput { uint32 params; - SensorConfig sensorConfig; ControlList controls; }; @@ -51,7 +46,7 @@ struct StartControls { }; interface IPARPiInterface { - init(IPASettings settings) => (int32 ret); + init(IPASettings settings) => (int32 ret, SensorConfig sensorConfig); start(StartControls controls) => (StartControls result); stop(); diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 7904225a29fa..8a9eb92b39ec 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -79,7 +79,7 @@ public: munmap(lsTable_, ipa::RPi::MaxLsGridSize); } - int init(const IPASettings &settings) override; + int init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig) override; void start(const ipa::RPi::StartControls &data, ipa::RPi::StartControls *result) override; void stop() override {} @@ -164,9 +164,35 @@ private: double maxFrameDuration_; }; -int IPARPi::init(const IPASettings &settings) +int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig) { tuningFile_ = settings.configurationFile; + + /* + * Load the "helper" for this sensor. This tells us all the device specific stuff + * that the kernel driver doesn't. We only do this the first time; we don't need + * to re-parse the metadata after a simple mode-switch for no reason. + */ + helper_ = std::unique_ptr(RPiController::CamHelper::Create(settings.sensorModel)); + if (!helper_) { + LOG(IPARPI, Error) << "Could not create camera helper for " + << settings.sensorModel; + return -EINVAL; + } + + /* + * Pass out the sensor config to the pipeline handler in order + * to setup the staggered writer class. + */ + int gainDelay, exposureDelay, vblankDelay, sensorMetadata; + helper_->GetDelays(exposureDelay, gainDelay, vblankDelay); + sensorMetadata = helper_->SensorEmbeddedDataPresent(); + + sensorConfig->gainDelay = gainDelay; + sensorConfig->exposureDelay = exposureDelay; + sensorConfig->vblankDelay = vblankDelay; + sensorConfig->sensorMetadata = sensorMetadata; + return 0; } @@ -319,36 +345,6 @@ int IPARPi::configure(const CameraSensorInfo &sensorInfo, /* Setup a metadata ControlList to output metadata. */ libcameraMetadata_ = ControlList(controls::controls); - /* - * Load the "helper" for this sensor. This tells us all the device specific stuff - * that the kernel driver doesn't. We only do this the first time; we don't need - * to re-parse the metadata after a simple mode-switch for no reason. - */ - std::string cameraName(sensorInfo.model); - if (!helper_) { - helper_ = std::unique_ptr(RPiController::CamHelper::Create(cameraName)); - - if (!helper_) { - LOG(IPARPI, Error) << "Could not create camera helper for " - << cameraName; - return -1; - } - - /* - * Pass out the sensor config to the pipeline handler in order - * to setup the staggered writer class. - */ - int gainDelay, exposureDelay, vblankDelay, sensorMetadata; - helper_->GetDelays(exposureDelay, gainDelay, vblankDelay); - sensorMetadata = helper_->SensorEmbeddedDataPresent(); - - result->params |= ipa::RPi::ConfigSensorParams; - result->sensorConfig.gainDelay = gainDelay; - result->sensorConfig.exposureDelay = exposureDelay; - result->sensorConfig.vblankDelay = vblankDelay; - result->sensorConfig.sensorMetadata = sensorMetadata; - } - /* Re-assemble camera mode using the sensor info. */ setMode(sensorInfo); diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 2c8ae31a28ad..ce1994186d66 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -146,7 +146,7 @@ public: void frameStarted(uint32_t sequence); - int loadIPA(); + int loadIPA(ipa::RPi::SensorConfig *sensorConfig); int configureIPA(const CameraConfiguration *config); void statsMetadataComplete(uint32_t bufferId, const ControlList &controls); @@ -1030,11 +1030,24 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) if (data->sensor_->init()) return false; - if (data->loadIPA()) { + ipa::RPi::SensorConfig sensorConfig; + if (data->loadIPA(&sensorConfig)) { LOG(RPI, Error) << "Failed to load a suitable IPA library"; return false; } + /* + * Setup our delayed control writer with the sensor default + * gain and exposure delays. Mark VBLANK for priority write. + */ + std::unordered_map params = { + { V4L2_CID_ANALOGUE_GAIN, { sensorConfig.gainDelay, false } }, + { V4L2_CID_EXPOSURE, { sensorConfig.exposureDelay, false } }, + { V4L2_CID_VBLANK, { sensorConfig.vblankDelay, true } } + }; + data->delayedCtrls_ = std::make_unique(data->unicam_[Unicam::Image].dev(), params); + data->sensorMetadata_ = sensorConfig.sensorMetadata; + /* Register the controls that the Raspberry Pi IPA can handle. */ data->controlInfo_ = RPi::Controls; /* Initialize the camera properties. */ @@ -1214,7 +1227,7 @@ void RPiCameraData::frameStarted(uint32_t sequence) delayedCtrls_->applyControls(sequence); } -int RPiCameraData::loadIPA() +int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig) { ipa_ = IPAManager::createIPA(pipe_, 1, 1); @@ -1230,7 +1243,7 @@ int RPiCameraData::loadIPA() IPASettings settings(ipa_->configurationFile(sensor_->model() + ".json"), sensor_->model()); - return ipa_->init(settings); + return ipa_->init(settings, sensorConfig); } int RPiCameraData::configureIPA(const CameraConfiguration *config) @@ -1293,21 +1306,6 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) return -EPIPE; } - if (result.params & ipa::RPi::ConfigSensorParams) { - /* - * Setup our delayed control writer with the sensor default - * gain and exposure delays. Mark VBLANK for priority write. - */ - std::unordered_map params = { - { V4L2_CID_ANALOGUE_GAIN, { result.sensorConfig.gainDelay, false } }, - { V4L2_CID_EXPOSURE, { result.sensorConfig.exposureDelay, false } }, - { V4L2_CID_VBLANK, { result.sensorConfig.vblankDelay, true } } - }; - - delayedCtrls_ = std::make_unique(unicam_[Unicam::Image].dev(), params); - sensorMetadata_ = result.sensorConfig.sensorMetadata; - } - if (!result.controls.empty()) { ControlList &ctrls = result.controls; unicam_[Unicam::Image].dev()->setControls(&ctrls); From patchwork Wed Mar 17 10:02:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11601 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 BB044BD80C for ; Wed, 17 Mar 2021 10:02:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 33B1A68D6B; Wed, 17 Mar 2021 11:02:23 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="KRY4IO/f"; dkim-atps=neutral Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E1B2668D64 for ; Wed, 17 Mar 2021 11:02:20 +0100 (CET) Received: by mail-ej1-x632.google.com with SMTP id c10so1575629ejx.9 for ; Wed, 17 Mar 2021 03:02:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9d0Ao7XbkMYX6Y2YZicWKq7YJ5FSsGKWU9neZBJlIYE=; b=KRY4IO/fhWDGv7kmxp3DmYpDUAfKmDFe63Pjr+nl17zJHwR0nJK5q9cZT+zDgZNHp0 qnJT3v8skjo82VsKnrQyPFz3Q5Biwq+ZoAwfjuUO4QkWb+lTQoTFb9Xcs0Hs8VzTtEnR bJV9O9QPoYseNUoJvJTZNqFS6Fcp1MWDgAeKbAPVNAW3fY+jbYQXQYIrG1l+BF1kW70S oeKv7Tji8F4QHlPaTuwwaQRhlpbnqysQbL3VSGuwXz/6usjWGkvhgmaFPU9Zt9DJIkkr NralOLVmIlmEfMhrLaKw+lZ77JLhn+TsrExs7689g/67PqsR5rIJTwLLpJkyJLdYgvwP KPuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9d0Ao7XbkMYX6Y2YZicWKq7YJ5FSsGKWU9neZBJlIYE=; b=j0r8okq8ou87libX/XTX3tO3kg/q4/AaHzhePYc1IKjke4J5cdq9EhsX73TcvPrEy/ DTEAX+826dpsF/FFz9uI1Jra+NdZXventOFpHgoMxKBOW3QbY45NG5cEY12ww2t3JSGM mfH+Ev41/S1vLZh5Z7lANT020G7aJ9ZjHnSdUP0cukGY6mFezOQA6SlGkEG7TTql2bll 3TrYowEC8Fdtl4wDv041Lm/fHwsgO/hpevGm6/nuQbCmv/OpMIWjlOuF9R82xE9UcGsn unrfu4CgWtGLCR5HpY0Yj0sqoHVqJKYlQgGX1jWCTT5RQaVT05aD1JnKzETEsipEdbA4 cgpw== X-Gm-Message-State: AOAM5331+lnmZzTptZxE1cJJ2qcLzU2iKN6kg9i/MOtanO5dhS9W+Ohm YI2xfkcC4VL7aI3evv9s3TZEqF7ugCpEJw== X-Google-Smtp-Source: ABdhPJyUGUJhNTWQ1jyMWN0DNvU2XoToD+Qv+Ypcd+zeUvYguJXb7sZzgq0ZvzeXMn3a2Z26X4ZoHQ== X-Received: by 2002:a17:906:380b:: with SMTP id v11mr35136608ejc.183.1615975340087; Wed, 17 Mar 2021 03:02:20 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id p24sm12061179edt.5.2021.03.17.03.02.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 03:02:19 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 17 Mar 2021 10:02:07 +0000 Message-Id: <20210317100211.1067585-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317100211.1067585-1-naush@raspberrypi.com> References: <20210317100211.1067585-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/7] pipeline: raspberrypi: Conditionally open the embedded data node 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" Conditionally open the embedded data node in pipeline_handler::match() based on whether the ipa::init() result reports if the sensor supports embedded data or not. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- .../pipeline/raspberrypi/raspberrypi.cpp | 60 ++++++++----------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index ce1994186d66..cd8a10a5747f 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -138,7 +138,7 @@ class RPiCameraData : public CameraData { public: RPiCameraData(PipelineHandler *pipe) - : CameraData(pipe), embeddedNodeOpened_(false), state_(State::Stopped), + : CameraData(pipe), state_(State::Stopped), supportsFlips_(false), flipsAlterBayerOrder_(false), updateScalerCrop_(true), dropFrameCount_(0), ispOutputCount_(0) { @@ -183,7 +183,6 @@ public: std::unique_ptr delayedCtrls_; bool sensorMetadata_; - bool embeddedNodeOpened_; /* * All the functions in this class are called from a single calling @@ -749,19 +748,13 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) LOG(RPI, Error) << "Failed to configure the IPA: " << ret; /* - * The IPA will set data->sensorMetadata_ to true if embedded data is - * supported on this sensor. If so, open the Unicam embedded data - * node and configure the output format. + * Configure the Unicam embedded data output format only if the sensor + * supports it. */ if (data->sensorMetadata_) { format = {}; format.fourcc = V4L2PixelFormat(V4L2_META_FMT_SENSOR_DATA); - if (!data->embeddedNodeOpened_) { - data->unicam_[Unicam::Embedded].dev()->open(); - data->embeddedNodeOpened_ = true; - } - LOG(RPI, Debug) << "Setting embedded data format."; ret = data->unicam_[Unicam::Embedded].dev()->setFormat(&format); if (ret) { @@ -778,14 +771,6 @@ int PipelineHandlerRPi::configure(Camera *camera, CameraConfiguration *config) */ if (rawStream) data->unicam_[Unicam::Embedded].setExternal(true); - } else { - /* - * No embedded data present, so we do not want to iterate over - * the embedded data stream when starting and stopping. - */ - data->streams_.erase(std::remove(data->streams_.begin(), data->streams_.end(), - &data->unicam_[Unicam::Embedded]), - data->streams_.end()); } /* @@ -989,24 +974,6 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) data->isp_[Isp::Output1] = RPi::Stream("ISP Output1", isp_->getEntityByName("bcm2835-isp0-capture2")); data->isp_[Isp::Stats] = RPi::Stream("ISP Stats", isp_->getEntityByName("bcm2835-isp0-capture3")); - /* This is just for convenience so that we can easily iterate over all streams. */ - for (auto &stream : data->unicam_) - data->streams_.push_back(&stream); - for (auto &stream : data->isp_) - data->streams_.push_back(&stream); - - /* - * Open all Unicam and ISP streams. The exception is the embedded data - * stream, which only gets opened if the IPA reports that the sensor - * supports embedded data. This happens in RPiCameraData::configureIPA(). - */ - for (auto const stream : data->streams_) { - if (stream != &data->unicam_[Unicam::Embedded]) { - if (stream->dev()->open()) - return false; - } - } - /* Wire up all the buffer connections. */ data->unicam_[Unicam::Image].dev()->frameStart.connect(data.get(), &RPiCameraData::frameStarted); data->unicam_[Unicam::Image].dev()->bufferReady.connect(data.get(), &RPiCameraData::unicamBufferDequeue); @@ -1036,6 +1003,27 @@ bool PipelineHandlerRPi::match(DeviceEnumerator *enumerator) return false; } + /* + * Open all Unicam and ISP streams. The exception is the embedded data + * stream, which only gets opened if the IPA reports that the sensor + * supports embedded data below. + * + * The below grouping is just for convenience so that we can easily + * iterate over all streams in one go. + */ + for (auto &stream : data->unicam_) { + if (sensorConfig.sensorMetadata || &stream != &data->unicam_[Unicam::Embedded]) { + data->streams_.push_back(&stream); + if (stream.dev()->open()) + return false; + } + } + for (auto &stream : data->isp_) { + data->streams_.push_back(&stream); + if (stream.dev()->open()) + return false; + } + /* * Setup our delayed control writer with the sensor default * gain and exposure delays. Mark VBLANK for priority write. From patchwork Wed Mar 17 10:02:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11602 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 38350BD80C for ; Wed, 17 Mar 2021 10:02:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CEA6268D79; Wed, 17 Mar 2021 11:02:26 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="L/W8joOr"; dkim-atps=neutral Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A56546084D for ; Wed, 17 Mar 2021 11:02:21 +0100 (CET) Received: by mail-ed1-x52d.google.com with SMTP id bf3so1476120edb.6 for ; Wed, 17 Mar 2021 03:02:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3j3E0s8hAbb5lYiPxB6D4ErMchd8R4yQ+P49/lrs8E8=; b=L/W8joOr+171BsPkLV1GrjR6sRpaJ5TeW9PzBIHQyZT1qIw/2dOJfnDCSKI0tShkH1 W+kYwbXwQ2kkP9eympQ9+JXN+OoUszurkJPTVj+yR3Od04G7wKWYkxluNufyyal24XDa Yq5Osf9eq4X+0X5vpi1Race7THK2bjEHd2FCnQXvdIIY5tgN4R3MibQ7r3vKJ4YzZjyl RvoRxVtlaIFYP2smmXxIXXpUwHZ8lP6V/EyFXWzO4pcxWcL5Tq4m/AIQv1rCUlFSA/wl NBuesZ/RHkurZIRNDWCpwHQWPHpYq+rCeCMSdadTLBju9ERB+uRUY34Z64MwoAAwdtyq WH2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3j3E0s8hAbb5lYiPxB6D4ErMchd8R4yQ+P49/lrs8E8=; b=svDnp5nQKjewr3DJlQL8HOnOJ+LYlhahsu7qdcOViEGC/q18/NetjLVAX2kZj95EnN McIzxvgQ46B6EmdMjchToIWp4yR+vlGwwy+Jipdu1OMliZXOF1UcXTxGhQ9O73TxN4gL Ykku+Wfese+hWzC1oR6XqZ5lUW7Ci8d9WwJpvvBSR3/leGnlY+MFkkcNwna5RrqGaH4+ mj2ZCYs60kZHd6apLbiMPjg/6K5JJ9YAraFbdVKR2zovHpwa5Xx4PGJk5ps/Vc2r3+lD usfg4ftLtIWdefYulJ/HOWciLKTlJddyj6zGorA62tIAr6xUt/E/RC4pm0bFhRS6t8Pm rwNg== X-Gm-Message-State: AOAM532jIfIy3/XczdfF7gsklheL8k7SWPRQoLIY9m92LPSs/9wjFAWK SZ3UggcCuVtbrnfmGe4IF845pB7/p54ReA== X-Google-Smtp-Source: ABdhPJwa8C/GCAiUcp0NH1ZGwCD6xGy9DIeYCJnp5tDCaxBro3vtmR1LgnAI10VRTPLmvq1j4ux0/Q== X-Received: by 2002:aa7:dbd3:: with SMTP id v19mr40613258edt.314.1615975341096; Wed, 17 Mar 2021 03:02:21 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id p24sm12061179edt.5.2021.03.17.03.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 03:02:20 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 17 Mar 2021 10:02:08 +0000 Message-Id: <20210317100211.1067585-5-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317100211.1067585-1-naush@raspberrypi.com> References: <20210317100211.1067585-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 4/7] ipa: raspberrypi: Move the controller initialise to ipa::init() 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 controller initialise is a one-off operation, so move it from ipa::configure() to ipa::init(). Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/raspberrypi.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 8a9eb92b39ec..e2db0716b84b 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -127,9 +127,6 @@ private: ControlInfoMap ispCtrls_; ControlList libcameraMetadata_; - /* IPA configuration. */ - std::string tuningFile_; - /* Camera sensor params. */ CameraMode mode_; CameraMode lastMode_; @@ -166,8 +163,6 @@ private: int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig) { - tuningFile_ = settings.configurationFile; - /* * Load the "helper" for this sensor. This tells us all the device specific stuff * that the kernel driver doesn't. We only do this the first time; we don't need @@ -193,6 +188,10 @@ int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConf sensorConfig->vblankDelay = vblankDelay; sensorConfig->sensorMetadata = sensorMetadata; + /* Load the tuning file for this sensor. */ + controller_.Read(settings.configurationFile.c_str()); + controller_.Initialise(); + return 0; } @@ -374,12 +373,7 @@ int IPARPi::configure(const CameraSensorInfo &sensorInfo, /* Pass the camera mode to the CamHelper to setup algorithms. */ helper_->SetCameraMode(mode_); - if (!controllerInit_) { - /* Load the tuning file for this sensor. */ - controller_.Read(tuningFile_.c_str()); - controller_.Initialise(); - controllerInit_ = true; - + if (firstStart_) { /* Supply initial values for frame durations. */ applyFrameDurations(defaultMinFrameDuration, defaultMaxFrameDuration); From patchwork Wed Mar 17 10:02:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11603 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 C0B2EBD80C for ; Wed, 17 Mar 2021 10:02:27 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 68BAF68D69; Wed, 17 Mar 2021 11:02:27 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="p/UYiYC/"; dkim-atps=neutral Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 782ED68D60 for ; Wed, 17 Mar 2021 11:02:22 +0100 (CET) Received: by mail-ed1-x532.google.com with SMTP id x21so1482178eds.4 for ; Wed, 17 Mar 2021 03:02:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i0Iw9t0eXvZQY0D2HztYUW+2hZU4Zj5K8M2ZQyPbQEM=; b=p/UYiYC/PvkKpoQ7HG9xvsiR676BKSAJcoDM+mmemyImGh+UFb9bJUSuXbgijE2NW2 3V8bi39XP8HU4SvvzWUTwwWWJdrKeGkFM8uphU95k+RY0QZRQbkB6x+myIS+D3IeAvBk SlLSBp1bXdAlng3WuUwlny6u1OES2Fzz5IplyHFTYvp0S56DZpiw3tQS4W2/p6poLQt/ d2cYLX6/W2J5UzeQ1jQAdqQ3Yp3xwzYLKtEAsSpiXa6dYwiiJdMcyqN61RDMPUVPMwJI 6nsAPvxBB9JCortIoWawrkoQTPbEmE5F594ysLX+PwgR6w/lQMz9GStZqHPV1Bgud7Pb B+wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i0Iw9t0eXvZQY0D2HztYUW+2hZU4Zj5K8M2ZQyPbQEM=; b=eDaUhpU+OkaaRXN/GsyzHGbQGqfL2UXIJXKU9TXJqZ510t5J2ryjjfv+PVuKF4dR0e 8b2lst+Frtn/2N+4pqNHe8ybW3QVOUx9okLskHux+3Cngoj/yH+Iq8AtNdCFEQXM/q/M Del4z9KmbF4KtVPmmsvaTyg50DdQRGGSfVPNIo05smaTI+wiAF+kd2HBzEyTWC2fsMPT UpSEZUEKrNWhOXOSMDVMV60FadOAf35ElDd+cmtmWaxtQbzrn9zGRuBO42b8+iVE9i66 prUA6C9cSsu/4ixgS44O3HnwSeagbzlmhERBQcLJkaKmMTz69muVeW5nw90UFPTEvlF/ RS9g== X-Gm-Message-State: AOAM5315mz6krmUPA5oA1Zj0BsDYgpgWJWBBkj8uHwO28IMH9JXDyKVd QMUxewq+5mVpMZH2lzA+CMOTK/huo2f3Eg== X-Google-Smtp-Source: ABdhPJyY96jlYd7Ec/ex3GbYHsoln98LVTuaojuX9IqIQZvBo/6E631FfMfArbLxkbNn8QtnwlzIKA== X-Received: by 2002:a05:6402:b85:: with SMTP id cf5mr42025200edb.248.1615975341945; Wed, 17 Mar 2021 03:02:21 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id p24sm12061179edt.5.2021.03.17.03.02.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 03:02:21 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 17 Mar 2021 10:02:09 +0000 Message-Id: <20210317100211.1067585-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317100211.1067585-1-naush@raspberrypi.com> References: <20210317100211.1067585-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 5/7] ipa: raspberrypi: Remove unused member variables 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" With the recent refactoring of code from ipa::configure() to ipa::init() some member variable are now unused, so remove them. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- src/ipa/raspberrypi/raspberrypi.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index e2db0716b84b..2ca64bcdb80a 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -67,8 +67,7 @@ class IPARPi : public ipa::RPi::IPARPiInterface { public: IPARPi() - : lastMode_({}), controller_(), controllerInit_(false), - frameCount_(0), checkCount_(0), mistrustCount_(0), + : controller_(), frameCount_(0), checkCount_(0), mistrustCount_(0), lsTable_(nullptr), firstStart_(true) { } @@ -129,12 +128,10 @@ private: /* Camera sensor params. */ CameraMode mode_; - CameraMode lastMode_; /* Raspberry Pi controller specific defines. */ std::unique_ptr helper_; RPiController::Controller controller_; - bool controllerInit_; RPiController::Metadata rpiMetadata_; /* @@ -387,8 +384,6 @@ int IPARPi::configure(const CameraSensorInfo &sensorInfo, result->controls = std::move(ctrls); } - lastMode_ = mode_; - return 0; } From patchwork Wed Mar 17 10:02:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11605 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 13F46BD80C for ; Wed, 17 Mar 2021 10:02:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9BC3C68D61; Wed, 17 Mar 2021 11:02:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="U6tAdZ88"; dkim-atps=neutral Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 53ACA68D70 for ; Wed, 17 Mar 2021 11:02:23 +0100 (CET) Received: by mail-ed1-x536.google.com with SMTP id w18so1525489edc.0 for ; Wed, 17 Mar 2021 03:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vf26R/+BQ3DxH+cRVpdFU3E7Pa4DtHwiBHbuzqa+d8k=; b=U6tAdZ88sclQsDuAal/9H6SHg2iGpiL92wvZt8QC1U2Jr7pfnl3qCWdD1DVn9kXfml OeZVFKjJrCvmP/DNuNSTXc1h4qvY3sLUzhQrt17csMJ/UkAGtZ7XqjgYbL6AiJqk0Ejv MO9BXmrGifsrQ9WwIACDi4FWjbI03u1LrQyYaJkCVD8tdOGiPgjpTrr0t6GYOnoGTNdF 5qfv24BR/sqn71ThimGQ+r8M+v7c2toMXGInx6fZ9wApiHwLWZ+pMdCtSUQCsx1OYTkE 4yEYXMxPynsJmDrckeOxLWlu7ldNhFfpLjWEjimma3NUcHBdmHox2yQ9718WQwMsw1y+ GU3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vf26R/+BQ3DxH+cRVpdFU3E7Pa4DtHwiBHbuzqa+d8k=; b=sflj0XYvH0ovrATqFtRwsLApWAjlpDiQaCj9rATrlB6SNU4roUw0h/k1Zc5GtvR57F TMaHb5RCu+u7y5ikkqfQ5pzqa38ozlnVtUtEznD/6qk1gNF+Ff7oFFft239E/HFxaBMB 5HvT0pQSWQRBGeNpzJfxW9lNXUJ7x+/U4sHREuk+kVwpQuNRheaxjKV1sN8JTG/XHJ3q e48o6Szwi4C3Kwtr6OtcsFVgzcF5FFIJ5QYezdHkYAjV7ZSiAlQuZJIw1ejnGaMlhsGp YhY1BuFo093tosmYKQHHBV4e0kIH2FbZt1LThEHRY5pogMjk/qUdazvV2mAOkh26meD7 oJ3w== X-Gm-Message-State: AOAM532J+9CVlqL1AGOI/l/KoBjOXdEyRd0gPfjN3SMWa53unDZROGJW ZDanpbAuhDk/5UwyBBhQdgx1iYoBax2J9A== X-Google-Smtp-Source: ABdhPJxvpWiQbZuW1k1PvbY5dhWOM/pbtqGeCg+6abkp7bCMIqP2g8zGe5edQ8G1x05wogEOF18EDg== X-Received: by 2002:aa7:d4cb:: with SMTP id t11mr40516083edr.202.1615975342767; Wed, 17 Mar 2021 03:02:22 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id p24sm12061179edt.5.2021.03.17.03.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 03:02:22 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 17 Mar 2021 10:02:10 +0000 Message-Id: <20210317100211.1067585-7-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317100211.1067585-1-naush@raspberrypi.com> References: <20210317100211.1067585-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 6/7] ipa: raspberrypi: Rationalise parameters to ipa::start() 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" Separate out the in and out parameters in ipa::start() as they are not the same. This function now takes in a ControlList and returns out a struct StartConfig which holds a ControlList and drop frame count for the pipeline handler to action. Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/raspberrypi.mojom | 4 ++-- src/ipa/raspberrypi/raspberrypi.cpp | 16 +++++++--------- .../pipeline/raspberrypi/raspberrypi.cpp | 16 +++++++--------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index a713c88eee19..7549397a27c4 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -40,14 +40,14 @@ struct ConfigOutput { ControlList controls; }; -struct StartControls { +struct StartConfig { ControlList controls; int32 dropFrameCount; }; interface IPARPiInterface { init(IPASettings settings) => (int32 ret, SensorConfig sensorConfig); - start(StartControls controls) => (StartControls result); + start(ControlList controls) => (StartConfig startConfig); stop(); /** diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 2ca64bcdb80a..417a7922c3bd 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -79,8 +79,7 @@ public: } int init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig) override; - void start(const ipa::RPi::StartControls &data, - ipa::RPi::StartControls *result) override; + void start(const ControlList &controls, ipa::RPi::StartConfig *startConfig) override; void stop() override {} int configure(const CameraSensorInfo &sensorInfo, @@ -192,15 +191,14 @@ int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConf return 0; } -void IPARPi::start(const ipa::RPi::StartControls &data, - ipa::RPi::StartControls *result) +void IPARPi::start(const ControlList &controls, ipa::RPi::StartConfig *startConfig) { RPiController::Metadata metadata; - ASSERT(result); - if (!data.controls.empty()) { + ASSERT(startConfig); + if (!controls.empty()) { /* We have been given some controls to action before start. */ - queueRequest(data.controls); + queueRequest(controls); } controller_.SwitchMode(mode_, &metadata); @@ -215,7 +213,7 @@ void IPARPi::start(const ipa::RPi::StartControls &data, if (agcStatus.shutter_time != 0.0 && agcStatus.analogue_gain != 0.0) { ControlList ctrls(sensorCtrls_); applyAGC(&agcStatus, ctrls); - result->controls = std::move(ctrls); + startConfig->controls = std::move(ctrls); } /* @@ -262,7 +260,7 @@ void IPARPi::start(const ipa::RPi::StartControls &data, mistrustCount_ = helper_->MistrustFramesModeSwitch(); } - result->dropFrameCount = dropFrame; + startConfig->dropFrameCount = dropFrame; firstStart_ = false; } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index cd8a10a5747f..16568d56f31c 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -815,20 +815,18 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) data->applyScalerCrop(*controls); /* Start the IPA. */ - ipa::RPi::StartControls ipaData; - ipa::RPi::StartControls result; + ControlList startControls; + ipa::RPi::StartConfig startConfig; if (controls) - ipaData.controls = *controls; - data->ipa_->start(ipaData, &result); + startControls = *controls; + data->ipa_->start(startControls, &startConfig); /* Apply any gain/exposure settings that the IPA may have passed back. */ - if (!result.controls.empty()) { - ControlList &ctrls = result.controls; - data->unicam_[Unicam::Image].dev()->setControls(&ctrls); - } + if (!startConfig.controls.empty()) + data->unicam_[Unicam::Image].dev()->setControls(&startConfig.controls); /* Configure the number of dropped frames required on startup. */ - data->dropFrameCount_ = result.dropFrameCount; + data->dropFrameCount_ = startConfig.dropFrameCount; /* We need to set the dropFrameCount_ before queueing buffers. */ ret = queueAllBuffers(camera); From patchwork Wed Mar 17 10:02:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11606 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 94A6ABD80C for ; Wed, 17 Mar 2021 10:02:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 514F668D66; Wed, 17 Mar 2021 11:02:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="IWb8hKTm"; dkim-atps=neutral Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 610C968D61 for ; Wed, 17 Mar 2021 11:02:24 +0100 (CET) Received: by mail-ej1-x635.google.com with SMTP id si25so1614408ejb.1 for ; Wed, 17 Mar 2021 03:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pWK9zy4d291lt9BeUusdrPtxdNtadrrurtsmDLh0kJQ=; b=IWb8hKTmtHtTwiulc6mf+ms9t4Yws8vFWHsAS9Vqow25MbMw6ECBMKfLE3VBXvIiaJ evO9R5F0T+L8w8JDyKIUT+OjEVJpZcBYzvTIIvBq97QgfKLTdTcOTwedTnqygjiP6GTU fiN79jfTe8MbVY95iNwcXbxlPRQKwYN6Il4ns9x6Zwrd7w3pjjFe83Y+nZlJnX/hhSN/ n6eKfNVy9SgLccbYJgwX7GaRsGwenVhTzfh4Gk6GEB63RlZOQ+Sr1QueKsT6Mae63Oj1 4a7R4ZKCZtPuDl2DQB9Y8dosxDWAdIIQrSDjTuaEV1ifotiKAXDkOKduluCUxiVuRi4r /4hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pWK9zy4d291lt9BeUusdrPtxdNtadrrurtsmDLh0kJQ=; b=EQGQrnlAzxKBsCzCXKLszuvFmLERvR5RchU9bMzSJqkX6j0FMA/Nhh1J26XfyRV8Ee 0jtySelWByRqclnTSAFJUhq5lSve8qkBviLRRyoU+bvpgBlXjHa7Cn+3LYWWAdO7GsjD q37VDWPrm4w583KaekOdo5474iOyrDEyE9uqWn6vZY1KM6JCTjQuy+wJOv5OFIAWpn+v rwSSJkH5MyipY7KV9zPFt6QCS0YmXMmMiRisbXN2Q3tH+Hn9FESfNNMqYM4w8LLmUCvU Kgh4aJfF1ADw8m8gncpGrHsBgHaIq/ELLjPrvK2Wn4syBVal1tPsT2aqB1fwWifEdQq0 j5rw== X-Gm-Message-State: AOAM533jkhUwHZ2GtQ+sU1Cp4nhoN6CdjmP7Mk9rPt10/Yn2dqYp4cn+ 73uIjlfgAk2WllDfWrRwtrEkjRJkPObQig== X-Google-Smtp-Source: ABdhPJwCB5NMcVUq66bzy8edhm65qrGXxi/iV9V3SEKnRj1r3jtbYLBTjKa01ZYJ3Zm7ovaUjO/h8w== X-Received: by 2002:a17:906:3b47:: with SMTP id h7mr33982401ejf.377.1615975343782; Wed, 17 Mar 2021 03:02:23 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id p24sm12061179edt.5.2021.03.17.03.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 03:02:23 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 17 Mar 2021 10:02:11 +0000 Message-Id: <20210317100211.1067585-8-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317100211.1067585-1-naush@raspberrypi.com> References: <20210317100211.1067585-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 7/7] ipa: raspberrypi: Rationalise parameters to ipa::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" Rename ConfigInput to IPAConfig to be more consistent with the naming, and remove ConfigInput::op, as it is never used. Replace ConfigOutput with a ControlList type, as that is the only return type from ipa::configure(). Signed-off-by: Naushir Patuck Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/raspberrypi.mojom | 16 +++++----------- src/ipa/raspberrypi/raspberrypi.cpp | 13 ++++++------- .../pipeline/raspberrypi/raspberrypi.cpp | 13 +++++-------- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index 7549397a27c4..f38c22611cc4 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -29,17 +29,11 @@ struct ISPConfig { ControlList controls; }; -struct ConfigInput { - uint32 op; +struct IPAConfig { uint32 transform; FileDescriptor lsTableHandle; }; -struct ConfigOutput { - uint32 params; - ControlList controls; -}; - struct StartConfig { ControlList controls; int32 dropFrameCount; @@ -57,7 +51,7 @@ interface IPARPiInterface { * \param[in] streamConfig Configuration of all active streams * \param[in] entityControls Controls provided by the pipeline entities * \param[in] ipaConfig Pipeline-handler-specific configuration data - * \param[out] results Pipeline-handler-specific configuration result + * \param[out] controls Controls to apply by the pipeline entity * * This method shall be called when the camera is configured to inform * the IPA of the camera's streams and the sensor settings. @@ -65,14 +59,14 @@ interface IPARPiInterface { * The \a sensorInfo conveys information about the camera sensor settings that * the pipeline handler has selected for the configuration. * - * The \a ipaConfig and \a results parameters carry data passed by the + * The \a ipaConfig and \a controls parameters carry data passed by the * pipeline handler to the IPA and back. */ configure(CameraSensorInfo sensorInfo, map streamConfig, map entityControls, - ConfigInput ipaConfig) - => (int32 ret, ConfigOutput results); + IPAConfig ipaConfig) + => (int32 ret, ControlList controls); /** * \fn mapBuffers() diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 417a7922c3bd..1c928b72fbd0 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -85,8 +85,8 @@ public: int configure(const CameraSensorInfo &sensorInfo, const std::map &streamConfig, const std::map &entityControls, - const ipa::RPi::ConfigInput &data, - ipa::RPi::ConfigOutput *response) override; + const ipa::RPi::IPAConfig &data, + ControlList *controls) override; void mapBuffers(const std::vector &buffers) override; void unmapBuffers(const std::vector &ids) override; void signalStatReady(const uint32_t bufferId) override; @@ -313,16 +313,14 @@ void IPARPi::setMode(const CameraSensorInfo &sensorInfo) 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) + const ipa::RPi::IPAConfig &ipaConfig, + ControlList *controls) { if (entityControls.size() != 2) { LOG(IPARPI, Error) << "No ISP or sensor controls found."; return -1; } - result->params = 0; - sensorCtrls_ = entityControls.at(0); ispCtrls_ = entityControls.at(1); @@ -379,7 +377,8 @@ int IPARPi::configure(const CameraSensorInfo &sensorInfo, agcStatus.analogue_gain = DefaultAnalogueGain; applyAGC(&agcStatus, ctrls); - result->controls = std::move(ctrls); + ASSERT(controls); + *controls = std::move(ctrls); } return 0; diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 16568d56f31c..1f8307a3c1c5 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1240,7 +1240,7 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) std::map streamConfig; std::map entityControls; - ipa::RPi::ConfigInput ipaConfig; + ipa::RPi::IPAConfig ipaConfig; /* Get the device format to pass to the IPA. */ V4L2DeviceFormat sensorFormat; @@ -1283,19 +1283,16 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) } /* Ready the IPA - it must know about the sensor resolution. */ - ipa::RPi::ConfigOutput result; - + ControlList controls; ret = ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig, - &result); + &controls); if (ret < 0) { LOG(RPI, Error) << "IPA configuration failed!"; return -EPIPE; } - if (!result.controls.empty()) { - ControlList &ctrls = result.controls; - unicam_[Unicam::Image].dev()->setControls(&ctrls); - } + if (!controls.empty()) + unicam_[Unicam::Image].dev()->setControls(&controls); /* * Configure the H/V flip controls based on the combination of