{"id":16904,"url":"https://patchwork.libcamera.org/api/patches/16904/?format=json","web_url":"https://patchwork.libcamera.org/patch/16904/","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":"<20220802102943.3221109-6-chenghaoyang@google.com>","date":"2022-08-02T10:29:39","name":"[libcamera-devel,v4,5/9] ipu3: Update IPAIPU3Interface::fillParamsBuffer with captureBufferId","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"abe5818059950c3e62be63ceb543f6fcd1dc2546","submitter":{"id":117,"url":"https://patchwork.libcamera.org/api/people/117/?format=json","name":"Cheng-Hao Yang","email":"chenghaoyang@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/16904/mbox/","series":[{"id":3357,"url":"https://patchwork.libcamera.org/api/series/3357/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3357","date":"2022-08-02T10:29:34","name":"Use two imgus in ipu3 pipeline handler","version":4,"mbox":"https://patchwork.libcamera.org/series/3357/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/16904/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/16904/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 247C2C3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  2 Aug 2022 10:30:01 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DA0C863321;\n\tTue,  2 Aug 2022 12:30:00 +0200 (CEST)","from mail-pf1-x429.google.com (mail-pf1-x429.google.com\n\t[IPv6:2607:f8b0:4864:20::429])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D9E5A63321\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Aug 2022 12:29:58 +0200 (CEST)","by mail-pf1-x429.google.com with SMTP id 17so13214445pfy.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 02 Aug 2022 03:29:58 -0700 (PDT)","from chenghaoyang-low.c.googlers.com.com\n\t(231.137.80.34.bc.googleusercontent.com. [34.80.137.231])\n\tby smtp.gmail.com with ESMTPSA id\n\tt15-20020a170902e84f00b0016db88f69a2sm1955128plg.141.2022.08.02.03.29.55\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 02 Aug 2022 03:29:56 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1659436200;\n\tbh=4WzB0CSclEuEB8tkJJRrAqgZQS3c9xGlo2hHnYBTO4A=;\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:Cc:\n\tFrom;\n\tb=ysBkxhOjat14cdjY7tr9l1sbBTs6rYAGg2Rf8MT36wkGbFeAb/rnVPuTi6Mwfj9cN\n\tfx5haCsLS/eZbs5LacmMAhxy18UiWC/UNvEs8XvMcw727ZXYgs0AXPRGscsg9xTJvQ\n\twwqgULQ0dmSmodL7LXpY4AWAve8Bt+JJE65ChJOjkUamrMF2sOxgP7oIZjRUSxgHl8\n\tI7k48e0t+PIr9Kdr4B5CHb7LvwhHmOkcIvhq9LtMB/6azwtXrNHfARJCaNvzwv5x1u\n\t2R6SY+UGjxf2MlgMZKOiJ96Kmkt0s9ZJL72tGjcGgq8Qvb5cps0MdPYM8ArUsynNBY\n\tV/zmwQM2D/PGQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=lwZSNK4m47bsqn6MMOTV9F42bJ3SBDlJaP+3cftDLIM=;\n\tb=CoR9JRKntpL6KRKpMUBN/lwcO/vDC9Rs+wLqxhpmnghLM/wTJzC5KSic1Ec67eQv1J\n\txeFZE+wXGHTZZ00kA1Hl8d0JPD4U0koAHqiHyGvWAxhcReaArgwPo/72aSRvqhLzk6+O\n\tG1v4oY/JIgi5DfCheSXc8nG8UQEb7a1Ug105k="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=chromium.org\n\theader.i=@chromium.org header.b=\"CoR9JRKn\"; \n\tdkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=lwZSNK4m47bsqn6MMOTV9F42bJ3SBDlJaP+3cftDLIM=;\n\tb=0C4dKo6mZyVNfe+r2aQhD5nn+nvwnPlGmzNmpRsNKTBOi4J/OB0/GXJIyZn1VIuMEj\n\t1yW4DoLgpf/cDAsbo6iPmeQu4NB573f0hXhUcvUEItT8eywVFQkWfiFA9bxngI7FGsPV\n\tqBhMCc+xGxiEvCV6wdgIwCEXsz2SKCanUQS4qWubwfEN4kIvgWZwa+zczTVXKaJO7dDH\n\tMnpNihYGe4TiiL14QMdqy2S5qXxe4riDWnYbprqUuDX2nJDOOsBff6YPGpUOjzfMhPzq\n\tAL/8/pM9na3ema0f9tyjqCpvHjgZD9Lfhi3q6HjMbo6aAp+ne8A/daYFPIi8NZCpznkA\n\tsMPg==","X-Gm-Message-State":"ACgBeo2QozzHOlu4mlqsKw3/2bffQIBCMJ9qQTZT55U276M4TSkU+JXc\n\txUNYjGmsSbgjd2azm1Whcd+lRPP73FrIYw==","X-Google-Smtp-Source":"AA6agR4qepdhsmxz4wkLdctLsG6q0C/ICQQBq0qPpB03EA7FC+YkXxHFhsvrM15jWiGEQLcVwdKO0g==","X-Received":"by 2002:a63:4b1b:0:b0:41c:863:8ccf with SMTP id\n\ty27-20020a634b1b000000b0041c08638ccfmr7492413pga.509.1659436196574; \n\tTue, 02 Aug 2022 03:29:56 -0700 (PDT)","X-Google-Original-From":"Harvey Yang <chenghaoyang@google.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue,  2 Aug 2022 10:29:39 +0000","Message-Id":"<20220802102943.3221109-6-chenghaoyang@google.com>","X-Mailer":"git-send-email 2.37.1.455.g008518b4e5-goog","In-Reply-To":"<20220802102943.3221109-1-chenghaoyang@google.com>","References":"<20220802102943.3221109-1-chenghaoyang@google.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 5/9] ipu3: Update\n\tIPAIPU3Interface::fillParamsBuffer with captureBufferId","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":"Harvey Yang via libcamera-devel <libcamera-devel@lists.libcamera.org>","Reply-To":"Harvey Yang <chenghaoyang@chromium.org>","Cc":"Harvey Yang <chenghaoyang@chromium.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"From: Harvey Yang <chenghaoyang@chromium.org>\n\nThis patch names the ipa interface |IPAIPU3Interface::fillParamsBuffer|\nas |IPAIPU3Interface::fillParamsBuffers|, and add input |captureBufferId|\nto fill the param buffer for the StillCapture stream as well.\n\nSigned-off-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n include/libcamera/ipa/ipu3.mojom       |  2 +-\n src/ipa/ipu3/ipu3-ipa-design-guide.rst |  6 +++---\n src/ipa/ipu3/ipu3.cpp                  | 25 ++++++++++++++++++++-----\n src/libcamera/pipeline/ipu3/ipu3.cpp   |  3 ++-\n 4 files changed, 26 insertions(+), 10 deletions(-)","diff":"diff --git a/include/libcamera/ipa/ipu3.mojom b/include/libcamera/ipa/ipu3.mojom\nindex d1b1c6b8..1f337b1d 100644\n--- a/include/libcamera/ipa/ipu3.mojom\n+++ b/include/libcamera/ipa/ipu3.mojom\n@@ -31,7 +31,7 @@ interface IPAIPU3Interface {\n \tunmapBuffers(array<uint32> ids);\n \n \t[async] queueRequest(uint32 frame, libcamera.ControlList controls);\n-\t[async] fillParamsBuffer(uint32 frame, uint32 bufferId);\n+\t[async] fillParamsBuffers(uint32 frame, uint32 bufferId, uint32 captureBufferId);\n \t[async] processStatsBuffer(uint32 frame, int64 frameTimestamp,\n \t\t\t\t   uint32 bufferId, libcamera.ControlList sensorControls);\n };\ndiff --git a/src/ipa/ipu3/ipu3-ipa-design-guide.rst b/src/ipa/ipu3/ipu3-ipa-design-guide.rst\nindex e724fdda..6e106a03 100644\n--- a/src/ipa/ipu3/ipu3-ipa-design-guide.rst\n+++ b/src/ipa/ipu3/ipu3-ipa-design-guide.rst\n@@ -25,7 +25,7 @@ from applications, and managing events from the pipeline handler.\n       └─┬───┬───┬──────┬────┬────┬────┬─┴────▼─┬──┘    1: init()\n         │   │   │      │ ▲  │ ▲  │ ▲  │ ▲      │       2: configure()\n         │1  │2  │3     │4│  │4│  │4│  │4│      │5      3: mapBuffers(), start()\n-        │   │   │      │ │  │ │  │ │  │ │      │       4: (▼) queueRequest(), fillParamsBuffer(), processStatsBuffer()\n+        │   │   │      │ │  │ │  │ │  │ │      │       4: (▼) queueRequest(), fillParamsBuffers(), processStatsBuffer()\n         ▼   ▼   ▼      ▼ │  ▼ │  ▼ │  ▼ │      ▼          (▲) setSensorControls, paramsBufferReady, metadataReady Signals\n       ┌──────────────────┴────┴────┴────┴─────────┐    5: stop(), unmapBuffers()\n       │ IPU3 IPA                                  │\n@@ -102,7 +102,7 @@ to operate when running:\n \n -  configure()\n -  queueRequest()\n--  fillParamsBuffer()\n+-  fillParamsBuffers()\n -  processStatsBuffer()\n \n The configuration phase allows the pipeline-handler to inform the IPA of\n@@ -117,7 +117,7 @@ When configured, the IPA is notified by the pipeline handler of the\n Camera ``start()`` event, after which incoming requests will be queued\n for processing, requiring a parameter buffer (``ipu3_uapi_params``) to\n be populated for the ImgU. This is given to the IPA through\n-``fillParamsBuffer()``, and then passed directly to each algorithm\n+``fillParamsBuffers()``, and then passed directly to each algorithm\n through the ``prepare()`` call allowing the ISP configuration to be\n updated for the needs of each component that the algorithm is\n responsible for.\ndiff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex dd6cfd79..35c87785 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -82,14 +82,14 @@ namespace ipa::ipu3 {\n  * parameter buffer, and adapting the settings of the sensor attached to the\n  * IPU3 CIO2 through sensor-specific V4L2 controls.\n  *\n- * In fillParamsBuffer(), we populate the ImgU parameter buffer with\n+ * In fillParamsBuffers(), we populate the ImgU parameter buffer with\n  * settings to configure the device in preparation for handling the frame\n  * queued in the Request.\n  *\n  * When the frame has completed processing, the ImgU will generate a statistics\n  * buffer which is given to the IPA with processStatsBuffer(). In this we run the\n  * algorithms to parse the statistics and cache any results for the next\n- * fillParamsBuffer() call.\n+ * fillParamsBuffers() call.\n  *\n  * The individual algorithms are split into modular components that are called\n  * iteratively to allow them to process statistics from the ImgU in a defined\n@@ -146,7 +146,8 @@ public:\n \tvoid unmapBuffers(const std::vector<unsigned int> &ids) override;\n \n \tvoid queueRequest(const uint32_t frame, const ControlList &controls) override;\n-\tvoid fillParamsBuffer(const uint32_t frame, const uint32_t bufferId) override;\n+\tvoid fillParamsBuffers(const uint32_t frame, const uint32_t bufferId,\n+\t\t\t      const uint32_t captureBufferId) override;\n \tvoid processStatsBuffer(const uint32_t frame, const int64_t frameTimestamp,\n \t\t\t\tconst uint32_t bufferId,\n \t\t\t\tconst ControlList &sensorControls) override;\n@@ -508,12 +509,14 @@ void IPAIPU3::unmapBuffers(const std::vector<unsigned int> &ids)\n /**\n  * \\brief Fill and return a buffer with ISP processing parameters for a frame\n  * \\param[in] frame The frame number\n- * \\param[in] bufferId ID of the parameter buffer to fill\n+ * \\param[in] bufferId ID of the video parameter buffer to fill\n+ * \\param[in] captureBufferId ID of the capture parameter buffer to fill\n  *\n  * Algorithms are expected to fill the IPU3 parameter buffer for the next\n  * frame given their most recent processing of the ImgU statistics.\n  */\n-void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)\n+void IPAIPU3::fillParamsBuffers(const uint32_t frame, const uint32_t bufferId,\n+\t\t\t       const uint32_t captureBufferId)\n {\n \tauto it = buffers_.find(bufferId);\n \tif (it == buffers_.end()) {\n@@ -536,6 +539,18 @@ void IPAIPU3::fillParamsBuffer(const uint32_t frame, const uint32_t bufferId)\n \t */\n \tparams->use = {};\n \n+\tfor (auto const &algo : algorithms_)\n+\t\talgo->prepare(context_, params);\n+\n+\t// TODO: use different algorithms to set StillCapture params.\n+\tit = buffers_.find(captureBufferId);\n+\tif (it == buffers_.end()) {\n+\t\tLOG(IPAIPU3, Error) << \"Could not find capture param buffer!\";\n+\t\treturn;\n+\t}\n+\tmem = it->second.planes()[0];\n+\tparams = reinterpret_cast<ipu3_uapi_params *>(mem.data());\n+\tparams->use = {};\n \tfor (auto const &algo : algorithms_)\n \t\talgo->prepare(context_, params);\n \ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex 4efa1019..d0da146c 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -1416,7 +1416,8 @@ void IPU3CameraData::cio2BufferReady(FrameBuffer *buffer)\n \tif (request->findBuffer(&rawStream_))\n \t\tpipe()->completeBuffer(request, buffer);\n \n-\tipa_->fillParamsBuffer(info->id, info->paramBuffer->cookie());\n+\tipa_->fillParamsBuffers(info->id, info->paramBuffer->cookie(),\n+\t\t\t\tinfo->captureParamBuffer->cookie());\n }\n \n void IPU3CameraData::paramBufferReady(FrameBuffer *buffer)\n","prefixes":["libcamera-devel","v4","5/9"]}