Show a patch.

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

{
    "id": 10715,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/10715/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/10715/",
    "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": "<20201224081534.41601-2-paul.elder@ideasonboard.com>",
    "date": "2020-12-24T08:15:26",
    "name": "[libcamera-devel,v6,1/9] libcamera: control_serializer: Save serialized ControlInfoMap in a cache",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "48705d9baebd03836dffb01c2f2280fb75aeb879",
    "submitter": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/people/17/?format=api",
        "name": "Paul Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "delegate": {
        "id": 17,
        "url": "https://patchwork.libcamera.org/api/1.1/users/17/?format=api",
        "username": "epaul",
        "first_name": "Paul",
        "last_name": "Elder",
        "email": "paul.elder@ideasonboard.com"
    },
    "mbox": "https://patchwork.libcamera.org/patch/10715/mbox/",
    "series": [
        {
            "id": 1546,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1546/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1546",
            "date": "2020-12-24T08:15:25",
            "name": "IPA isolation: Part 1: Core components",
            "version": 6,
            "mbox": "https://patchwork.libcamera.org/series/1546/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/10715/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/10715/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 1A23DC0F1A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Dec 2020 08:15:49 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DC123615B4;\n\tThu, 24 Dec 2020 09:15:48 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2053560525\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Dec 2020 09:15:48 +0100 (CET)",
            "from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8D1B0A1D;\n\tThu, 24 Dec 2020 09:15:46 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"AyOwCy1s\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1608797747;\n\tbh=Oo57KEscQYkvO1BeJ3JHiP5sQ75O5M/j/iEKTTTXWsU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=AyOwCy1sTcZBRyeN1KDRogdl1VU+5QImd+KlFyPRqi3aDOlhP6R/zgKpaG3nK6slH\n\tcvg4rjCl1Zap2s2VbGvjLvZAzLNC8TjI3buFhIUujMoo1d7hFAbjERh6u1oWIcMDMi\n\t74VcfxbSwFz78FQvOO0PqPXCOzAoClp0Luf+YMdU=",
        "From": "Paul Elder <paul.elder@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu, 24 Dec 2020 17:15:26 +0900",
        "Message-Id": "<20201224081534.41601-2-paul.elder@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.27.0",
        "In-Reply-To": "<20201224081534.41601-1-paul.elder@ideasonboard.com>",
        "References": "<20201224081534.41601-1-paul.elder@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v6 1/9] libcamera: control_serializer:\n\tSave serialized ControlInfoMap in a cache",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "The ControlSerializer saves all ControlInfoMaps that it has already\n(de)serialized, in order to (de)serialize ControlLists that contain the\nControlInfoMaps. Leverage this to cache ControlInfoMaps, such that the\nControlSerializer will not re-(de)serialize a ControlInfoMap that it has\npreviously (de)serialized.\n\nSigned-off-by: Paul Elder <paul.elder@ideasonboard.com>\n\n---\nNew in v6\n---\n .../libcamera/internal/control_serializer.h   |  1 +\n src/libcamera/control_serializer.cpp          | 30 +++++++++++++++++++\n 2 files changed, 31 insertions(+)",
    "diff": "diff --git a/include/libcamera/internal/control_serializer.h b/include/libcamera/internal/control_serializer.h\nindex 0ab29d9a..76cb3c10 100644\n--- a/include/libcamera/internal/control_serializer.h\n+++ b/include/libcamera/internal/control_serializer.h\n@@ -33,6 +33,7 @@ public:\n \ttemplate<typename T>\n \tT deserialize(ByteStreamBuffer &buffer);\n \n+\tbool isCached(const ControlInfoMap *infoMap);\n private:\n \tstatic size_t binarySize(const ControlValue &value);\n \tstatic size_t binarySize(const ControlInfo &info);\ndiff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp\nindex 258db6df..4cf1c720 100644\n--- a/src/libcamera/control_serializer.cpp\n+++ b/src/libcamera/control_serializer.cpp\n@@ -173,6 +173,11 @@ void ControlSerializer::store(const ControlInfo &info, ByteStreamBuffer &buffer)\n int ControlSerializer::serialize(const ControlInfoMap &infoMap,\n \t\t\t\t ByteStreamBuffer &buffer)\n {\n+\tif (isCached(&infoMap)) {\n+\t\tLOG(Serializer, Info) << \"Serializing ControlInfoMap from cache\";\n+\t\treturn 0;\n+\t}\n+\n \t/* Compute entries and data required sizes. */\n \tsize_t entriesSize = infoMap.size()\n \t\t\t   * sizeof(struct ipa_control_info_entry);\n@@ -347,6 +352,12 @@ ControlInfoMap ControlSerializer::deserialize<ControlInfoMap>(ByteStreamBuffer &\n \t\treturn {};\n \t}\n \n+\tauto iter = infoMaps_.find(hdr->handle);\n+\tif (iter != infoMaps_.end()) {\n+\t\tLOG(Serializer, Info) << \"Deserializing ControlInfoMap from cache\";\n+\t\treturn iter->second;\n+\t}\n+\n \tif (hdr->version != IPA_CONTROLS_FORMAT_VERSION) {\n \t\tLOG(Serializer, Error)\n \t\t\t<< \"Unsupported controls format version \"\n@@ -485,4 +496,23 @@ ControlList ControlSerializer::deserialize<ControlList>(ByteStreamBuffer &buffer\n \treturn ctrls;\n }\n \n+/**\n+ * \\brief Check if some ControlInfoMap is cached\n+ * \\param[in] infoMap The ControlInfoMap to check\n+ *\n+ * The ControlSerializer caches all ControlInfoMaps that it has (de)serialized.\n+ * This function checks if \\a infoMap is in the cache.\n+ *\n+ * \\return True if \\a infoMap is in the cache or if \\a infoMap is\n+ * controls::controls, false otherwise\n+ */\n+bool ControlSerializer::isCached(const ControlInfoMap *infoMap)\n+{\n+\tif (!infoMap)\n+\t\treturn true;\n+\n+\tauto iter = infoMapHandles_.find(infoMap);\n+\treturn iter != infoMapHandles_.end();\n+}\n+\n } /* namespace libcamera */\n",
    "prefixes": [
        "libcamera-devel",
        "v6",
        "1/9"
    ]
}