Show a patch.

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

{
    "id": 24912,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/24912/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/24912/",
    "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": "<20251030165816.1095180-10-barnabas.pocze@ideasonboard.com>",
    "date": "2025-10-30T16:58:03",
    "name": "[RFC,v3,09/22] libcamera: ipa_data_serializer: Support `MetadataListPlan`",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "ae84891f5f61ebdafd1ef7650525a02ca9d08c86",
    "submitter": {
        "id": 216,
        "url": "https://patchwork.libcamera.org/api/1.1/people/216/?format=api",
        "name": "Barnabás Pőcze",
        "email": "barnabas.pocze@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/24912/mbox/",
    "series": [
        {
            "id": 5545,
            "url": "https://patchwork.libcamera.org/api/1.1/series/5545/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5545",
            "date": "2025-10-30T16:57:54",
            "name": "libcamera: Add `MetadataList`",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/5545/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/24912/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/24912/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 441ABC3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 30 Oct 2025 16:58:40 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C477D60947;\n\tThu, 30 Oct 2025 17:58:38 +0100 (CET)",
            "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 6F867608F7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 30 Oct 2025 17:58:23 +0100 (CET)",
            "from pb-laptop.local (185.221.140.239.nat.pool.zt.hu\n\t[185.221.140.239])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 453586F3;\n\tThu, 30 Oct 2025 17:56:33 +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=\"TgkOXX2t\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1761843393;\n\tbh=ocNC7npJuj3ARUqDCiwjK0p9zYAy2CtsBWIWpgl9Tds=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=TgkOXX2tMd48lbyI+H4nUvbOYeK7d7gq4YbWNRCBiWAYx5Ovws8brIatxL7OBxQ6o\n\tW1pWLMhFM3QEtp6oep/MjQxXfpZOoEhx8P7E3x7gERTOem/elx3It/fI1I1lXLJBcp\n\tRvTz2MlyjrYjB5AhSyS8HIFSgQURJzX9a2waIfUU=",
        "From": "=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>",
        "Subject": "[RFC PATCH v3 09/22] libcamera: ipa_data_serializer: Support\n\t`MetadataListPlan`",
        "Date": "Thu, 30 Oct 2025 17:58:03 +0100",
        "Message-ID": "<20251030165816.1095180-10-barnabas.pocze@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.51.1",
        "In-Reply-To": "<20251030165816.1095180-1-barnabas.pocze@ideasonboard.com>",
        "References": "<20251030165816.1095180-1-barnabas.pocze@ideasonboard.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "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": "Define the type in `core.mojom` with external (de)serialization, and\nadd the necessary `IPADataSerializer` template specialization.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\nchanges in v3:\n  * return empty and log message in case of error instead of aborting\n---\n include/libcamera/ipa/core.mojom              |  1 +\n src/libcamera/ipa_data_serializer.cpp         | 94 +++++++++++++++++++\n .../core_ipa_interface.h.tmpl                 |  1 +\n 3 files changed, 96 insertions(+)",
    "diff": "diff --git a/include/libcamera/ipa/core.mojom b/include/libcamera/ipa/core.mojom\nindex bce7972458..754e4065cb 100644\n--- a/include/libcamera/ipa/core.mojom\n+++ b/include/libcamera/ipa/core.mojom\n@@ -83,6 +83,7 @@ module libcamera;\n [skipSerdes, skipHeader] struct ControlInfoMap {};\n [skipSerdes, skipHeader] struct ControlList {};\n [skipSerdes, skipHeader] struct SharedFD {};\n+[skipSerdes, skipHeader] struct MetadataListPlan {};\n \n [skipHeader] struct Point {\n \tint32 x;\ndiff --git a/src/libcamera/ipa_data_serializer.cpp b/src/libcamera/ipa_data_serializer.cpp\nindex 0537f785b1..5de99b58f2 100644\n--- a/src/libcamera/ipa_data_serializer.cpp\n+++ b/src/libcamera/ipa_data_serializer.cpp\n@@ -11,6 +11,8 @@\n \n #include <libcamera/base/log.h>\n \n+#include <libcamera/metadata_list_plan.h>\n+\n #include \"libcamera/internal/byte_stream_buffer.h\"\n \n /**\n@@ -620,6 +622,98 @@ IPADataSerializer<FrameBuffer::Plane>::deserialize(const std::vector<uint8_t> &d\n \treturn deserialize(data.cbegin(), data.end(), fds.cbegin(), fds.end(), cs);\n }\n \n+template<>\n+std::tuple<std::vector<uint8_t>, std::vector<SharedFD>>\n+IPADataSerializer<MetadataListPlan>::serialize(const MetadataListPlan &data,\n+\t\t\t\t\t       [[maybe_unused]] ControlSerializer *cs)\n+{\n+\tstd::vector<uint8_t> dataVec;\n+\n+\tappendPOD<uint32_t>(dataVec, data.size());\n+\n+\tfor (const auto &[tag, e] : data) {\n+\t\tappendPOD<uint32_t>(dataVec, tag);\n+\t\tappendPOD<uint32_t>(dataVec, e.size);\n+\t\tappendPOD<uint32_t>(dataVec, e.alignment);\n+\t\tappendPOD<uint32_t>(dataVec, e.numElements);\n+\t\tappendPOD<uint32_t>(dataVec, e.type);\n+\t\tappendPOD<uint8_t>(dataVec, e.isArray);\n+\t}\n+\n+\treturn { dataVec, {} };\n+}\n+\n+template<>\n+MetadataListPlan\n+IPADataSerializer<MetadataListPlan>::deserialize(std::vector<uint8_t>::const_iterator dataBegin,\n+\t\t\t\t\t\t std::vector<uint8_t>::const_iterator dataEnd,\n+\t\t\t\t\t\t [[maybe_unused]] std::vector<SharedFD>::const_iterator fdsBegin,\n+\t\t\t\t\t\t [[maybe_unused]] std::vector<SharedFD>::const_iterator fdsEnd,\n+\t\t\t\t\t\t [[maybe_unused]] ControlSerializer *cs)\n+{\n+\tMetadataListPlan ret;\n+\tstd::size_t offset = 0;\n+\n+\tauto n = readPOD<uint32_t>(dataBegin, 0, dataEnd);\n+\toffset += sizeof(n);\n+\n+\twhile (n--) {\n+\t\tauto tag = readPOD<uint32_t>(dataBegin, offset, dataEnd);\n+\t\toffset += sizeof(tag);\n+\n+\t\tauto size = readPOD<uint32_t>(dataBegin, offset, dataEnd);\n+\t\toffset += sizeof(size);\n+\n+\t\tauto alignment = readPOD<uint32_t>(dataBegin, offset, dataEnd);\n+\t\toffset += sizeof(alignment);\n+\n+\t\tauto numElements = readPOD<uint32_t>(dataBegin, offset, dataEnd);\n+\t\toffset += sizeof(numElements);\n+\n+\t\tauto type = readPOD<uint32_t>(dataBegin, offset, dataEnd);\n+\t\toffset += sizeof(type);\n+\n+\t\tauto isArray = readPOD<uint8_t>(dataBegin, offset, dataEnd);\n+\t\toffset += sizeof(isArray);\n+\n+\t\t[[maybe_unused]] bool ok = ret.set(tag,\n+\t\t\t\t\t\t   size, alignment,\n+\t\t\t\t\t\t   numElements, static_cast<ControlType>(type), isArray);\n+\t\tif (!ok) {\n+\t\t\tLOG(IPADataSerializer, Error) << \"Failed to deserialize MetadataListPlan\";\n+\t\t\treturn {};\n+\t\t}\n+\t}\n+\n+\treturn ret;\n+}\n+\n+template<>\n+MetadataListPlan\n+IPADataSerializer<MetadataListPlan>::deserialize(std::vector<uint8_t>::const_iterator dataBegin,\n+\t\t\t\t\t\t std::vector<uint8_t>::const_iterator dataEnd,\n+\t\t\t\t\t\t ControlSerializer *cs)\n+{\n+\treturn deserialize(dataBegin, dataEnd, {}, {}, cs);\n+}\n+\n+template<>\n+MetadataListPlan\n+IPADataSerializer<MetadataListPlan>::deserialize(const std::vector<uint8_t> &data,\n+\t\t\t\t\t\t ControlSerializer *cs)\n+{\n+\treturn deserialize(data.cbegin(), data.end(), cs);\n+}\n+\n+template<>\n+MetadataListPlan\n+IPADataSerializer<MetadataListPlan>::deserialize(const std::vector<uint8_t> &data,\n+\t\t\t\t\t\t const std::vector<SharedFD> &fds,\n+\t\t\t\t\t\t ControlSerializer *cs)\n+{\n+\treturn deserialize(data.cbegin(), data.end(), fds.cbegin(), fds.end(), cs);\n+}\n+\n #endif /* __DOXYGEN__ */\n \n } /* namespace libcamera */\ndiff --git a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl\nindex 93f988cd9f..d4468e1762 100644\n--- a/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl\n+++ b/utils/codegen/ipc/generators/libcamera_templates/core_ipa_interface.h.tmpl\n@@ -23,6 +23,7 @@\n #include <libcamera/controls.h>\n #include <libcamera/framebuffer.h>\n #include <libcamera/geometry.h>\n+#include <libcamera/metadata_list_plan.h>\n \n #include <libcamera/ipa/ipa_interface.h>\n \n",
    "prefixes": [
        "RFC",
        "v3",
        "09/22"
    ]
}