From patchwork Tue Nov 17 08:47:18 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 28945 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 70EBEBDE17 for ; Tue, 17 Nov 2026 08:47:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 133FB6A883; Tue, 17 Nov 2026 09:47:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hQQhaTDj"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 449CC6A883 for ; Tue, 17 Nov 2026 09:47:36 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:27fa:cb4b:1d83:9b64]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C45E71CF6; Tue, 17 Nov 2026 09:45:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1794905108; bh=9S9h/8RtGiYrAI6teD4ctFpnxK1rhuoL/SbsomYm9zM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hQQhaTDj6Z8BmLVJ2GKV130JUKzlp5D9OOhHgeTzR+wx5qd3uBZdkwSsRjX6XWvz9 hU2mYu//RuXNY7y3zBmspjGIwiLn+Fs8ajUh+Ps5VoBgcGKQgoW2NZT4QEqIhs1NOf 8z6XrsXbDQIKhQPd4WuH187oT/+d0sXUAOBGsngQ= From: Stefan Klug Date: Tue, 17 Nov 2026 09:47:18 +0100 Subject: [PATCH 08/10] RFC ipa: libipa: Inject the registered name into an algorithm MIME-Version: 1.0 Message-Id: <20261117-sklug-digital-gain-support-v1-v1-8-f0aa342ca877@ideasonboard.com> References: <20261117-sklug-digital-gain-support-v1-v1-0-f0aa342ca877@ideasonboard.com> In-Reply-To: <20261117-sklug-digital-gain-support-v1-v1-0-f0aa342ca877@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug X-Mailer: b4 0.14.3 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" When algorithms are handled it is helpful to be able to deduce the name an algorithm was registered with from the algorithm instance. Allow that by injecting the name into the instance after construction. ToDo: - We could as well force every algorithm to implement name() and could then drop this clunky logic. But maybe there are other reasons for this kind of registry. Signed-off-by: Stefan Klug --- src/ipa/libipa/algorithm.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/ipa/libipa/algorithm.h b/src/ipa/libipa/algorithm.h index 4ddb16ef3920..b47765700317 100644 --- a/src/ipa/libipa/algorithm.h +++ b/src/ipa/libipa/algorithm.h @@ -18,6 +18,9 @@ class ValueNode; namespace ipa { +template +class AlgorithmFactoryBase; + template class Algorithm { @@ -59,6 +62,15 @@ public: [[maybe_unused]] ControlList &metadata) { } + + const std::string &name() const + { + return name_; + } + +private: + std::string name_; + friend class AlgorithmFactoryBase<_Module>; }; template @@ -77,6 +89,11 @@ public: virtual std::unique_ptr> create() const = 0; + void injectName(Algorithm<_Module> *instance) const + { + instance->name_ = name(); + } + private: std::string name_; }; @@ -94,7 +111,9 @@ public: std::unique_ptr> create() const override { - return std::make_unique<_Algorithm>(); + auto instance = std::make_unique<_Algorithm>(); + AlgorithmFactoryBase::injectName(instance.get()); + return instance; } };