Patch Detail
Show a patch.
GET /api/1.1/patches/21777/?format=api
{ "id": 21777, "url": "https://patchwork.libcamera.org/api/1.1/patches/21777/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21777/", "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": "<20241030164853.87586-2-jacopo.mondi@ideasonboard.com>", "date": "2024-10-30T16:48:51", "name": "[v2,1/2] libipa: FCQueue: Make sure FrameContext#0 is initialized", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "26984bb67b58799c9f6295b505dea8d56280478d", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/1.1/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21777/mbox/", "series": [ { "id": 4757, "url": "https://patchwork.libcamera.org/api/1.1/series/4757/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4757", "date": "2024-10-30T16:48:50", "name": "libipa: Initialize FrameContext with ActiveState", "version": 2, "mbox": "https://patchwork.libcamera.org/series/4757/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21777/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21777/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 996FDC31E9\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 30 Oct 2024 16:49:07 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9A768653AB;\n\tWed, 30 Oct 2024 17:49:04 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6877B6539A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 30 Oct 2024 17:49:02 +0100 (CET)", "from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id E3EFB1083;\n\tWed, 30 Oct 2024 17:48:58 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"p40FhJQW\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1730306939;\n\tbh=LimbK/+ayXRBlcQOFit0Xdmpq/mWvshsQTZC5cQILbg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=p40FhJQWjmjFj4QkxJcn1I6fxtBa79CBPxZ4m9tmhqomi2J/hk+VD7U+LLkzE1Gi0\n\t7SOLt1kCLZvGbiKO7XuicZyDWcRfTVIUBItx9rukFiJ6z1bdWA6TBwIl/wdwVe0m0q\n\tIaHxWBvLDuT57DjV5FKbaKPZaz6c1AJN8uv0yW0U=", "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tStefan Klug <stefan.klug@ideasonboard.com>,\n\tDan Scally <dan.scally@ideasonboard.com>", "Subject": "[PATCH v2 1/2] libipa: FCQueue: Make sure FrameContext#0 is\n\tinitialized", "Date": "Wed, 30 Oct 2024 17:48:51 +0100", "Message-ID": "<20241030164853.87586-2-jacopo.mondi@ideasonboard.com>", "X-Mailer": "git-send-email 2.47.0", "In-Reply-To": "<20241030164853.87586-1-jacopo.mondi@ideasonboard.com>", "References": "<20241030164853.87586-1-jacopo.mondi@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Some IPA modules, like the RkISP1 one, call FCQueue::get(0) at\nIPA::start() time, before any frame context has been allocated with\nFCQueue::alloc() called at queueRequest() time.\n\nThe FCQueue implementation aims to detect when a FrameContext is get()\nbefore it is alloc()-ated, Warns about it, and initializes the\nFrameContext before returning it.\n\nIn case of frame#0, a get() preceding an alloc() call is not detected\nas the \"frame == frameContext.frame\" test returns success, as\nFrameContexts are zeroed by default.\n\nAs a result, the first returned FrameContext is not initialized.\n\nExplicitly test for frame#0 to make sure the FrameContext is initialized\nif get(0) is called before alloc(0). To avoid re-initializing a frame\ncontext, in case alloc() has been called correctly before get(),\nintroduce an \"initialised\" state variable that tracks the FrameContext\ninitialisation state.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\nReviewed-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n src/ipa/libipa/fc_queue.h | 21 ++++++++++++++++++++-\n 1 file changed, 20 insertions(+), 1 deletion(-)", "diff": "diff --git a/src/ipa/libipa/fc_queue.h b/src/ipa/libipa/fc_queue.h\nindex 24d9e82b727d..a1d136521107 100644\n--- a/src/ipa/libipa/fc_queue.h\n+++ b/src/ipa/libipa/fc_queue.h\n@@ -25,6 +25,7 @@ struct FrameContext {\n private:\n \ttemplate<typename T> friend class FCQueue;\n \tuint32_t frame;\n+\tbool initialised = false;\n };\n \n template<typename FrameContext>\n@@ -38,8 +39,10 @@ public:\n \n \tvoid clear()\n \t{\n-\t\tfor (FrameContext &ctx : contexts_)\n+\t\tfor (FrameContext &ctx : contexts_) {\n+\t\t\tctx.initialised = false;\n \t\t\tctx.frame = 0;\n+\t\t}\n \t}\n \n \tFrameContext &alloc(const uint32_t frame)\n@@ -83,6 +86,21 @@ public:\n \t\t\t\t\t << \" has been overwritten by \"\n \t\t\t\t\t << frameContext.frame;\n \n+\t\tif (frame == 0 && !frameContext.initialised) {\n+\t\t\t/*\n+\t\t\t * If the IPA calls get() at start() time it will get an\n+\t\t\t * un-intialized FrameContext as the below \"frame ==\n+\t\t\t * frameContext.frame\" check will return success because\n+\t\t\t * FrameContexts are zeroed at creation time.\n+\t\t\t *\n+\t\t\t * Make sure the FrameContext gets initialised if get()\n+\t\t\t * is called before alloc() by the IPA for frame#0.\n+\t\t\t */\n+\t\t\tinit(frameContext, frame);\n+\n+\t\t\treturn frameContext;\n+\t\t}\n+\n \t\tif (frame == frameContext.frame)\n \t\t\treturn frameContext;\n \n@@ -108,6 +126,7 @@ private:\n \t{\n \t\tframeContext = {};\n \t\tframeContext.frame = frame;\n+\t\tframeContext.initialised = true;\n \t}\n \n \tstd::vector<FrameContext> contexts_;\n", "prefixes": [ "v2", "1/2" ] }