From patchwork Fri May 3 02:52:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 19992 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 AFF9CC328F for ; Fri, 3 May 2024 02:52:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4F00F6340B; Fri, 3 May 2024 04:52:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="KVUra0bQ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 33C626341A for ; Fri, 3 May 2024 04:52:14 +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 D079E3A3 for ; Fri, 3 May 2024 04:51:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1714704676; bh=I0jKV3ql9fIdXigKZR1o5tB91xRbqDt7ytaH9cYvNj8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KVUra0bQPLXI4lNYs9JP57WUVMR8DBX8j/IAOol9TzTErh28jsZcy1K/OlMNCGoyo b+XjqjwnTJEh+XZyH3hCQ4/2psUbMjjdrN3N4vRc9mPTzaNoWIPLKdFakzugSz4op8 NOcQavl/gVo84Svj4XlQgch0LP524X0OpB5cL338= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 1/4] libcamera: utils: Avoid infinite recursion with strtod() Date: Fri, 3 May 2024 05:52:02 +0300 Message-ID: <20240503025205.2814-2-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240503025205.2814-1-laurent.pinchart@ideasonboard.com> References: <20240503025205.2814-1-laurent.pinchart@ideasonboard.com> 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" When the C library doesn't provide local object support, the utils::strtod() function simply calls strtod() from the C library. The current implementation does so incorrectly, and calls utils::strtod() instead, resulting in infinite recursion. Fix it with a proper namespace qualifier. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Stefan Klug --- src/libcamera/base/utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/base/utils.cpp b/src/libcamera/base/utils.cpp index 2f4c3177ac13..96023f992e03 100644 --- a/src/libcamera/base/utils.cpp +++ b/src/libcamera/base/utils.cpp @@ -517,7 +517,7 @@ double strtod(const char *__restrict nptr, char **__restrict endptr) * If the libc implementation doesn't provide locale object support, * assume that strtod() is locale-independent. */ - return strtod(nptr, endptr); + return ::strtod(nptr, endptr); #endif } From patchwork Fri May 3 02:52:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 19993 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 DB4D5C3220 for ; Fri, 3 May 2024 02:52:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7173F6341C; Fri, 3 May 2024 04:52:17 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="H5807v0A"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B1796340B for ; Fri, 3 May 2024 04:52:15 +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 3D57D3A3 for ; Fri, 3 May 2024 04:51:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1714704677; bh=xfifvORN7LQ04rfpaGWFaVpc6JGUaYkYuRtvNU/+Vp8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=H5807v0AFHLN2JYifCwvXCaPymIYYQljQs1FsvjuHWyyOG40iKd7Wa0yGQBY+HMwT moP/No6+LR98qfjfL8flNFkrTcUzS38qKAmJZIdY1VhPhGyvkaiblmMQeaWFBfDRwn EHbnfSSKriaOyFKD+60A+PO+tC0j0Nz+TuE/arEk= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 2/4] libcamera: shared_mem_object: Fix compilation with uClibc Date: Fri, 3 May 2024 05:52:03 +0300 Message-ID: <20240503025205.2814-3-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240503025205.2814-1-laurent.pinchart@ideasonboard.com> References: <20240503025205.2814-1-laurent.pinchart@ideasonboard.com> 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" uClibc doesn't provide a memfd_create() implementation. Fix it by using a direct syscall when the function isn't available. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Stefan Klug --- meson.build | 4 ++++ src/libcamera/shared_mem_object.cpp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/meson.build b/meson.build index 740ead1be85f..39e4947f8c97 100644 --- a/meson.build +++ b/meson.build @@ -82,6 +82,10 @@ if cc.has_header_symbol('locale.h', 'locale_t', prefix : '#define _GNU_SOURCE') config_h.set('HAVE_LOCALE_T', 1) endif +if cc.has_header_symbol('sys/mman.h', 'memfd_create', prefix : '#define _GNU_SOURCE') + config_h.set('HAVE_MEMFD_CREATE', 1) +endif + if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix : '#define _GNU_SOURCE') config_h.set('HAVE_SECURE_GETENV', 1) endif diff --git a/src/libcamera/shared_mem_object.cpp b/src/libcamera/shared_mem_object.cpp index b018fb3bc0a5..e8cb59f7a90f 100644 --- a/src/libcamera/shared_mem_object.cpp +++ b/src/libcamera/shared_mem_object.cpp @@ -12,6 +12,8 @@ #include #include +#include +#include #include #include @@ -56,7 +58,11 @@ SharedMem::SharedMem() = default; */ SharedMem::SharedMem(const std::string &name, std::size_t size) { +#if HAVE_MEMFD_CREATE int fd = memfd_create(name.c_str(), MFD_CLOEXEC); +#else + int fd = syscall(SYS_memfd_create, name.c_str(), MFD_CLOEXEC); +#endif if (fd < 0) return; From patchwork Fri May 3 02:52:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 19994 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 05F9BC328F for ; Fri, 3 May 2024 02:52:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 96B6A63416; Fri, 3 May 2024 04:52:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AY1mib/W"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1F02863416 for ; Fri, 3 May 2024 04:52:17 +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 97B333A3 for ; Fri, 3 May 2024 04:51:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1714704678; bh=yG/mpPBalZzvYCR8lb7+bQDMtyzLwEyxZOHAJx4tggs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AY1mib/WeY7mKGMAe8xScEb7LCiscxAWayHii1u3GpsjqLo40GOQ+tweMNogtnSN3 BytIGJl8UI1sHXxBUsaxKsTS3VCVnwa8zy9zQ8zUIivb33LMRM5TMYC/+c8bqSS7ba ty/7nU8Pg778Z/v5K+aJ3SShM6Qg6hOq/OJjgoR4= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 3/4] apps: qcam: Use standard key sequence for quit action Date: Fri, 3 May 2024 05:52:04 +0300 Message-ID: <20240503025205.2814-4-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240503025205.2814-1-laurent.pinchart@ideasonboard.com> References: <20240503025205.2814-1-laurent.pinchart@ideasonboard.com> 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" Replace the manual CTRL+Q key sequence with QKeySequence::Quit. This automatically maps to the native shortcut for the quit action, regardless of the platform. Even though we don't expect qcam to run on non-Linux platform, using a QKeySequence is still a good practice when one exists. This doesn't change qcam's behaviour, as the native quit key sequence is CTRL+Q on Linux systems. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Stefan Klug --- src/apps/qcam/main_window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/qcam/main_window.cpp b/src/apps/qcam/main_window.cpp index 0f16c038d516..361d582532d5 100644 --- a/src/apps/qcam/main_window.cpp +++ b/src/apps/qcam/main_window.cpp @@ -190,7 +190,7 @@ int MainWindow::createToolbars() action = toolbar_->addAction(QIcon::fromTheme("application-exit", QIcon(":x-circle.svg")), "Quit"); - action->setShortcut(Qt::CTRL | Qt::Key_Q); + action->setShortcut(QKeySequence::Quit); connect(action, &QAction::triggered, this, &MainWindow::quit); /* Camera selector. */ From patchwork Fri May 3 02:52:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 19995 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 C7A03C3220 for ; Fri, 3 May 2024 02:52:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3B84A6341F; Fri, 3 May 2024 04:52:23 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Icy2OHTi"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 15C726341B for ; Fri, 3 May 2024 04:52:18 +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 07EC1675 for ; Fri, 3 May 2024 04:51:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1714704680; bh=zR3Qe61inIbjdZrwugcRVD2FeALZgtjBGiF+qCJ2eA8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Icy2OHTilWwfDIhyljVVLRSeC6J6qYZHZyxZpP69di9lY5AT0XoDSpF8o5SKU27cW vz5ENc/DjWoPymob7i07xuyV2FadZq9p+ej+ud2Gb4iV1jZ/o0wdqGtiCxniq/Vnxu Cw3aLwE+37nz/+s1nNNYH8AObiKh5nC3A9mmo5BY= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Subject: [PATCH 4/4] meson: Deprecate bitwise operations between different enumeration type Date: Fri, 3 May 2024 05:52:05 +0300 Message-ID: <20240503025205.2814-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240503025205.2814-1-laurent.pinchart@ideasonboard.com> References: <20240503025205.2814-1-laurent.pinchart@ideasonboard.com> 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" C++20 deprecates bitwise operations between different enumeration types. This is a bad practice even in C++17, so enable the deprecation warning. Doing so ensures no such operations will be added. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Stefan Klug --- meson.build | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/meson.build b/meson.build index 39e4947f8c97..89320adbde1f 100644 --- a/meson.build +++ b/meson.build @@ -178,6 +178,15 @@ if cc.has_argument('-Wno-c99-designator') ] endif +# Enable the C++20 deprecated enum-enum conversion warning if the compiler +# supports it. This helps avoiding C++20 regressions, and should be removed +# when switching to C++20 as the warning will then be enabled by default. +if cxx.has_argument('-Wdeprecated-enum-enum-conversion') + cpp_arguments += [ + '-Wdeprecated-enum-enum-conversion', + ] +endif + c_arguments += common_arguments cpp_arguments += common_arguments