Patch Detail
Show a patch.
GET /api/patches/25735/?format=api
{ "id": 25735, "url": "https://patchwork.libcamera.org/api/patches/25735/?format=api", "web_url": "https://patchwork.libcamera.org/patch/25735/", "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": "<20260113000808.15395-16-laurent.pinchart@ideasonboard.com>", "date": "2026-01-13T00:07:47", "name": "[15/36] libcamera: yaml_parser: Move Size handling to geometry.cpp", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "22d860496b84bd4674308027fd7408314a3275c0", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/25735/mbox/", "series": [ { "id": 5703, "url": "https://patchwork.libcamera.org/api/series/5703/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5703", "date": "2026-01-13T00:07:32", "name": "libcamera: Global configuration file improvements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5703/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/25735/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/25735/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 AA823C323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 13 Jan 2026 00:08:54 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4BC9C61FDC;\n\tTue, 13 Jan 2026 01:08:54 +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 8F8C461FD9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Jan 2026 01:08:52 +0100 (CET)", "from pendragon.ideasonboard.com (81-175-209-152.bb.dnainternet.fi\n\t[81.175.209.152])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id E508E66B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 13 Jan 2026 01:08:26 +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=\"LOt/c8mS\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1768262907;\n\tbh=mIZ+S2Qh0dCnCCxu+ZOVd5YJhWRivKWsAAqIijopOOc=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=LOt/c8mSxVNtCuhoE1UPC8LPqCyfC93umPav2No253n0bsxtL0UJkQD/892h/qA4Z\n\tZMHrJ+3iKV5/TYLgSzRLd6nlHAI6+tJXuMS5TDp3k4pGlw5UKJejdmCtdC4+y/bU4m\n\tXAYb3hj6njPiUP0A6Ep1nj3ETi/zDa0IemF1kz0s=", "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Subject": "[PATCH 15/36] libcamera: yaml_parser: Move Size handling to\n\tgeometry.cpp", "Date": "Tue, 13 Jan 2026 02:07:47 +0200", "Message-ID": "<20260113000808.15395-16-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.51.2", "In-Reply-To": "<20260113000808.15395-1-laurent.pinchart@ideasonboard.com>", "References": "<20260113000808.15395-1-laurent.pinchart@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": "The YamlObject::Accessor structure is designed to extend the YamlObject\nclass with new getter and setter types without modifying\nyaml_parser.cpp. This feature is used for various libcamera classes,\nwhile standard C++ types are handled in yaml_parser.cpp.\n\nThe Size class is an outlier: it is a libcamera class, but is handled in\nyaml_parser.cpp. Move it to geometry.cpp. Drop the std::vector<Size>\nspecialization as it is currently unused.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/yaml_parser.h | 2 --\n src/ipa/libipa/lsc_polynomial.h | 2 ++\n src/libcamera/geometry.cpp | 29 ++++++++++++++++++++++++\n src/libcamera/yaml_parser.cpp | 25 +-------------------\n test/yaml-parser.cpp | 2 ++\n 5 files changed, 34 insertions(+), 26 deletions(-)", "diff": "diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h\nindex 02e39e4cd7a1..7b6d16de1a04 100644\n--- a/include/libcamera/internal/yaml_parser.h\n+++ b/include/libcamera/internal/yaml_parser.h\n@@ -17,8 +17,6 @@\n \n #include <libcamera/base/class.h>\n \n-#include <libcamera/geometry.h>\n-\n namespace libcamera {\n \n class File;\ndiff --git a/src/ipa/libipa/lsc_polynomial.h b/src/ipa/libipa/lsc_polynomial.h\nindex df3a0d4b39c4..c71f215de3fc 100644\n--- a/src/ipa/libipa/lsc_polynomial.h\n+++ b/src/ipa/libipa/lsc_polynomial.h\n@@ -14,6 +14,8 @@\n #include <libcamera/base/log.h>\n #include <libcamera/base/span.h>\n \n+#include <libcamera/geometry.h>\n+\n #include \"libcamera/internal/yaml_parser.h\"\n \n namespace libcamera {\ndiff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\nindex 2763967a6e57..2e8e9e33ea78 100644\n--- a/src/libcamera/geometry.cpp\n+++ b/src/libcamera/geometry.cpp\n@@ -12,6 +12,8 @@\n \n #include <libcamera/base/log.h>\n \n+#include \"libcamera/internal/yaml_parser.h\"\n+\n /**\n * \\file geometry.h\n * \\brief Data structures related to geometric objects\n@@ -924,4 +926,31 @@ std::ostream &operator<<(std::ostream &out, const Rectangle &r)\n \treturn out;\n }\n \n+#ifndef __DOXYGEN__\n+/*\n+ * The YAML data shall be a list of two numerical values containing the x and y\n+ * coordinates, in that order.\n+ */\n+template<>\n+std::optional<Size>\n+YamlObject::Accessor<Size>::get(const YamlObject &obj) const\n+{\n+\tif (obj.type_ != Type::List)\n+\t\treturn std::nullopt;\n+\n+\tif (obj.list_.size() != 2)\n+\t\treturn std::nullopt;\n+\n+\tauto width = obj.list_[0].value->get<uint32_t>();\n+\tif (!width)\n+\t\treturn std::nullopt;\n+\n+\tauto height = obj.list_[1].value->get<uint32_t>();\n+\tif (!height)\n+\t\treturn std::nullopt;\n+\n+\treturn Size(*width, *height);\n+}\n+#endif /* __DOXYGEN__ */\n+\n } /* namespace libcamera */\ndiff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp\nindex fa1a487a13dc..46c1fb9bce7e 100644\n--- a/src/libcamera/yaml_parser.cpp\n+++ b/src/libcamera/yaml_parser.cpp\n@@ -284,27 +284,6 @@ void YamlObject::Accessor<std::string>::set(YamlObject &obj, std::string value)\n \tobj.value_ = std::move(value);\n }\n \n-template<>\n-std::optional<Size>\n-YamlObject::Accessor<Size>::get(const YamlObject &obj) const\n-{\n-\tif (obj.type_ != Type::List)\n-\t\treturn std::nullopt;\n-\n-\tif (obj.list_.size() != 2)\n-\t\treturn std::nullopt;\n-\n-\tauto width = obj.list_[0].value->get<uint32_t>();\n-\tif (!width)\n-\t\treturn std::nullopt;\n-\n-\tauto height = obj.list_[1].value->get<uint32_t>();\n-\tif (!height)\n-\t\treturn std::nullopt;\n-\n-\treturn Size(*width, *height);\n-}\n-\n template<typename T>\n struct YamlObject::Accessor<std::vector<T>, std::enable_if_t<\n \tstd::is_same_v<bool, T> ||\n@@ -316,8 +295,7 @@ struct YamlObject::Accessor<std::vector<T>, std::enable_if_t<\n \tstd::is_same_v<uint16_t, T> ||\n \tstd::is_same_v<int32_t, T> ||\n \tstd::is_same_v<uint32_t, T> ||\n-\tstd::is_same_v<std::string, T> ||\n-\tstd::is_same_v<Size, T>>>\n+\tstd::is_same_v<std::string, T>>>\n {\n \tstd::optional<std::vector<T>> get(const YamlObject &obj) const\n \t{\n@@ -348,7 +326,6 @@ template struct YamlObject::Accessor<std::vector<uint16_t>>;\n template struct YamlObject::Accessor<std::vector<int32_t>>;\n template struct YamlObject::Accessor<std::vector<uint32_t>>;\n template struct YamlObject::Accessor<std::vector<std::string>>;\n-template struct YamlObject::Accessor<std::vector<Size>>;\n #endif /* __DOXYGEN__ */\n \n /**\ndiff --git a/test/yaml-parser.cpp b/test/yaml-parser.cpp\nindex 566401afcab6..01e734d23059 100644\n--- a/test/yaml-parser.cpp\n+++ b/test/yaml-parser.cpp\n@@ -14,6 +14,8 @@\n #include <libcamera/base/file.h>\n #include <libcamera/base/utils.h>\n \n+#include <libcamera/geometry.h>\n+\n #include \"libcamera/internal/yaml_parser.h\"\n \n #include \"test.h\"\n", "prefixes": [ "15/36" ] }