summaryrefslogtreecommitdiffstats
path: root/meta-multimedia
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2021-03-28 12:48:42 -0700
committerKhem Raj <raj.khem@gmail.com>2021-03-28 22:23:40 -0700
commitb2bd9cce16e1ed3e5e429b2042c46934d9691b43 (patch)
tree34144b3d2ce8a6a8f7a909c702120ba69b2974d4 /meta-multimedia
parent409a6dc00fdbdc945e213afc65b4aad51d1f63a1 (diff)
downloadmeta-openembedded-b2bd9cce16e1ed3e5e429b2042c46934d9691b43.tar.gz
libcamera: Update the patch to upstreamed one
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-multimedia')
-rw-r--r--meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-uvcvideo-Use-auto-variable-to-avoid-range-loop-warni.patch101
1 files changed, 90 insertions, 11 deletions
diff --git a/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-uvcvideo-Use-auto-variable-to-avoid-range-loop-warni.patch b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-uvcvideo-Use-auto-variable-to-avoid-range-loop-warni.patch
index 4ca412c69..cec5fc287 100644
--- a/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-uvcvideo-Use-auto-variable-to-avoid-range-loop-warni.patch
+++ b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-uvcvideo-Use-auto-variable-to-avoid-range-loop-warni.patch
@@ -1,27 +1,104 @@
1From 767267ef69c001870d41caf9c60dd7fec89b0a13 Mon Sep 17 00:00:00 2001 1Delivered-To: raj.khem@gmail.com
2Received: by 2002:a05:620a:20d3:0:0:0:0 with SMTP id f19csp2716715qka;
3 Sat, 27 Mar 2021 19:58:30 -0700 (PDT)
4X-Google-Smtp-Source: ABdhPJwyDnjZqZmFqHVShb/5/RoVkJ4Avv5bcnyuo85vIRR2vJDQF+QBZpQpEWHgx5GuEuwLVSC+
5X-Received: by 2002:a05:6512:22d0:: with SMTP id g16mr12125441lfu.650.1616900310724;
6 Sat, 27 Mar 2021 19:58:30 -0700 (PDT)
7ARC-Seal: i=1; a=rsa-sha256; t=1616900310; cv=none;
8 d=google.com; s=arc-20160816;
9 b=bZlu68tossyE2YcGkt0HzIhqTUroWDT/EgJvAiQBgZ6bPzMJ+wjwWp3LzViqOxiRPQ
10 r0cFyme7CJ9YRf2TLmpjGuv2RPQ+EkrtFdlB7i65nhDrwvBoxt78vF2tUoDgVLL1YrU9
11 wKgHPtBjtDcDveOXKQJH2j5HRwiBjCXlPRBhlSxV8kJPBj//dRaKm0MsxfiW/IgyN1tZ
12 FFxfe4Lk1Awm8ZKAklhdKMly3MFA6IbnjwNcN/84a0R/0+PLu9X8XIR6+CnrfqSgWOBx
13 zsV8p3HuVQTpX7Hhnkiz7PYudHsJJ/7KXeXTP6s9NNnZGu9A6U/E6VOob5BSm9DDIA5z
14 4AnA==
15ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
16 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
17 :to:from:dkim-signature;
18 bh=fbAn+wsNks5BGTY34H4T90NDFJaNV4nnt9vc9DBFaWQ=;
19 b=mLZNiQR/CdgcVTAc7OQmK0ZYTVpofG/EOqTIi2NYIYFhanWhatYY9Hx2xwxIp6kQ5R
20 n0uXh5tLth6aPYD09z3YcXYasEIszBKwoNUFjRA85lFm3d5/J2S1wC5rBy25QeCDOg57
21 QdzYrTBX2QGRHGQKauEnX5FLDTT+I53sPa87TyvxUKBS+lTAbJig70KfmL7FJIEWT1ZI
22 CZKCErYFlQTGNnwM0CYVXyHv54D2tA25veHQIJN8KK+XObNWuAY3rYpqKoUpOP4vpSPi
23 MXJWAV4L6NZEShWvwJiC4Zdy2xFzXASX27CAKIsX6T5Rub03grVTg6WVt9bChK1x5jeg
24 A2Yw==
25ARC-Authentication-Results: i=1; mx.google.com;
26 dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=MniKswyT;
27 spf=pass (google.com: domain of laurent.pinchart@ideasonboard.com designates 213.167.242.64 as permitted sender) smtp.mailfrom=laurent.pinchart@ideasonboard.com
28Return-Path: <laurent.pinchart@ideasonboard.com>
29Received: from perceval.ideasonboard.com (perceval.ideasonboard.com. [213.167.242.64])
30 by mx.google.com with ESMTPS id v18si12339470ljj.208.2021.03.27.19.58.30
31 for <raj.khem@gmail.com>
32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
33 Sat, 27 Mar 2021 19:58:30 -0700 (PDT)
34Received-SPF: pass (google.com: domain of laurent.pinchart@ideasonboard.com designates 213.167.242.64 as permitted sender) client-ip=213.167.242.64;
35Authentication-Results: mx.google.com;
36 dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=MniKswyT;
37 spf=pass (google.com: domain of laurent.pinchart@ideasonboard.com designates 213.167.242.64 as permitted sender) smtp.mailfrom=laurent.pinchart@ideasonboard.com
38Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])
39 by perceval.ideasonboard.com (Postfix) with ESMTPSA id 11F12332;
40 Sun, 28 Mar 2021 04:58:28 +0200 (CEST)
41DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;
42 s=mail; t=1616900309;
43 bh=BwCg4h9N9fJysbMT1Yjbazbp7zTImD9mkWJSjCKzCmg=;
44 h=From:To:Cc:Subject:Date:From;
45 b=MniKswyT+aUtPgeMFeLqW6cRMFsPRN4W1XtVDA6pqI0QTSSx5koEuzSfEybjs6Qbp
46 ZdQar1r5nBIRCg9uq85YoLKoFeT7WN4PrwnRYPwaYGAFHfV44rDrq4RBe3VOIb+85W
47 tKn4HEzjlFelrImVbeymBsgpVhITveSVH1MdYRsE=
48From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
49To: libcamera-devel@lists.libcamera.org
50Cc: Khem Raj <raj.khem@gmail.com>
51Subject: [PATCH v2] libcamera: pipeline: uvcvideo: Avoid reference to temporary object
52Date: Sun, 28 Mar 2021 05:57:41 +0300
53Message-Id: <20210328025741.30246-1-laurent.pinchart@ideasonboard.com>
54X-Mailer: git-send-email 2.28.1
55MIME-Version: 1.0
56Content-Transfer-Encoding: 8bit
57
2From: Khem Raj <raj.khem@gmail.com> 58From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 3 Mar 2021 15:11:46 -0800
4Subject: [PATCH] uvcvideo: Use auto variable to avoid range loop warnings
5 59
6With c++17 loop range bases are defined where copy is obvious since 60A range-based for loop whose range expression is an array of char
7iterator returns a copy and not reference, gcc11 will emit a warning 61pointers and range variable declaration is a const reference to a
8about this 62std::string creates a temporary string from the char pointer and binds
63the range variable reference to it. This creates a const reference to a
64temporary, which is valid in C++, and extends the lifetime of the
65temporary to the lifetime of the reference.
66
67However, lifetime extension in range-based for loops is considered as a
68sign of a potential issue, as a temporary is created for every
69iteration, which can be costly, and the usage of a reference in the
70range declaration doesn't make it obvious that the code isn't simply
71binding a reference to an existing object. gcc 11, with the
72-Wrange-loop-construct option, flags this:
9 73
10uvcvideo.cpp:432:33: error: loop variable 'name' of type 'const string&' {aka 'const std::__cxx11::basic_string<cha 74uvcvideo.cpp:432:33: error: loop variable 'name' of type 'const string&' {aka 'const std::__cxx11::basic_string<cha
11r>&'} binds to a temporary constructed from type 'const char* const' [-Werror=range-loop-construct] 75r>&'} binds to a temporary constructed from type 'const char* const' [-Werror=range-loop-construct]
12| 432 | for (const std::string &name : { "idVendor", "idProduct" }) { 76| 432 | for (const std::string &name : { "idVendor", "idProduct" }) {
13| | ^~~~ 77| | ^~~~
14 78
15Therefore making it explicit is better 79To please the compiler, make the range variable a const char *. This may
80bring a tiny performance improvement, as the name is only used once, in
81a location where the compiler can use
82
83 operator+(const std::string &, const char *)
84
85instead of
86
87 operator+(const std::string &, const std::string &)
16 88
17Upstream-Status: Submitted [https://lists.libcamera.org/pipermail/libcamera-devel/2021-March/017966.html]
18Signed-off-by: Khem Raj <raj.khem@gmail.com> 89Signed-off-by: Khem Raj <raj.khem@gmail.com>
90Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
91
92Use a const char * type instead of auto, and update the commit message
93accordingly.
94
95Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
19--- 96---
20 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 2 +- 97 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 2 +-
21 1 file changed, 1 insertion(+), 1 deletion(-) 98 1 file changed, 1 insertion(+), 1 deletion(-)
22 99
23diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp 100diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
24index 031f96e2..ef23ece7 100644 101index 031f96e28449..b6c6ade5ebaf 100644
25--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp 102--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
26+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp 103+++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
27@@ -429,7 +429,7 @@ std::string PipelineHandlerUVC::generateId(const UVCCameraData *data) 104@@ -429,7 +429,7 @@ std::string PipelineHandlerUVC::generateId(const UVCCameraData *data)
@@ -29,10 +106,12 @@ index 031f96e2..ef23ece7 100644
29 /* Creata a device ID from the USB devices vendor and product ID. */ 106 /* Creata a device ID from the USB devices vendor and product ID. */
30 std::string deviceId; 107 std::string deviceId;
31- for (const std::string &name : { "idVendor", "idProduct" }) { 108- for (const std::string &name : { "idVendor", "idProduct" }) {
32+ for (const auto name : { "idVendor", "idProduct" }) { 109+ for (const char *name : { "idVendor", "idProduct" }) {
33 std::ifstream file(path + "/../" + name); 110 std::ifstream file(path + "/../" + name);
34 111
35 if (!file.is_open()) 112 if (!file.is_open())
36-- 113--
372.30.1 114Regards,
115
116Laurent Pinchart
38 117