Patch Detail
Show a patch.
GET /api/patches/21646/?format=api
{ "id": 21646, "url": "https://patchwork.libcamera.org/api/patches/21646/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21646/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20241016170348.715993-3-jacopo.mondi@ideasonboard.com>", "date": "2024-10-16T17:03:43", "name": "[2/4] libipa: FCQueue: Make sure FrameContext#0 is initialized", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "22817e73ad948874747646d62872b853d2274129", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21646/mbox/", "series": [ { "id": 4708, "url": "https://patchwork.libcamera.org/api/series/4708/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4708", "date": "2024-10-16T17:03:41", "name": "libipa: Initialize FrameContext with ActiveState", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4708/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21646/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21646/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 93CBEC32FA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 16 Oct 2024 17:04:10 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 12B1365388;\n\tWed, 16 Oct 2024 19:04:05 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 264C96537F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 16 Oct 2024 19:04:00 +0200 (CEST)", "from ideasonboard.com (unknown [5.179.178.254])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 65798A57;\n\tWed, 16 Oct 2024 19:02:16 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"mpfIL3z/\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1729098137;\n\tbh=ApN1YnTciaugYHGpzFbsef+SuUqa2tEbXHZztJC5rFo=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=mpfIL3z/fbNf92KTTYy8R0RfuaZe2UgU8bz4p+cGllmo0p9W00TwHp2Q1iC9QFN2z\n\tR9UsJuRS+x+KhqspqLNsBysG9K+WaEoN0tEkHp2bt+Mgt/LCOd2cefMX6jtFOyTkjT\n\tDUjM77ET0qZBNPo+75EnqdcFXlwsM48xpOxe5I4k=", "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>", "Subject": "[PATCH 2/4] libipa: FCQueue: Make sure FrameContext#0 is initialized", "Date": "Wed, 16 Oct 2024 19:03:43 +0200", "Message-ID": "<20241016170348.715993-3-jacopo.mondi@ideasonboard.com>", "X-Mailer": "git-send-email 2.47.0", "In-Reply-To": "<20241016170348.715993-1-jacopo.mondi@ideasonboard.com>", "References": "<20241016170348.715993-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>\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 b1e8bc1485d4..bfcce5a81356 100644\n--- a/src/ipa/libipa/fc_queue.h\n+++ b/src/ipa/libipa/fc_queue.h\n@@ -26,11 +26,13 @@ protected:\n \tvirtual void init(const uint32_t frameNum)\n \t{\n \t\tframe = frameNum;\n+\t\tinitialised = true;\n \t}\n \n private:\n \ttemplate<typename T> friend class FCQueue;\n \tuint32_t frame;\n+\tbool initialised = false;\n };\n \n template<typename FrameContext>\n@@ -44,8 +46,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@@ -89,6 +93,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\tframeContext.init(frame);\n+\n+\t\t\treturn frameContext;\n+\t\t}\n+\n \t\tif (frame == frameContext.frame)\n \t\t\treturn frameContext;\n \n", "prefixes": [ "2/4" ] }