Patch Detail
Show a patch.
GET /api/patches/25649/?format=api
{ "id": 25649, "url": "https://patchwork.libcamera.org/api/patches/25649/?format=api", "web_url": "https://patchwork.libcamera.org/patch/25649/", "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": "<20260106165754.1759831-20-barnabas.pocze@ideasonboard.com>", "date": "2026-01-06T16:57:51", "name": "[v4,19/22] libcamera: pipeline_handler: Inject \"debug\" metadata", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "ea58f5101c3df5ce71aa43e5f29a56d079df4fe7", "submitter": { "id": 216, "url": "https://patchwork.libcamera.org/api/people/216/?format=api", "name": "Barnabás Pőcze", "email": "barnabas.pocze@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/25649/mbox/", "series": [ { "id": 5688, "url": "https://patchwork.libcamera.org/api/series/5688/?format=api", "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/25649/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/25649/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 AD89BC32E0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 6 Jan 2026 16:58:20 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 394B961FFC;\n\tTue, 6 Jan 2026 17:58:18 +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 AD02161FC5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 6 Jan 2026 17:58:02 +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 A55B227FD;\n\tTue, 6 Jan 2026 17:57:41 +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=\"SgWEPOB2\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1767718661;\n\tbh=vTqSKINkUPKA8GSZpLwj8tMURCG6R4QGjmovCN8mIEU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=SgWEPOB2mMmqpCVhUF2kfcDDp6+aWS0cdbF3e1EHp5iHa8xrLhLKAdQLVHr4bRd4P\n\tYwSgorKbAcLOBF8ULsmSNT+ITHf8wFFf39TzHHAsS9KEDktbqQc06AjLN8focgEsL4\n\tznM57IU97PHyhGOml6WSzRuUtSqw9ETAvvEl1q2I=", "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 19/22] libcamera: pipeline_handler: Inject \"debug\"\n\tmetadata", "Date": "Tue, 6 Jan 2026 17:57:51 +0100", "Message-ID": "<20260106165754.1759831-20-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": "Inject all metadata controls in the \"debug\" namespace into\nthe metadata plan of each camera so that they can be used\nseamlessly. Dynamically sized array-like controls have a\nhard-coded size of 32 elements.\n\nAdditionally, a new type is added for inspecting properties of\na control type at runtime since that was not available previously.\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---\n include/libcamera/internal/controls.h | 39 +++++++++++++++++++++++\n src/libcamera/controls.cpp | 2 +-\n src/libcamera/pipeline_handler.cpp | 45 +++++++++++++++++++++++++++\n 3 files changed, 85 insertions(+), 1 deletion(-)\n create mode 100644 include/libcamera/internal/controls.h", "diff": "diff --git a/include/libcamera/internal/controls.h b/include/libcamera/internal/controls.h\nnew file mode 100644\nindex 000000000..be3f93e43\n--- /dev/null\n+++ b/include/libcamera/internal/controls.h\n@@ -0,0 +1,39 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2025, Ideas on Board Oy\n+ */\n+\n+#pragma once\n+\n+#include <libcamera/controls.h>\n+\n+namespace libcamera::controls::details {\n+\n+struct TypeInfo {\n+\tstd::size_t size = 0;\n+\tstd::size_t alignment = 0;\n+\n+\texplicit operator bool() const { return alignment != 0; }\n+\n+\tstatic constexpr TypeInfo get(ControlType t)\n+\t{\n+\t\tswitch (t) {\n+\t\tcase ControlTypeNone: return {};\n+\t\tcase ControlTypeBool: return { sizeof(bool), alignof(bool) };\n+\t\tcase ControlTypeByte: return { sizeof(uint8_t), alignof(uint8_t) };\n+\t\tcase ControlTypeUnsigned16: return { sizeof(uint16_t), alignof(uint16_t) };\n+\t\tcase ControlTypeUnsigned32: return { sizeof(uint32_t), alignof(uint32_t) };\n+\t\tcase ControlTypeInteger32: return { sizeof(int32_t), alignof(int32_t) };\n+\t\tcase ControlTypeInteger64: return { sizeof(int64_t), alignof(int64_t) };\n+\t\tcase ControlTypeFloat: return { sizeof(float), alignof(float) };\n+\t\tcase ControlTypeString: return { sizeof(char), alignof(char) };\n+\t\tcase ControlTypeRectangle: return { sizeof(Rectangle), alignof(Rectangle) };\n+\t\tcase ControlTypeSize: return { sizeof(Size), alignof(Size) };\n+\t\tcase ControlTypePoint: return { sizeof(Point), alignof(Point) };\n+\t\t}\n+\n+\t\treturn {};\n+\t}\n+};\n+\n+} /* libcamera::controls::details */\ndiff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp\nindex bddbac10c..72331ddb5 100644\n--- a/src/libcamera/controls.cpp\n+++ b/src/libcamera/controls.cpp\n@@ -17,7 +17,7 @@\n #include \"libcamera/internal/control_validator.h\"\n \n /**\n- * \\file controls.h\n+ * \\file libcamera/controls.h\n * \\brief Framework to manage controls related to an object\n *\n * A control is a mean to govern or influence the operation of an object, and in\ndiff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp\nindex 26675104b..1b9e18a04 100644\n--- a/src/libcamera/pipeline_handler.cpp\n+++ b/src/libcamera/pipeline_handler.cpp\n@@ -16,11 +16,13 @@\n #include <libcamera/base/utils.h>\n \n #include <libcamera/camera.h>\n+#include <libcamera/control_ids.h>\n #include <libcamera/framebuffer.h>\n #include <libcamera/property_ids.h>\n \n #include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/camera_manager.h\"\n+#include \"libcamera/internal/controls.h\"\n #include \"libcamera/internal/device_enumerator.h\"\n #include \"libcamera/internal/media_device.h\"\n #include \"libcamera/internal/request.h\"\n@@ -768,6 +770,47 @@ std::string PipelineHandler::configurationFile(const std::string &subdir,\n \treturn std::string();\n }\n \n+namespace {\n+\n+/*\n+ * This is kind of hack. The metadata controls in the \"debug\" namespace\n+ * are forcefully injected into each Camera's MetadataListPlan so that\n+ * they work seamlessly without any additional setup.\n+ *\n+ * The dynamically-sized array-like controls have a maximum capacity\n+ * determined by the magic number below.\n+ */\n+void extendMetadataPlanWithDebugMetadata(MetadataListPlan& mlp)\n+{\n+\tconstexpr std::size_t kDynamicArrayCapacity = 32;\n+\n+\tfor (const auto &[id, ctrl] : controls::controls) {\n+\t\tif (!ctrl->isOutput())\n+\t\t\tcontinue;\n+\t\tif (ctrl->vendor() != \"debug\")\n+\t\t\tcontinue;\n+\t\tif (mlp.get(id))\n+\t\t\tcontinue;\n+\n+\t\tstd::size_t count = ctrl->size();\n+\t\tif (count == 0) /* Non-array controls have a static size of 0. */\n+\t\t\tcount = 1;\n+\t\telse if (ctrl->size() == libcamera::dynamic_extent)\n+\t\t\tcount = kDynamicArrayCapacity;\n+\n+\t\tconst auto info = controls::details::TypeInfo::get(ctrl->type());\n+\t\tif (!info)\n+\t\t\tcontinue;\n+\n+\t\t[[maybe_unused]] bool ok = mlp.set(id,\n+\t\t\t\t\t\t info.size, info.alignment,\n+\t\t\t\t\t\t count, ctrl->type(), ctrl->isArray());\n+\t\tASSERT(ok);\n+\t}\n+}\n+\n+} /* namespace */\n+\n /**\n * \\brief Register a camera to the camera manager and pipeline handler\n * \\param[in] camera The camera to be added\n@@ -813,6 +856,8 @@ void PipelineHandler::registerCamera(std::shared_ptr<Camera> camera)\n \tCamera::Private *data = camera->_d();\n \tdata->properties_.set(properties::SystemDevices, devnums);\n \n+\textendMetadataPlanWithDebugMetadata(data->metadataPlan_);\n+\n \tmanager_->_d()->addCamera(std::move(camera));\n }\n \n", "prefixes": [ "v4", "19/22" ] }