Patch Detail
Show a patch.
GET /api/1.1/patches/16104/?format=api
{ "id": 16104, "url": "https://patchwork.libcamera.org/api/1.1/patches/16104/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16104/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220527191740.242300-3-umang.jain@ideasonboard.com>", "date": "2022-05-27T19:17:39", "name": "[libcamera-devel,RFC,v2,2/3] ipa: ipu3: ipa_context: Extend FCQueue::get()", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "72080b8ae497621af054088ee0846d01eafd4e3e", "submitter": { "id": 86, "url": "https://patchwork.libcamera.org/api/1.1/people/86/?format=api", "name": "Umang Jain", "email": "umang.jain@ideasonboard.com" }, "delegate": { "id": 12, "url": "https://patchwork.libcamera.org/api/1.1/users/12/?format=api", "username": "uajain", "first_name": "Umang", "last_name": "Jain", "email": "umang.jain@ideasonboard.com" }, "mbox": "https://patchwork.libcamera.org/patch/16104/mbox/", "series": [ { "id": 3147, "url": "https://patchwork.libcamera.org/api/1.1/series/3147/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3147", "date": "2022-05-27T19:17:37", "name": "Move frame contexts queue to a separate", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3147/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16104/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16104/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 5D1A9C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 May 2022 19:17:51 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5143D633A5;\n\tFri, 27 May 2022 21:17:50 +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 2AD09633A2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 May 2022 21:17:47 +0200 (CEST)", "from perceval.ideasonboard.com (unknown [90.164.63.43])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D023A32A;\n\tFri, 27 May 2022 21:17:46 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653679070;\n\tbh=6QaKR0Oc06NXJj9OaMhXbRJg5e5/1b7qBXL9P9S32Ik=;\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=KWk4hbcUa4sVe4pVTfT9IRMPLvs2uitClSOnWEF3FvH3L7AilnxHUEd8ep6AqCpLT\n\tPl1yF7ouoBXZHxpKwhpwT02759ejmCAlOxLLOHeX1dEKEHF0vPKnTD/GhjzWhrCvn6\n\tcC1wvH+x/Nj6M4w1gR+F5zFhUgGk1208u6xq08S4Eu5/pUS1KNTlhzufRfyYI0dP0o\n\th+YpP5nMyrW6anZUY3AM+UJvkN1axEYCbBF0Pc83Lfm5fjFZywOZXK+MJATagbRtIA\n\tBH2StG5p1NToxGRo1VzL3CUCM37MQUxcs6/31mWjXclewmwTjitZqKxr8+WVakd8Wy\n\tOKagTTwywW0SA==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653679067;\n\tbh=6QaKR0Oc06NXJj9OaMhXbRJg5e5/1b7qBXL9P9S32Ik=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=WBSVcvyl2IG/0AKOfqr+GMdW1kfluDxXaCv+HdW5E/DCZOgBh2ibKD/QUtCOtSibs\n\tb5FfvxDuijW7HqSwbB+hqA4hjTKAnQRhMLAZ9EJtln8hmfuI5mqJXI2on+ujYcKh52\n\t1DBYSrSVHG9A6JVEPTIWXjoNybRGhF4qQH9FPUO8=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"WBSVcvyl\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 27 May 2022 21:17:39 +0200", "Message-Id": "<20220527191740.242300-3-umang.jain@ideasonboard.com>", "X-Mailer": "git-send-email 2.31.1", "In-Reply-To": "<20220527191740.242300-1-umang.jain@ideasonboard.com>", "References": "<20220527191740.242300-1-umang.jain@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [RFC PATCH v2 2/3] ipa: ipu3: ipa_context: Extend\n\tFCQueue::get()", "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": "Umang Jain via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "Umang Jain <umang.jain@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Extend the FCQueue::get() to return a IPAFrameContext for a\nnon-existent frame. The .get() should be able to figure out if a\nexistent frame context is asked for, or to create a new frame context\nbased on the next available position. To keep track of next available\nposition in the queue, use of head and tail pointer are used.\n\nWe specifically want to have access to the queue through the\n.get() function hence operator[] is deleted for FCQueue as\npart of this patch as well.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/ipa/ipu3/ipa_context.cpp | 81 +++++++++++++++++++++++++++++++++---\n src/ipa/ipu3/ipa_context.h | 5 +++\n src/ipa/ipu3/ipu3.cpp | 4 +-\n 3 files changed, 83 insertions(+), 7 deletions(-)", "diff": "diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp\nindex e5010e3f..dcce6b48 100644\n--- a/src/ipa/ipu3/ipa_context.cpp\n+++ b/src/ipa/ipu3/ipa_context.cpp\n@@ -217,32 +217,96 @@ IPAFrameContext::IPAFrameContext(uint32_t id, const ControlList &reqControls)\n * \\brief Analogue gain multiplier\n */\n \n+/**\n+ * \\class FCQueue\n+ * \\brief A FIFO circular queue holding IPAFrameContext(s)\n+ *\n+ * FCQueue holds all the IPAFrameContext(s) related to frames required\n+ * to be processed by the IPA at a given point. A IPAFrameContext is created\n+ * on the first call FCQueue::get(frame) for that frame. Subsequent calls to\n+ * FCQueue::get() with the same frame number shall return the IPAFrameContext\n+ * previously created until the frame is marked as complete through\n+ * FCQueue::completeFrame(frame).\n+ */\n+\n+/**\n+ * \\var FCQueue::head\n+ * \\brief A pointer to the a IPAFrameContext next expected to complete\n+ */\n+\n+/**\n+ * \\var FCQueue::tail\n+ * \\brief A pointer to the latest IPAFrameContext created\n+ */\n+\n /**\n * \\brief FCQueue constructor\n */\n FCQueue::FCQueue()\n+\t: head(nullptr), tail(nullptr)\n {\n \tclear();\n }\n \n /**\n- * Retrieve the IPAFrameContext for the frame\n+ * \\brief Retrieve the IPAFrameContext for the frame\n * \\param[in] frame Frame number for which the IPAFrameContext needs to\n * retrieved\n *\n+ * This functions returns the IPAFrameContext for the desired frame. If the\n+ * frame context does not exists in the queue, the next available reference\n+ * of the position in the queue, is returned. It is the responsibility of the\n+ * caller to fill the correct IPAFrameContext parameters of newly returned\n+ * IPAFrameContext.\n+ *\n * \\return Reference to the IPAFrameContext\n */\n IPAFrameContext &FCQueue::get(uint32_t frame)\n {\n-\tIPAFrameContext &frameContext = this->at(frame % kMaxFrameContexts);\n+\tif (frame <= tail->frame) {\n+\t\tIPAFrameContext &frameContext = this->at(frame % kMaxFrameContexts);\n+\t\tif (frame != frameContext.frame)\n+\t\t\tLOG(IPAIPU3, Warning)\n+\t\t\t\t<< \"Got wrong frame context for frame \" << frame;\n+\t\treturn frameContext;\n+\t} else {\n+\t\t/*\n+\t\t * Frame context doesn't exist yet so get the next available\n+\t\t * position in the queue.\n+\t\t */\n+\t\ttail = &this->at((tail->frame + 1) % kMaxFrameContexts);\n+\t\ttail->frame = frame;\n \n-\tif (frame != frameContext.frame) {\n+\t\t/* Avoid over-queuing of frame contexts */\n+\t\tif (tail->frame > kMaxFrameContexts &&\n+\t\t (tail->frame - head->frame) >= kMaxFrameContexts) {\n+\t\t\tLOG(IPAIPU3, Error) << \"FCQueue is full!\";\n+\n+\t\t\t/* \\todo: Determine return reference? or make it fatal? */\n+\t\t}\n+\n+\t\treturn *tail;\n+\t}\n+}\n+\n+/**\n+ * \\brief Notifies the FCQueue that a frame has been completed\n+ * \\param[in] frame The completed frame number\n+ */\n+void FCQueue::completeFrame(uint32_t frame)\n+{\n+\tif (head->frame != frame)\n \t\tLOG(IPAIPU3, Warning)\n-\t\t\t<< \"Got wrong frame context for frame\" << frame\n-\t\t\t<< \" or frame context doesn't exist yet\";\n+\t\t\t<< \"Frame \" << frame << \" completed out-of-sync?\";\n+\n+\tif (frame > tail->frame) {\n+\t\tLOG(IPAIPU3, Error)\n+\t\t\t<< \"Completing a frame \" << frame\n+\t\t\t<< \" not present in the queue is disallowed\";\n+\t\treturn;\n \t}\n \n-\treturn frameContext;\n+\thead = &this->get(frame + 1);\n }\n \n /**\n@@ -252,6 +316,11 @@ void FCQueue::clear()\n {\n \tIPAFrameContext initFrameContext;\n \tthis->fill(initFrameContext);\n+\n+\t/* Intialise 0th index to frame 0 */\n+\tthis->at(0).frame = 0;\n+\ttail = &this->at(0);\n+\thead = tail;\n }\n \n } /* namespace ipa::ipu3 */\ndiff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\nindex 61454b41..b36ec61d 100644\n--- a/src/ipa/ipu3/ipa_context.h\n+++ b/src/ipa/ipu3/ipa_context.h\n@@ -93,9 +93,14 @@ class FCQueue : public std::array<IPAFrameContext, kMaxFrameContexts>\n {\n public:\n \tFCQueue();\n+\tFCQueue &operator[](const FCQueue &) = delete;\n \n \tvoid clear();\n+\tvoid completeFrame(uint32_t frame);\n \tIPAFrameContext &get(uint32_t frame);\n+\n+\tIPAFrameContext *head;\n+\tIPAFrameContext *tail;\n };\n \n struct IPAContext {\ndiff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex c48d2f62..e09c5d05 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -605,6 +605,8 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n \t */\n \n \tmetadataReady.emit(frame, ctrls);\n+\n+\tcontext_.frameContexts.completeFrame(frame);\n }\n \n /**\n@@ -618,7 +620,7 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n void IPAIPU3::queueRequest(const uint32_t frame, const ControlList &controls)\n {\n \t/* \\todo Start processing for 'frame' based on 'controls'. */\n-\tcontext_.frameContexts[frame % kMaxFrameContexts] = { frame, controls };\n+\tcontext_.frameContexts.get(frame) = { frame, controls };\n }\n \n /**\n", "prefixes": [ "libcamera-devel", "RFC", "v2", "2/3" ] }