Show a patch.

GET /api/1.1/patches/16103/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 16103,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/16103/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16103/",
    "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-2-umang.jain@ideasonboard.com>",
    "date": "2022-05-27T19:17:38",
    "name": "[libcamera-devel,RFC,v2,1/3] ipa: ipu3: Separate out frame context queue as a distinct class",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "30acdb631e425cd2d871afc292646350e4fd64a9",
    "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/16103/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/16103/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16103/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 BBC92BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 27 May 2022 19:17:49 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6120165635;\n\tFri, 27 May 2022 21:17:49 +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 C297A633A5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 27 May 2022 21:17:45 +0200 (CEST)",
            "from perceval.ideasonboard.com (unknown [90.164.63.43])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 69FE132A;\n\tFri, 27 May 2022 21:17:45 +0200 (CEST)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1653679069;\n\tbh=JWNocmS/1zMKAmAH7+gCe5WZ8Ds2o2RQRGf/ObWD9Hw=;\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=mM+Ry3IDPqAB5o9vbIfAd4fTM6QdLH9HIdzyn2+h2xrqh0syg4leDLqYVS8JWcRN0\n\tpQcfQ7aiB+nCBsr2cAtoq9LTlepcSZ5t7cjOQ7J4arv9jExDSgcnrjxEGTXvxKOuUn\n\tsR2mUfvqaQ4vdCDKCqK9co9AaheLjAvrPU0TZFWZYYvdMwWr9EhWDNkuSmlDXSMHCM\n\t1qFroj9ermRU3jmp0LwzheqeCJcoUx0m/b1IuzOwMvKsc0Fy6Ja0g0R1bTeq9CLoEM\n\tFZpbWAXkTjbGk0R4QduHgktLa29At4MyNKrWOiWsHv/8AvrZZRie0WgcFiaxyRIcjK\n\tJJRi1rvVj76AQ==",
            "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1653679065;\n\tbh=JWNocmS/1zMKAmAH7+gCe5WZ8Ds2o2RQRGf/ObWD9Hw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=gPD+3O+C9Pfoo6V418PWKW3Gek1FwoXWWq75QfhVZPBzJaxvtdlpsHHw4Asz7BPg/\n\t9JlA48L5o3epop72q7vIo8teXqmIG2U9YJ0Kk7wn0lQ9myzZawfm7mTqT1jW+RTxVF\n\tMMom+9yK/gVhAJYr3lPByUBFafgclIWRE8O37UnU="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"gPD+3O+C\"; dkim-atps=neutral",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 27 May 2022 21:17:38 +0200",
        "Message-Id": "<20220527191740.242300-2-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 1/3] ipa: ipu3: Separate out frame\n\tcontext queue as a distinct class",
        "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": "There are cases where we need more checks and balance to be carried out\nby the frame context queue class. For that, separate it out as a\ndistinct class on which we can build upon.\n\nFor now, a minimialistic implementation is provided with .get(frame)\nhelper which returns a IPAFrameContext for the required frame.\nGoing ahead more such helpers can be provided to access/modify the\nframe context queue.\n\nSigned-off-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n src/ipa/ipu3/ipa_context.cpp | 49 ++++++++++++++++++++++++++++++++++--\n src/ipa/ipu3/ipa_context.h   | 11 +++++++-\n src/ipa/ipu3/ipu3.cpp        |  6 ++---\n 3 files changed, 60 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/src/ipa/ipu3/ipa_context.cpp b/src/ipa/ipu3/ipa_context.cpp\nindex 13cdb835..e5010e3f 100644\n--- a/src/ipa/ipu3/ipa_context.cpp\n+++ b/src/ipa/ipu3/ipa_context.cpp\n@@ -7,12 +7,18 @@\n \n #include \"ipa_context.h\"\n \n+#include <libcamera/base/log.h>\n+\n /**\n  * \\file ipa_context.h\n  * \\brief Context and state information shared between the algorithms\n  */\n \n-namespace libcamera::ipa::ipu3 {\n+namespace libcamera {\n+\n+LOG_DECLARE_CATEGORY(IPAIPU3)\n+\n+namespace ipa::ipu3 {\n \n /**\n  * \\struct IPASessionConfiguration\n@@ -211,4 +217,43 @@ IPAFrameContext::IPAFrameContext(uint32_t id, const ControlList &reqControls)\n  * \\brief Analogue gain multiplier\n  */\n \n-} /* namespace libcamera::ipa::ipu3 */\n+/**\n+ * \\brief FCQueue constructor\n+ */\n+FCQueue::FCQueue()\n+{\n+\tclear();\n+}\n+\n+/**\n+ * Retrieve the IPAFrameContext for the frame\n+ * \\param[in] frame Frame number for which the IPAFrameContext needs to\n+ * retrieved\n+ *\n+ * \\return Reference to the IPAFrameContext\n+ */\n+IPAFrameContext &FCQueue::get(uint32_t frame)\n+{\n+\tIPAFrameContext &frameContext = this->at(frame % kMaxFrameContexts);\n+\n+\tif (frame != frameContext.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}\n+\n+\treturn frameContext;\n+}\n+\n+/**\n+ * \\brief Clear the FCQueue by resetting all the entries in the ring-buffer\n+ */\n+void FCQueue::clear()\n+{\n+\tIPAFrameContext initFrameContext;\n+\tthis->fill(initFrameContext);\n+}\n+\n+} /* namespace ipa::ipu3 */\n+\n+} /* namespace libcamera */\ndiff --git a/src/ipa/ipu3/ipa_context.h b/src/ipa/ipu3/ipa_context.h\nindex 42e11141..61454b41 100644\n--- a/src/ipa/ipu3/ipa_context.h\n+++ b/src/ipa/ipu3/ipa_context.h\n@@ -89,11 +89,20 @@ struct IPAFrameContext {\n \tControlList frameControls;\n };\n \n+class FCQueue : public std::array<IPAFrameContext, kMaxFrameContexts>\n+{\n+public:\n+\tFCQueue();\n+\n+\tvoid clear();\n+\tIPAFrameContext &get(uint32_t frame);\n+};\n+\n struct IPAContext {\n \tIPASessionConfiguration configuration;\n \tIPAActiveState activeState;\n \n-\tstd::array<IPAFrameContext, kMaxFrameContexts> frameContexts;\n+\tFCQueue frameContexts;\n };\n \n } /* namespace ipa::ipu3 */\ndiff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp\nindex 2f6bb672..c48d2f62 100644\n--- a/src/ipa/ipu3/ipu3.cpp\n+++ b/src/ipa/ipu3/ipu3.cpp\n@@ -456,8 +456,8 @@ int IPAIPU3::configure(const IPAConfigInfo &configInfo,\n \n \t/* Clean IPAActiveState at each reconfiguration. */\n \tcontext_.activeState = {};\n-\tIPAFrameContext initFrameContext;\n-\tcontext_.frameContexts.fill(initFrameContext);\n+\tcontext_.frameContexts.clear();\n+\n \n \tif (!validateSensorControls()) {\n \t\tLOG(IPAIPU3, Error) << \"Sensor control validation failed.\";\n@@ -569,7 +569,7 @@ void IPAIPU3::processStatsBuffer(const uint32_t frame,\n \tconst ipu3_uapi_stats_3a *stats =\n \t\treinterpret_cast<ipu3_uapi_stats_3a *>(mem.data());\n \n-\tIPAFrameContext &frameContext = context_.frameContexts[frame % kMaxFrameContexts];\n+\tIPAFrameContext &frameContext = context_.frameContexts.get(frame);\n \n \tif (frameContext.frame != frame)\n \t\tLOG(IPAIPU3, Warning) << \"Frame \" << frame << \" does not match its frame context\";\n",
    "prefixes": [
        "libcamera-devel",
        "RFC",
        "v2",
        "1/3"
    ]
}