{"id":11507,"url":"https://patchwork.libcamera.org/api/patches/11507/?format=json","web_url":"https://patchwork.libcamera.org/patch/11507/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20210308074828.13228-4-paul.elder@ideasonboard.com>","date":"2021-03-08T07:48:28","name":"[libcamera-devel,v2,3/3] DEMO: raspberrypi: Use custom parameters to init()","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"e0d1ee45a806a5cb3259ba191811f53237c9eefd","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/?format=json","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11507/mbox/","series":[{"id":1765,"url":"https://patchwork.libcamera.org/api/series/1765/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1765","date":"2021-03-08T07:48:25","name":"Expand mojom-based code generator","version":2,"mbox":"https://patchwork.libcamera.org/series/1765/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11507/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11507/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 08B0CBD80C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  8 Mar 2021 07:48:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BB01668A9A;\n\tMon,  8 Mar 2021 08:48:46 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AF2CA68A9A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  8 Mar 2021 08:48:44 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0C3658A3;\n\tMon,  8 Mar 2021 08:48:42 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"L1QyMm2u\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1615189724;\n\tbh=PArKrVRk2kdQOHs3K+i4WdSQRmDOoh3tgXWzMwn1Ee0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=L1QyMm2uJYTPPHfPK2E3PKKEm4J8xMh4CvRpE+9WaA9NFsfGqp3SCIQmWBEVI6pBI\n\trFRt3dYD8KS3KAzlbYbdT775rIWpEeS166Ra6MFm0mUoEejYj7GH/bTnBiXd4Poz62\n\tzN+AJszr8wko/ipL6eT8iZhdV78F9k2jZ0T7rPbI=","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon,  8 Mar 2021 16:48:28 +0900","Message-Id":"<20210308074828.13228-4-paul.elder@ideasonboard.com>","X-Mailer":"git-send-email 2.27.0","In-Reply-To":"<20210308074828.13228-1-paul.elder@ideasonboard.com>","References":"<20210308074828.13228-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 3/3] DEMO: raspberrypi: Use custom\n\tparameters to init()","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"This is just a demo to show custom parameters to init() with the\nraspberrypi IPA interface.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n---\n include/libcamera/ipa/raspberrypi.mojom       |  5 ++-\n src/ipa/raspberrypi/raspberrypi.cpp           | 44 ++++++++++---------\n .../pipeline/raspberrypi/raspberrypi.cpp      | 10 +++--\n 3 files changed, 32 insertions(+), 27 deletions(-)","diff":"diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom\nindex f733a2cd..99a62c02 100644\n--- a/include/libcamera/ipa/raspberrypi.mojom\n+++ b/include/libcamera/ipa/raspberrypi.mojom\n@@ -51,7 +51,8 @@ struct StartControls {\n };\n \n interface IPARPiInterface {\n-\tinit(IPASettings settings) => (int32 ret);\n+\tinit(IPASettings settings, string sensorName)\n+\t\t=> (int32 ret, bool metadataSupport);\n \tstart(StartControls controls) => (StartControls result);\n \tstop();\n \n@@ -77,7 +78,7 @@ interface IPARPiInterface {\n \t\t  map<uint32, IPAStream> streamConfig,\n \t\t  map<uint32, ControlInfoMap> entityControls,\n \t\t  ConfigInput ipaConfig)\n-\t\t=> (ConfigOutput results, int32 ret);\n+\t\t=> (int32 ret, ConfigOutput results);\n \n \t/**\n \t * \\fn mapBuffers()\ndiff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 6348d071..ac18dcbd 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -79,16 +79,17 @@ public:\n \t\t\tmunmap(lsTable_, ipa::RPi::MaxLsGridSize);\n \t}\n \n-\tint init(const IPASettings &settings) override;\n+\tint init(const IPASettings &settings, const std::string &sensorName,\n+\t\t bool *metadataSupport) override;\n \tvoid start(const ipa::RPi::StartControls &data,\n \t\t   ipa::RPi::StartControls *result) override;\n \tvoid stop() override {}\n \n-\tvoid configure(const CameraSensorInfo &sensorInfo,\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::ConfigInput &data,\n-\t\t       ipa::RPi::ConfigOutput *response, int32_t *ret) override;\n+\tint configure(const CameraSensorInfo &sensorInfo,\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::ConfigInput &data,\n+\t\t      ipa::RPi::ConfigOutput *response) 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@@ -164,9 +165,14 @@ private:\n \tdouble maxFrameDuration_;\n };\n \n-int IPARPi::init(const IPASettings &settings)\n+int IPARPi::init(const IPASettings &settings, const std::string &sensorName,\n+\t\t bool *metadataSupport)\n {\n+\tLOG(IPARPI, Debug) << \"sensor name is \" << sensorName;\n+\n \ttuningFile_ = settings.configurationFile;\n+\n+\t*metadataSupport = true;\n \treturn 0;\n }\n \n@@ -290,16 +296,15 @@ void IPARPi::setMode(const CameraSensorInfo &sensorInfo)\n \tmode_.max_frame_length = sensorInfo.maxFrameLength;\n }\n \n-void IPARPi::configure(const CameraSensorInfo &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::ConfigInput &ipaConfig,\n-\t\t       ipa::RPi::ConfigOutput *result, int32_t *ret)\n+int IPARPi::configure(const CameraSensorInfo &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::ConfigInput &ipaConfig,\n+\t\t      ipa::RPi::ConfigOutput *result)\n {\n \tif (entityControls.size() != 2) {\n \t\tLOG(IPARPI, Error) << \"No ISP or sensor controls found.\";\n-\t\t*ret = -1;\n-\t\treturn;\n+\t\treturn -1;\n \t}\n \n \tresult->params = 0;\n@@ -309,14 +314,12 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \n \tif (!validateSensorControls()) {\n \t\tLOG(IPARPI, Error) << \"Sensor control validation failed.\";\n-\t\t*ret = -1;\n-\t\treturn;\n+\t\treturn -1;\n \t}\n \n \tif (!validateIspControls()) {\n \t\tLOG(IPARPI, Error) << \"ISP control validation failed.\";\n-\t\t*ret = -1;\n-\t\treturn;\n+\t\treturn -1;\n \t}\n \n \t/* Setup a metadata ControlList to output metadata. */\n@@ -334,8 +337,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \t\tif (!helper_) {\n \t\t\tLOG(IPARPI, Error) << \"Could not create camera helper for \"\n \t\t\t\t\t   << cameraName;\n-\t\t\t*ret = -1;\n-\t\t\treturn;\n+\t\t\treturn -1;\n \t\t}\n \n \t\t/*\n@@ -403,7 +405,7 @@ void IPARPi::configure(const CameraSensorInfo &sensorInfo,\n \n \tlastMode_ = mode_;\n \n-\t*ret = 0;\n+\treturn 0;\n }\n \n void IPARPi::mapBuffers(const std::vector<IPABuffer> &buffers)\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex db91f1b5..3ff0f1cd 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1194,7 +1194,10 @@ int RPiCameraData::loadIPA()\n \n \tIPASettings settings(ipa_->configurationFile(sensor_->model() + \".json\"));\n \n-\treturn ipa_->init(settings);\n+\tbool metadataSupport;\n+\tint ret = ipa_->init(settings, \"sensor name\", &metadataSupport);\n+\tLOG(RPI, Debug) << \"metadata support \" << (metadataSupport ? \"yes\" : \"no\");\n+\treturn ret;\n }\n \n int RPiCameraData::configureIPA(const CameraConfiguration *config)\n@@ -1250,9 +1253,8 @@ int RPiCameraData::configureIPA(const CameraConfiguration *config)\n \t/* Ready the IPA - it must know about the sensor resolution. */\n \tipa::RPi::ConfigOutput result;\n \n-\tipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig,\n-\t\t\t&result, &ret);\n-\n+\tret = ipa_->configure(sensorInfo_, streamConfig, entityControls, ipaConfig,\n+\t\t\t      &result);\n \tif (ret < 0) {\n \t\tLOG(RPI, Error) << \"IPA configuration failed!\";\n \t\treturn -EPIPE;\n","prefixes":["libcamera-devel","v2","3/3"]}