{"id":15667,"url":"https://patchwork.libcamera.org/api/1.1/patches/15667/?format=json","web_url":"https://patchwork.libcamera.org/patch/15667/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20220413095342.389460-3-kieran.bingham@ideasonboard.com>","date":"2022-04-13T09:53:42","name":"[libcamera-devel,v3,2/2] libcamera: raspberrypi: Fetch correct value for sensor's modeSensitivity","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d4ca2bd72e840ab6dbb1470119ef33e0a91ac55d","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15667/mbox/","series":[{"id":3050,"url":"https://patchwork.libcamera.org/api/1.1/series/3050/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3050","date":"2022-04-13T09:53:40","name":"Application support for per-mode sensitivities","version":3,"mbox":"https://patchwork.libcamera.org/series/3050/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/15667/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15667/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7A401C326C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Apr 2022 09:53:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D6DE26564C;\n\tWed, 13 Apr 2022 11:53:28 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A41E2604B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Apr 2022 11:53:25 +0200 (CEST)","from Q.ksquared.org.uk.beta.tailscale.net (unknown\n\t[178.237.134.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D242C59D;\n\tWed, 13 Apr 2022 11:53:24 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649843608;\n\tbh=miftrjCOdbQgKoEARezQKky9Qx5ev/RXSNaMu/NBVz0=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=dZvMRfIBZLPPpmgWsL0wxljVUcTKE7cbwuyWLtgks7x4nLSQeZcNwi1ALHT1yMLCo\n\tueSXZOiTG4UGhknVhO1IKj+4uj6MHaz/50VYgYxUe+SQlDqYoW9OaIUHf/zYm+XW6s\n\tt5CHjdgcfZsdODlJN455V/5FTf9lSj9prQmiKCbAc83mppR7jfX6qxKLAr1IcPEASY\n\t7z4Xi7CF6dmmX9BMMf8LyfTphaXZdhpCov6yAudIJtAJQruzjhi8eBDqejlKXfWj7U\n\tenbpyKt2ZfcaAlynkV01wVPV029rlkIBr96XtYsqAFNO2W6Gv+XMjIpkK9zeijA5Lc\n\tz6vS/EkEvU32A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1649843605;\n\tbh=miftrjCOdbQgKoEARezQKky9Qx5ev/RXSNaMu/NBVz0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=hWDX41ujW5pQkjJ9fv/4AOZ5OEg+ohu4uHzb/fsLMNqskO2BXIu/w2lGaMk91QeRx\n\tHCYIoMXDPXsUHIpjeHfnvwHVIXlmqoO/ji8uRauOH1FlsOPkhicrhwxGapz/UlfWeQ\n\tVzeVHAWAala7mHU6D01bRaSBDaW0cQlkm4F79NF4="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"hWDX41uj\"; dkim-atps=neutral","To":"libcamera devel <libcamera-devel@lists.libcamera.org>,\n\tNaushir Patuck <naush@raspberrypi.com>,\n\tDavid Plowman <david.plowman@raspberrypi.com>","Date":"Wed, 13 Apr 2022 11:53:42 +0200","Message-Id":"<20220413095342.389460-3-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20220413095342.389460-1-kieran.bingham@ideasonboard.com>","References":"<20220413095342.389460-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3 2/2] libcamera: raspberrypi: Fetch\n\tcorrect value for sensor's modeSensitivity","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: David Plowman <david.plowman@raspberrypi.com>\n\nThese changes retrieve the correct value for sensitivity of the mode\nselected for the sensor. This value is known to the CamHelper which\npasses it across to the pipeline handler so that it can be set\ncorrectly in the CameraConfiguration.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\nv3\n - [Kieran] - Manually applied patch to account for rebase\n\nOpen questions:\n\n - Should the controls list that gets returned be moved into the\n   IPAConfigResult ?\n\n - Should this modeSensitivity actually be returned during validate?\n   (This seems more critical to the design of the patch)\n\n include/libcamera/ipa/raspberrypi.mojom            |  7 ++++++-\n src/ipa/raspberrypi/raspberrypi.cpp                |  7 +++++--\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 10 +++++++---\n 3 files changed, 18 insertions(+), 6 deletions(-)","diff":"diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex 5a228b75cd2f..a60c3bb43d3c 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -38,6 +38,10 @@ struct IPAConfig {\n \tlibcamera.SharedFD lsTableHandle;\n };\n \n+struct IPAConfigResult {\n+       float modeSensitivity;\n+};\n+\n struct StartConfig {\n \tlibcamera.ControlList controls;\n \tint32 dropFrameCount;\n@@ -58,6 +62,7 @@ interface IPARPiInterface {\n \t * \\param[in] entityControls Controls provided by the pipeline entities\n \t * \\param[in] ipaConfig Pipeline-handler-specific configuration data\n \t * \\param[out] controls Controls to apply by the pipeline entity\n+\t * \\param[out] result Other results that the pipeline handler may require\n \t *\n \t * This function shall be called when the camera is configured to inform\n \t * the IPA of the camera's streams and the sensor settings.\n@@ -72,7 +77,7 @@ interface IPARPiInterface {\n \t\t  map<uint32, libcamera.IPAStream> streamConfig,\n \t\t  map<uint32, libcamera.ControlInfoMap> entityControls,\n \t\t  IPAConfig ipaConfig)\n-\t\t=> (int32 ret, libcamera.ControlList controls);\n+\t\t=> (int32 ret, libcamera.ControlList controls, IPAConfigResult result);\n \n \t/**\n \t * \\fn mapBuffers()\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 89767a9db471..32a9d5166071 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -97,7 +97,7 @@ public:\n \t\t      const std::map<unsigned int, IPAStream> &streamConfig,\n \t\t      const std::map<unsigned int, ControlInfoMap> &entityControls,\n \t\t      const ipa::RPi::IPAConfig &data,\n-\t\t      ControlList *controls) override;\n+\t\t      ControlList *controls, ipa::RPi::IPAConfigResult *result) override;\n \tvoid mapBuffers(const std::vector<IPABuffer> &buffers) override;\n \tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n \tvoid signalStatReady(const uint32_t bufferId) override;\n@@ -342,7 +342,7 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\n \t\t      [[maybe_unused]] const std::map<unsigned int, IPAStream> &streamConfig,\n \t\t      const std::map<unsigned int, ControlInfoMap> &entityControls,\n \t\t      const ipa::RPi::IPAConfig &ipaConfig,\n-\t\t      ControlList *controls)\n+\t\t      ControlList *controls, ipa::RPi::IPAConfigResult *result)\n {\n \tif (entityControls.size() != 2) {\n \t\tLOG(IPARPI, Error) << \"No ISP or sensor controls found.\";\n@@ -402,6 +402,9 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\n \t */\n \tControlList ctrls(sensorCtrls_);\n \n+\t/* The pipeline handler passes out the mode's sensitivity. */\n+\tresult->modeSensitivity = mode_.sensitivity;\n+\n \tif (firstStart_) {\n \t\t/* Supply initial values for frame durations. */\n \t\tapplyFrameDurations(defaultMinFrameDuration, defaultMaxFrameDuration);\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex d6148724bdd5..3cba7ba993ad 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -200,7 +200,7 @@ public:\n \tvoid frameStarted(uint32_t sequence);\n \n \tint loadIPA(ipa::RPi::SensorConfig *sensorConfig);\n-\tint configureIPA(const CameraConfiguration *config);\n+\tint configureIPA(CameraConfiguration *config);\n \n \tvoid enumerateVideoDevices(MediaLink *link);\n \n@@ -1528,7 +1528,7 @@ int RPiCameraData::loadIPA(ipa::RPi::SensorConfig *sensorConfig)\n \treturn ipa_->init(settings, sensorConfig);\n }\n \n-int RPiCameraData::configureIPA(const CameraConfiguration *config)\n+int RPiCameraData::configureIPA(CameraConfiguration *config)\n {\n \tstd::map<unsigned int, IPAStream> streamConfig;\n \tstd::map<unsigned int, ControlInfoMap> entityControls;\n@@ -1573,13 +1573,17 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)\n \n \t/* Ready the IPA - it must know about the sensor resolution. */\n \tControlList controls;\n+\tipa::RPi::IPAConfigResult result;\n \tret = ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig,\n-\t\t\t      &controls);\n+\t\t\t      &controls, &result);\n \tif (ret < 0) {\n \t\tLOG(RPI, Error) << \"IPA configuration failed!\";\n \t\treturn -EPIPE;\n \t}\n \n+\t/* Store the mode sensitivity for the application. */\n+\tconfig->modeSensitivity = result.modeSensitivity;\n+\n \tif (!controls.empty())\n \t\tsetSensorControls(controls);\n \n","prefixes":["libcamera-devel","v3","2/2"]}