From patchwork Wed Sep 22 13:29:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Plowman X-Patchwork-Id: 13886 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 62FEBBF01C for ; Wed, 22 Sep 2021 13:29:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9CEBE69196; Wed, 22 Sep 2021 15:29:29 +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="Vkyotmk7"; dkim-atps=neutral Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4000B6917F for ; Wed, 22 Sep 2021 15:29:26 +0200 (CEST) Received: by mail-wr1-x42b.google.com with SMTP id t7so6694362wrw.13 for ; Wed, 22 Sep 2021 06:29:26 -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=TB6Bt57clhDipCaxaFUZl8FofXJfzseyc3L+AJBLXmQ=; b=Vkyotmk7nRPy+pHRR3sn/SfAcaK4Bss5INVk0l/FTOsjrB1oNyWwwDwAUifWrtxyMy Nj51mnQfoFtuHd6hLmZLrkBJqDB3ueLziVeNs6GWia1IwAljhawnG8/bi7YHFuZUtxDh MIoAZUhNDpV5UJpSe/hOVDumhGgIQWMTXwePf3Dy1Xgf027C5fWlI0Sb7nv+U/z/UmME eiZ0SoqzR8JxH/6DaXUFGzGohT5QiE02XZv2RT25+XVucDl3oO5WMi6FcWZijZvwwEJT Y1phZrES2jRPtnR7oqI3t9O/BvPk8id6JkGJA7Cfx20wT94DetG4ulD/nhAakLdzaY/n djdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TB6Bt57clhDipCaxaFUZl8FofXJfzseyc3L+AJBLXmQ=; b=gHYfDekQ9Y5JwK1faW/uOYezcVuTHBiPd5pVVAxt+SypE4ZZCHcjpRs36kUWiwgX8Q vcSsRuRWU3BlHP91MA22qNLFzw8Xw25xpo2bkwZ6wvSqVIYoocs/gqfI1VKtysbrCmVE Tgcupdg408qT8r7PWWrWSxeeKXd4nAG5PbQG6elpejwjKONc1rW59ipeVvcuA0BQT7t6 eYMQxH1hIh/mJdJjx2aeCno2MX/BHLl7gV8mjXvIpDROdXrp0jIYM4ZMkjmaDPXKwqy6 3B8SqLkKiFIDt6vJHQyoRRczDrF54Lfq/4k+c4oW7pPXXAkndRTyvCawavKO8J9tlXMI MLuQ== X-Gm-Message-State: AOAM533wC41/6f+fI8G1OoSrW3RRGHX7oCXi1jTDBe4/cMKh69m+F570 3r7sXwOKne/5SrM6/sXNEr+c8AsK7BoMx97z X-Google-Smtp-Source: ABdhPJxtFYY7qG5P7aOvnWwQx9ydDNZ7XNNwsefEYVroOJtmzykEQMyia6u/kQ/106ZpOE0w/iQ9Mw== X-Received: by 2002:a05:600c:3585:: with SMTP id p5mr10658012wmq.88.1632317365705; Wed, 22 Sep 2021 06:29:25 -0700 (PDT) Received: from pi4-davidp.pitowers.org ([2a00:1098:3142:14:1ce1:9965:4328:89c4]) by smtp.gmail.com with ESMTPSA id q126sm5776310wma.10.2021.09.22.06.29.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Sep 2021 06:29:24 -0700 (PDT) From: David Plowman To: libcamera-devel@lists.libcamera.org Date: Wed, 22 Sep 2021 14:29:15 +0100 Message-Id: <20210922132915.14881-3-david.plowman@raspberrypi.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210922132915.14881-1-david.plowman@raspberrypi.com> References: <20210922132915.14881-1-david.plowman@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 Reviewed-by: Kieran Bingham Reviewed-by: Naushir Patuck --- include/libcamera/ipa/raspberrypi.mojom | 7 ++++++- src/ipa/raspberrypi/raspberrypi.cpp | 7 +++++-- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 +++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index e453d46c..a92a76f8 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 function 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 047123ab..796e6d15 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -97,7 +97,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; @@ -337,7 +337,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."; @@ -389,6 +389,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 0bdfa727..caf0030e 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -147,7 +147,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); @@ -1250,7 +1250,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 = @@ -1299,13 +1299,17 @@ 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; } + /* Store the mode sensitivity for the application. */ + config->modeSensitivity = result.modeSensitivity; + /* * Configure the H/V flip controls based on the combination of * the sensor and user transform.