From patchwork Fri Jun 21 12:03:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20360 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 DCFDDBD87C for ; Fri, 21 Jun 2024 12:03:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 94416654A9; Fri, 21 Jun 2024 14:03:42 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="QMr4mjeD"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8715A654A2 for ; Fri, 21 Jun 2024 14:03:41 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7A0016EF; Fri, 21 Jun 2024 14:03:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1718971401; bh=q+0p7EI0BzNNs3iH6Qpv2GPBMgME83hG9PpsWIX9+gs=; h=From:To:Subject:Date:From; b=QMr4mjeDsllZi70WxxMWqFFa9VfySVtGVPyVRWxHc9BXdnwsqpkfI/q6m1IDIGqm8 +vaLbm19+571bkqpWs260dLriv9nJxqdh/ZCRe+lx84es9lAPnk+j9WY05NyDzUC8u axzBpIcSCAJ1OFSzaDmuixMz9j+pIppytU17dwGc= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org, Jacopo Mondi Subject: [PATCH] libcamera: yaml_parser: Add support for float types Date: Fri, 21 Jun 2024 15:03:18 +0300 Message-ID: <20240621120318.25851-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 MIME-Version: 1.0 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" The YamlObject::get() function template has a specialization for double but not for float. When used in an IPA module, the issue is caught at module load time only, when dynamic links are resolved, causing errors such as Failed to open IPA module shared object: /usr/lib/libcamera/ipa_rkisp1.so: undefined symbol: _ZNK9libcamera10YamlObject6GetterIfE3getERK_ Fix it by adding a float specialization. The alternative would be to use double only in IPA modules, but the lack of enforcement at compile time makes this dangerous. Signed-off-by: Laurent Pinchart Tested-by: Jacopo Mondi Reviewed-by: Stefan Klug Reviewed-by: Kieran Bingham --- Jacopo, I think this may fix the issue you've experienced. Could you test the patch ? --- include/libcamera/internal/yaml_parser.h | 1 + src/libcamera/yaml_parser.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h index 06a41146ad01..e38a2df9ae1d 100644 --- a/include/libcamera/internal/yaml_parser.h +++ b/include/libcamera/internal/yaml_parser.h @@ -177,6 +177,7 @@ public: template || + std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp index 56670ba7a584..025006bcdcdd 100644 --- a/src/libcamera/yaml_parser.cpp +++ b/src/libcamera/yaml_parser.cpp @@ -278,6 +278,13 @@ YamlObject::Getter::get(const YamlObject &obj) const return value; } +template<> +std::optional +YamlObject::Getter::get(const YamlObject &obj) const +{ + return obj.get(); +} + template<> std::optional YamlObject::Getter::get(const YamlObject &obj) const @@ -349,6 +356,7 @@ YamlObject::Getter::get(const YamlObject &obj) const template || + std::is_same_v || std::is_same_v || std::is_same_v || std::is_same_v || @@ -377,6 +385,7 @@ std::optional> YamlObject::getList() const } template std::optional> YamlObject::getList() const; +template std::optional> YamlObject::getList() const; template std::optional> YamlObject::getList() const; template std::optional> YamlObject::getList() const; template std::optional> YamlObject::getList() const;