[{"id":32714,"web_url":"https://patchwork.libcamera.org/comment/32714/","msgid":"<CAHW6GY+3t5OLhm_b1HHGG-BH2-hTozfepZKuQO-qA_x4xcZu3w@mail.gmail.com>","date":"2024-12-13T10:03:19","subject":"Re: [PATCH 1/6] ipa: rpi: Use r-value references in the\n\tset()/setLocked() functions","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for the patch.\n\nOn Fri, 13 Dec 2024 at 09:46, Naushir Patuck <naush@raspberrypi.com> wrote:\n>\n> Use an r-value reference in set() and setLocked(), allowing more\n> efficient metadata handling with std::forward and std::move if needed.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n\nLooks good!\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks\nDavid\n\n> ---\n>  src/ipa/rpi/controller/metadata.h | 8 ++++----\n>  1 file changed, 4 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/ipa/rpi/controller/metadata.h b/src/ipa/rpi/controller/metadata.h\n> index b4650d25170f..eda4b59bca9a 100644\n> --- a/src/ipa/rpi/controller/metadata.h\n> +++ b/src/ipa/rpi/controller/metadata.h\n> @@ -36,10 +36,10 @@ public:\n>         }\n>\n>         template<typename T>\n> -       void set(std::string const &tag, T const &value)\n> +       void set(std::string const &tag, T &&value)\n>         {\n>                 std::scoped_lock lock(mutex_);\n> -               data_[tag] = value;\n> +               data_[tag] = std::forward<T>(value);\n>         }\n>\n>         template<typename T>\n> @@ -104,10 +104,10 @@ public:\n>         }\n>\n>         template<typename T>\n> -       void setLocked(std::string const &tag, T const &value)\n> +       void setLocked(std::string const &tag, T &&value)\n>         {\n>                 /* Use this only if you're holding the lock yourself. */\n> -               data_[tag] = value;\n> +               data_[tag] = std::forward<T>(value);\n>         }\n>\n>         /*\n> --\n> 2.43.0\n>","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 D70CFC32F0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 13 Dec 2024 10:03:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 19A9D67EE6;\n\tFri, 13 Dec 2024 11:03:33 +0100 (CET)","from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com\n\t[IPv6:2607:f8b0:4864:20::72d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 708C8618AD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Dec 2024 11:03:31 +0100 (CET)","by mail-qk1-x72d.google.com with SMTP id\n\taf79cd13be357-7b1601e853eso119328985a.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 13 Dec 2024 02:03:31 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"SQ10GqIg\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1734084210; x=1734689010;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=tgG7O6lgekQoryDsokhlXccyOyeiTx3ErHexb+0pOxY=;\n\tb=SQ10GqIgRnHMLYbKe5j5zMO6QCaKmmaDqrpSkP5Cmc5KdNg1TrQvZycX3ybRbdHa0u\n\tuUsysqLapg7aFZVracE1ClzuK/sd9ztRolcSsEZ88/f3gsg3MlkU7B88elNWEGIEVZgn\n\tNCLHvGFukFqKnR89pUvgQPtc+YYmisrfO1hNoKWE1TPdbLel34/gl8quwt5uxvE8ef9b\n\tsX5vDYw5Xcxrw8jD2RTaV4nHD9taKiwIM/Iaog3eJ2O+rHSJCk4JIEmM7i2Jzh3qax6b\n\todzhLMpzBlAvFOKTa1OKsK5zA0PCzhy0Hnrm/r0UPHqBuk06xEGH4frJr0lr4Ba170O4\n\t7i+w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1734084210; x=1734689010;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=tgG7O6lgekQoryDsokhlXccyOyeiTx3ErHexb+0pOxY=;\n\tb=Y/ObDhdrkWOtDrawhm6LJ7tIiiqJKHiDODXn8VM7tx1IDhIaJb+GNkkxl68EY0+dWq\n\t3Jt20nXh1IptUrspHcYN0u8MrdcSwv+uBeUI9e9bk5rvTtq+tzr1tuC2wuaR0O/w/9Qk\n\tQa+Umz2VAhUv8exry2U/4ESpgmODDy5YOh9m+sPbel8rg/AI1S/DWIoLopGa0K0alNin\n\tiwYsnZxK3urqulGKJ3z5JVtHw3V+0ctRMaGUvByVwEDxCd0FCVxkyfI20XqP94wMf4rs\n\tKvc/fpPYXRpK8tRoLkznrBDPL3GrCpyB6+OyEkuU+2OE1gm560jx8/ACqPY36xlWaWFw\n\t81Sw==","X-Gm-Message-State":"AOJu0YxI9xxJEK7ZBa6ko9KSl7i3TMQzTTgdzkrc2PAWdBlfiU+ZwclP\n\tvdOnQ2WfLWN/po/ySDiEUCb2p4H3J8d/5/f8CmjCpEM6KfDBFcJEyviU1dNqXSaai+6yTzDxiAS\n\tKo6tIpLaQRXRKh1E18LnZPMxrMz7eYtiyuOPrZw==","X-Gm-Gg":"ASbGncuRNKGNSK7LYqQfmpaymgXc/MWvGtc68VRUfr+h4PUWsKyCGgQyZjD75LV6i3Y\n\tm1+Sx5E9rroaS1EvqBWHJMDVSaiJc/3FD74J4Eg==","X-Google-Smtp-Source":"AGHT+IGzd0ldd3Q1ENnidmaYrWXNw0fzuwWZqfi1iph+uKfntyC8oe7fovEoBcQnCMERp5TZKYpYM/tb5vk1rQitlDM=","X-Received":"by 2002:a05:620a:4890:b0:7b6:c695:fb88 with SMTP id\n\taf79cd13be357-7b6fbf4539cmr272087085a.62.1734084210445;\n\tFri, 13 Dec 2024 02:03:30 -0800 (PST)","MIME-Version":"1.0","References":"<20241213094602.2083174-1-naush@raspberrypi.com>\n\t<20241213094602.2083174-2-naush@raspberrypi.com>","In-Reply-To":"<20241213094602.2083174-2-naush@raspberrypi.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Fri, 13 Dec 2024 10:03:19 +0000","Message-ID":"<CAHW6GY+3t5OLhm_b1HHGG-BH2-hTozfepZKuQO-qA_x4xcZu3w@mail.gmail.com>","Subject":"Re: [PATCH 1/6] ipa: rpi: Use r-value references in the\n\tset()/setLocked() functions","To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"UTF-8\"","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>"}},{"id":32726,"web_url":"https://patchwork.libcamera.org/comment/32726/","msgid":"<20241215153338.GA9975@pendragon.ideasonboard.com>","date":"2024-12-15T15:33:38","subject":"Re: [PATCH 1/6] ipa: rpi: Use r-value references in the\n\tset()/setLocked() functions","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Naush,\n\nThank you for the patch.\n\nOn Fri, Dec 13, 2024 at 09:38:24AM +0000, Naushir Patuck wrote:\n> Use an r-value reference in set() and setLocked(), allowing more\n> efficient metadata handling with std::forward and std::move if needed.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/ipa/rpi/controller/metadata.h | 8 ++++----\n>  1 file changed, 4 insertions(+), 4 deletions(-)\n> \n> diff --git a/src/ipa/rpi/controller/metadata.h b/src/ipa/rpi/controller/metadata.h\n> index b4650d25170f..eda4b59bca9a 100644\n> --- a/src/ipa/rpi/controller/metadata.h\n> +++ b/src/ipa/rpi/controller/metadata.h\n> @@ -36,10 +36,10 @@ public:\n>  \t}\n>  \n>  \ttemplate<typename T>\n> -\tvoid set(std::string const &tag, T const &value)\n> +\tvoid set(std::string const &tag, T &&value)\n>  \t{\n>  \t\tstd::scoped_lock lock(mutex_);\n> -\t\tdata_[tag] = value;\n> +\t\tdata_[tag] = std::forward<T>(value);\n\nYou should include <utility>. With that,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n>  \t}\n>  \n>  \ttemplate<typename T>\n> @@ -104,10 +104,10 @@ public:\n>  \t}\n>  \n>  \ttemplate<typename T>\n> -\tvoid setLocked(std::string const &tag, T const &value)\n> +\tvoid setLocked(std::string const &tag, T &&value)\n>  \t{\n>  \t\t/* Use this only if you're holding the lock yourself. */\n> -\t\tdata_[tag] = value;\n> +\t\tdata_[tag] = std::forward<T>(value);\n>  \t}\n>  \n>  \t/*","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 BAC00C32F6\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun, 15 Dec 2024 15:33:57 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 06C5067F01;\n\tSun, 15 Dec 2024 16:33:57 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5FD8D67EEE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun, 15 Dec 2024 16:33:55 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 436BDA57;\n\tSun, 15 Dec 2024 16:33:19 +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=\"Od8uZaF8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1734276799;\n\tbh=3n9v1vHuT/OfRz7WD9e9PnRHvBMaMgkT4jo8w9JbJjA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Od8uZaF8WWSieS/UsgDPt/RYkdfM79nY7W8kIar2hUKAUUoGU6/kx4OEPteCq0Xpb\n\tsa3s4CSPK54A1WGoiu0tLT0PE4y4QJmvfo3/Y3NmeJmLbm+ecFPWoGjdT6ybS5Qadg\n\tXOsT/bpupnnUrZygzwAhgHDmcFztzMqy5OFBFkAI=","Date":"Sun, 15 Dec 2024 17:33:38 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH 1/6] ipa: rpi: Use r-value references in the\n\tset()/setLocked() functions","Message-ID":"<20241215153338.GA9975@pendragon.ideasonboard.com>","References":"<20241213094602.2083174-1-naush@raspberrypi.com>\n\t<20241213094602.2083174-2-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241213094602.2083174-2-naush@raspberrypi.com>","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>"}}]