Patch Detail
Show a patch.
GET /api/patches/24977/?format=api
{ "id": 24977, "url": "https://patchwork.libcamera.org/api/patches/24977/?format=api", "web_url": "https://patchwork.libcamera.org/patch/24977/", "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": "<20251104185002.2337556-1-kieran.bingham@ideasonboard.com>", "date": "2025-11-04T18:50:02", "name": "[v2] Thread: Add name parameter", "commit_ref": "559128b1f1b3cfd82f46b8a1248cbb4de0463db1", "pull_url": null, "state": "accepted", "archived": false, "hash": "bd29fe0ff43378f7fd3d9aab540540a2581b8384", "submitter": { "id": 4, "url": "https://patchwork.libcamera.org/api/people/4/?format=api", "name": "Kieran Bingham", "email": "kieran.bingham@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/24977/mbox/", "series": [ { "id": 5564, "url": "https://patchwork.libcamera.org/api/series/5564/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5564", "date": "2025-11-04T18:50:02", "name": "[v2] Thread: Add name parameter", "version": 2, "mbox": "https://patchwork.libcamera.org/series/5564/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/24977/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/24977/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 32F1DC3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 4 Nov 2025 18:50:11 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 65A7F60A80;\n\tTue, 4 Nov 2025 19:50:10 +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 21A4E6069A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 4 Nov 2025 19:50:09 +0100 (CET)", "from Monstersaurus.hippo-penny.ts.net\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id DF4839FC;\n\tTue, 4 Nov 2025 19:48:14 +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=\"HzkybGYg\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762282095;\n\tbh=/BmuBCsgZEBMBKWC0hFLy/04zKQKgjfXkWN3pFbWRm0=;\n\th=From:To:Cc:Subject:Date:From;\n\tb=HzkybGYg5VgLO3OYyWgbHTEflfI+CcTUAe5Bn1Qs7//vsMI7JQIiR2c16l3wYceeI\n\tWwCGfTUnSjCv+1G6ROWxEQJw1Ntqy8qB/6RShOarB9Zc9Sy4X7CgoHRERTB1f5Prq/\n\tlqoKHzY/9tNMumoP84Erqh/CrKY9CASY+hApK9GU=", "From": "Kieran Bingham <kieran.bingham@ideasonboard.com>", "To": "libcamera devel <libcamera-devel@lists.libcamera.org>", "Cc": "\"Schulz, Andreas\" <andreas.schulz2@karlstorz.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>", "Subject": "[PATCH v2] Thread: Add name parameter", "Date": "Tue, 4 Nov 2025 18:50:02 +0000", "Message-ID": "<20251104185002.2337556-1-kieran.bingham@ideasonboard.com>", "X-Mailer": "git-send-email 2.50.1", "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": "From: \"Schulz, Andreas\" <andreas.schulz2@karlstorz.com>\n\nFor debugging purposes, threads can be assigned a name, which eases\ndistinguishing between them in e.g. htop or gdb. This uses a\nLinux-specific API for now which is limited to 15 characters (+ null\nterminator), so truncation is done and names for existing thread\ninstantiations were chosen to be consise.\n\n[Kieran: Apply checkstyle suggestions, rebase on proxy rework]\nSigned-off-by: Schulz, Andreas <andreas.schulz2@karlstorz.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n---\nv2:\n - Simplify default name initialiser\n - Wrap dmaHeap_\n - Add in the VirtualCamera thread\n\nTesting on RKISP1:\n\nroot@debix-som:~# cam -c1 -C^C\n\nroot@debix-som:~# ps -T -p `pidof cam`\n PID SPID TTY TIME CMD\n 332 332 pts/0 00:00:00 cam\n 332 333 pts/0 00:00:00 CameraManager\n 332 334 pts/0 00:00:00 IPAProxyRkISP1\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n include/libcamera/base/thread.h | 4 +++-\n src/libcamera/base/thread.cpp | 11 +++++++++--\n src/libcamera/camera_manager.cpp | 2 +-\n src/libcamera/pipeline/virtual/virtual.cpp | 2 +-\n src/libcamera/software_isp/software_isp.cpp | 3 ++-\n .../libcamera_templates/module_ipa_proxy.cpp.tmpl | 2 +-\n 6 files changed, 17 insertions(+), 7 deletions(-)", "diff": "diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h\nindex dc1aca275e23..6aa36fa1bfb0 100644\n--- a/include/libcamera/base/thread.h\n+++ b/include/libcamera/base/thread.h\n@@ -8,6 +8,7 @@\n #pragma once\n \n #include <memory>\n+#include <string>\n #include <sys/types.h>\n #include <thread>\n \n@@ -30,7 +31,7 @@ class ThreadMain;\n class Thread\n {\n public:\n-\tThread();\n+\tThread(std::string name = {});\n \tvirtual ~Thread();\n \n \tvoid start();\n@@ -74,6 +75,7 @@ private:\n \tvoid moveObject(Object *object, ThreadData *currentData,\n \t\t\tThreadData *targetData);\n \n+\tstd::string name_;\n \tstd::thread thread_;\n \tstd::unique_ptr<ThreadData> data_;\n };\ndiff --git a/src/libcamera/base/thread.cpp b/src/libcamera/base/thread.cpp\nindex 338cbcc260c8..39209ec8ad0d 100644\n--- a/src/libcamera/base/thread.cpp\n+++ b/src/libcamera/base/thread.cpp\n@@ -10,6 +10,7 @@\n #include <atomic>\n #include <list>\n #include <optional>\n+#include <pthread.h>\n #include <sys/syscall.h>\n #include <sys/types.h>\n #include <unistd.h>\n@@ -144,6 +145,7 @@ class ThreadMain : public Thread\n {\n public:\n \tThreadMain()\n+\t\t: Thread(\"libcamera-main\")\n \t{\n \t\tdata_->running_ = true;\n \t}\n@@ -234,8 +236,9 @@ ThreadData *ThreadData::current()\n /**\n * \\brief Create a thread\n */\n-Thread::Thread()\n-\t: data_(std::make_unique<ThreadData>(this))\n+Thread::Thread(std::string name)\n+\t: name_(std::move(name)),\n+\t data_(std::make_unique<ThreadData>(this))\n {\n }\n \n@@ -288,6 +291,10 @@ void Thread::startThread()\n \tdata_->tid_ = syscall(SYS_gettid);\n \tcurrentThreadData = data_.get();\n \n+\tif (!name_.empty())\n+\t\tpthread_setname_np(thread_.native_handle(),\n+\t\t\t\t name_.substr(0, 15).c_str());\n+\n \trun();\n }\n \ndiff --git a/src/libcamera/camera_manager.cpp b/src/libcamera/camera_manager.cpp\nindex c203b08f7de3..83510e062fae 100644\n--- a/src/libcamera/camera_manager.cpp\n+++ b/src/libcamera/camera_manager.cpp\n@@ -39,7 +39,7 @@ LOG_DEFINE_CATEGORY(Camera)\n \n #ifndef __DOXYGEN_PUBLIC__\n CameraManager::Private::Private()\n-\t: initialized_(false)\n+\t: Thread(\"CameraManager\"), initialized_(false)\n {\n \tipaManager_ = std::make_unique<IPAManager>(this->configuration());\n }\ndiff --git a/src/libcamera/pipeline/virtual/virtual.cpp b/src/libcamera/pipeline/virtual/virtual.cpp\nindex 23eae852f79b..09e0afc956fd 100644\n--- a/src/libcamera/pipeline/virtual/virtual.cpp\n+++ b/src/libcamera/pipeline/virtual/virtual.cpp\n@@ -115,7 +115,7 @@ private:\n \n VirtualCameraData::VirtualCameraData(PipelineHandler *pipe,\n \t\t\t\t const std::vector<Resolution> &supportedResolutions)\n-\t: Camera::Private(pipe)\n+\t: Camera::Private(pipe), Thread(\"VirtualCamera\")\n {\n \tconfig_.resolutions = supportedResolutions;\n \tfor (const auto &resolution : config_.resolutions) {\ndiff --git a/src/libcamera/software_isp/software_isp.cpp b/src/libcamera/software_isp/software_isp.cpp\nindex fdadf79e1966..341c0352cf0c 100644\n--- a/src/libcamera/software_isp/software_isp.cpp\n+++ b/src/libcamera/software_isp/software_isp.cpp\n@@ -75,7 +75,8 @@ LOG_DEFINE_CATEGORY(SoftwareIsp)\n */\n SoftwareIsp::SoftwareIsp(PipelineHandler *pipe, const CameraSensor *sensor,\n \t\t\t ControlInfoMap *ipaControls)\n-\t: dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap |\n+\t: ispWorkerThread_(\"SWIspWorker\"),\n+\t dmaHeap_(DmaBufAllocator::DmaBufAllocatorFlag::CmaHeap |\n \t\t DmaBufAllocator::DmaBufAllocatorFlag::SystemHeap |\n \t\t DmaBufAllocator::DmaBufAllocatorFlag::UDmaBuf)\n {\ndiff --git a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl\nindex 0d03c1df0dd9..e6e19b3030b9 100644\n--- a/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl\n+++ b/utils/codegen/ipc/generators/libcamera_templates/module_ipa_proxy.cpp.tmpl\n@@ -46,7 +46,7 @@ namespace {{ns}} {\n {%- endif %}\n \n {{proxy_name}}Threaded::{{proxy_name}}Threaded(IPAModule *ipam, const GlobalConfiguration &configuration)\n-\t: {{proxy_name}}(ipam, configuration)\n+\t: {{proxy_name}}(ipam, configuration), thread_(\"{{proxy_name}}\")\n {\n \tLOG(IPAProxy, Debug)\n \t\t<< \"initializing {{module_name}} proxy in thread: loading IPA from \"\n", "prefixes": [ "v2" ] }