{"id":25639,"url":"https://patchwork.libcamera.org/api/patches/25639/?format=json","web_url":"https://patchwork.libcamera.org/patch/25639/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260106165754.1759831-10-barnabas.pocze@ideasonboard.com>","date":"2026-01-06T16:57:41","name":"[v4,09/22] libcamera: ipa_data_serializer: Support `MetadataListPlan`","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"ae84891f5f61ebdafd1ef7650525a02ca9d08c86","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/25639/mbox/","series":[{"id":5688,"url":"https://patchwork.libcamera.org/api/series/5688/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5688","date":"2026-01-06T16:57:32","name":"libcamera: Add `MetadataList`","version":4,"mbox":"https://patchwork.libcamera.org/series/5688/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/25639/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/25639/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 8654DC3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Jan 2026 16:58:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A1DE261FD9;\n\tTue,  6 Jan 2026 17:58:08 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6BC6E61FCF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Jan 2026 17:58:00 +0100 (CET)","from pb-laptop.local (185.221.143.114.nat.pool.zt.hu\n\t[185.221.143.114])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 53BFC177D;\n\tTue,  6 Jan 2026 17:57:39 +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=\"rvw5OK71\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1767718659;\n\tbh=Z+Ag+mW3dBpEbw4rKOV9YdD8pbs3p1Fe6+MbJX0XVGQ=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=rvw5OK71I7zvqHBHau4KM6wN0ye3o2SXZm+3MeOp6BXpYtWS3Ah4eUe5gRiZb7DSK\n\t+82vKFVNVwXltF5zRaUf8OYDgKHDz+mVPWw0wxa46HRS6j5YLha5K0EzbwiR/cx3o+\n\tYyayIVDcHnp7MNij24JibgCmTeY9qabh7qKUHvFo=","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":"[PATCH v4 09/22] libcamera: ipa_data_serializer: Support\n\t`MetadataListPlan`","Date":"Tue,  6 Jan 2026 17:57:41 +0100","Message-ID":"<20260106165754.1759831-10-barnabas.pocze@ideasonboard.com>","X-Mailer":"git-send-email 2.52.0","In-Reply-To":"<20260106165754.1759831-1-barnabas.pocze@ideasonboard.com>","References":"<20260106165754.1759831-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 bce797245..754e4065c 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 0537f785b..5de99b58f 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 93f988cd9..d4468e176 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":["v4","09/22"]}