From patchwork Mon Jun 28 08:56:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 12722 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 EA3A8C321F for ; Mon, 28 Jun 2021 08:56:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 71C94684D8; Mon, 28 Jun 2021 10:56:36 +0200 (CEST) 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="YIaktZJv"; dkim-atps=neutral Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7B806684D2 for ; Mon, 28 Jun 2021 10:56:33 +0200 (CEST) Received: by mail-wm1-x335.google.com with SMTP id l18-20020a1ced120000b029014c1adff1edso13171039wmh.4 for ; Mon, 28 Jun 2021 01:56:33 -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=OoNdfN627FI5cwtkJre1MidqsYnjhjb1szI/zMamHw0=; b=YIaktZJviBAP39sYuWSDsPV/kJTnXtEcYUWHXZY24AufEHBdAep6SAdjATr08QBZEV HinvKeQehcRONMYC9Syi5BfPUho4qC8TqpsysU5E0++0X71wee3Zdw+n0TxJXpGJ0NIg giZW1x6WaxDXCUxMrnPSk07OrF6LSWDSB7+6qHpTiG8GBXroQIrbL5BVMK2ysfSfqwC7 UCQa21V7Y5yEutZJ92guX5wL3o7K6MhCYeDZXvRsc9EeFrWLBYpik8+3Pq2VzkCKQ9Fe ur6cb/BUlMWYk0MheX8inYJP9gvFDmCiQgnao7nLVM63XNG5KnQ2sdzaS+Nn7Gbqnt7z 8ojQ== 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=OoNdfN627FI5cwtkJre1MidqsYnjhjb1szI/zMamHw0=; b=qZqmXgtqTyFH4oizEvp+aNm63P7zevxk1DW2OKLCxKhhLUbqUj2XHVcf2zFSom52T/ 80lORxhorjUArQsSckeApjuAyaZBnqcJMjLCKQVZxBy6AcdkbAgKNP59HMoJQgf1vlz4 Qb2no8r1hcbsq5XId1GJnRsm7Xrl1KNUNH747uo8Ukq46rPbZsF4JCR33Mkm4eSjXrc2 q0nK4MyX6ZWiExM+HGb194m5QH5Gnh0gzMpRedUPxzpFk0ceJDiumBwvpZ9DA5YJ+5Rj 3qRosoWfX0qKlTN/6Ek+QAR+LWb0z3nbERdJyWwlNMpDxxCFNUq7Px4irx9Uvl8UmYT6 WS0w== X-Gm-Message-State: AOAM530nQNojflV7Zl2+44BXnSCln274CvHlNF5+cUvXJghSNELl53ha jqstwhd8SkGP+K28Nrp5b1e2148KyNmjdA== X-Google-Smtp-Source: ABdhPJzvPe3gGJ6CM2up0YrwCCj3uoaFUUiQnhdYBlNH2040yKcIIYCyEG+3dDiQPnsqxq10jRbPMQ== X-Received: by 2002:a1c:f616:: with SMTP id w22mr10669253wmc.73.1624870593063; Mon, 28 Jun 2021 01:56:33 -0700 (PDT) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:1ce1:9965:4328:89c4]) by smtp.gmail.com with ESMTPSA id g7sm10578243wmq.27.2021.06.28.01.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jun 2021 01:56:32 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Jun 2021 09:56:30 +0100 Message-Id: <20210628085630.2081-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210628085630.2081-1-david.plowman@raspberrypi.com> References: <20210628085630.2081-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/2] libcamera: raspberrypi: fetch correct value for sensor's modeSensitivity 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" These changes retrieve the correct value for sensitivity of the mode selected for the sensor. This value is known to the CamHelper which passes it across to the pipeline handler so that it can be set correctly in the CameraConfiguration. Signed-off-by: David Plowman --- include/libcamera/ipa/raspberrypi.mojom | 7 ++++++- src/ipa/raspberrypi/raspberrypi.cpp | 7 +++++-- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 9 ++++++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index 606d1de4..3a71c167 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -38,6 +38,10 @@ struct IPAConfig { libcamera.FileDescriptor lsTableHandle; }; +struct IPAConfigResult { + float modeSensitivity; +}; + struct StartConfig { libcamera.ControlList controls; int32 dropFrameCount; @@ -57,6 +61,7 @@ interface IPARPiInterface { * \param[in] entityControls Controls provided by the pipeline entities * \param[in] ipaConfig Pipeline-handler-specific configuration data * \param[out] controls Controls to apply by the pipeline entity + * \param[out] result Other results that the pipeline handler may require * * This method shall be called when the camera is configured to inform * the IPA of the camera's streams and the sensor settings. @@ -71,7 +76,7 @@ interface IPARPiInterface { map streamConfig, map entityControls, IPAConfig ipaConfig) - => (int32 ret, libcamera.ControlList controls); + => (int32 ret, libcamera.ControlList controls, IPAConfigResult result); /** * \fn mapBuffers() diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 9ce0db08..76376e06 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -96,7 +96,7 @@ public: const std::map &streamConfig, const std::map &entityControls, const ipa::RPi::IPAConfig &data, - ControlList *controls) override; + ControlList *controls, ipa::RPi::IPAConfigResult *result) override; void mapBuffers(const std::vector &buffers) override; void unmapBuffers(const std::vector &ids) override; void signalStatReady(const uint32_t bufferId) override; @@ -336,7 +336,7 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, [[maybe_unused]] const std::map &streamConfig, const std::map &entityControls, const ipa::RPi::IPAConfig &ipaConfig, - ControlList *controls) + ControlList *controls, ipa::RPi::IPAConfigResult *result) { if (entityControls.size() != 2) { LOG(IPARPI, Error) << "No ISP or sensor controls found."; @@ -388,6 +388,9 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, /* Pass the camera mode to the CamHelper to setup algorithms. */ helper_->SetCameraMode(mode_); + /* The pipeline handler passes out the mode's sensitivity. */ + result->modeSensitivity = mode_.sensitivity; + if (firstStart_) { /* Supply initial values for frame durations. */ applyFrameDurations(defaultMinFrameDuration, defaultMaxFrameDuration); diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index a65b4568..7bace5b8 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(ipa::RPi::SensorConfig *sensorConfig); - int configureIPA(const CameraConfiguration *config); + int configureIPA(CameraConfiguration *config); void statsMetadataComplete(uint32_t bufferId, const ControlList &controls); void runIsp(uint32_t bufferId); @@ -1235,7 +1235,7 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig) return ipa_->init(settings, sensorConfig); } -int RPiCameraData::configureIPA(const CameraConfiguration *config) +int RPiCameraData::configureIPA(CameraConfiguration *config) { /* We know config must be an RPiCameraConfiguration. */ const RPiCameraConfiguration *rpiConfig = @@ -1284,13 +1284,16 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config) /* Ready the IPA - it must know about the sensor resolution. */ ControlList controls; + ipa::RPi::IPAConfigResult result; ret = ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig, - &controls); + &controls, &result); if (ret < 0) { LOG(RPI, Error) << "IPA configuration failed!"; return -EPIPE; } + config->modeSensitivity = result.modeSensitivity; + if (!controls.empty()) unicam_[Unicam::Image].dev()->setControls(&controls);