[{"id":32947,"web_url":"https://patchwork.libcamera.org/comment/32947/","msgid":"<rfncfaaeji7tb4h4o3g3sc2iepooa6z6qtlwrag2gtx2sjwpp3@rvhrputluobx>","date":"2025-01-07T16:31:49","subject":"Re: [RFC PATCH v1 05/12] apps: lc-compliance: Don't allocate\n\t`FrameBufferAllocator` dynamically","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Barnabás\n\nOn Fri, Dec 20, 2024 at 03:08:25PM +0000, Barnabás Pőcze wrote:\n> There is no reason to do so.\n\nThere is not\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\n>\n> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n> ---\n>  src/apps/lc-compliance/helpers/capture.cpp | 12 ++++++------\n>  src/apps/lc-compliance/helpers/capture.h   |  2 +-\n>  2 files changed, 7 insertions(+), 7 deletions(-)\n>\n> diff --git a/src/apps/lc-compliance/helpers/capture.cpp b/src/apps/lc-compliance/helpers/capture.cpp\n> index d1dafb6cf..91c4d4400 100644\n> --- a/src/apps/lc-compliance/helpers/capture.cpp\n> +++ b/src/apps/lc-compliance/helpers/capture.cpp\n> @@ -13,7 +13,7 @@ using namespace libcamera;\n>\n>  Capture::Capture(std::shared_ptr<Camera> camera)\n>  \t: loop_(nullptr), camera_(std::move(camera)),\n> -\t  allocator_(std::make_unique<FrameBufferAllocator>(camera_))\n> +\t  allocator_(camera_)\n>  {\n>  }\n>\n> @@ -45,7 +45,7 @@ void Capture::configure(StreamRole role)\n>  void Capture::start()\n>  {\n>  \tStream *stream = config_->at(0).stream();\n> -\tint count = allocator_->allocate(stream);\n> +\tint count = allocator_.allocate(stream);\n>\n>  \tASSERT_GE(count, 0) << \"Failed to allocate buffers\";\n>  \tEXPECT_EQ(count, config_->at(0).bufferCount) << \"Allocated less buffers than expected\";\n> @@ -57,7 +57,7 @@ void Capture::start()\n>\n>  void Capture::stop()\n>  {\n> -\tif (!config_ || !allocator_->allocated())\n> +\tif (!config_ || !allocator_.allocated())\n>  \t\treturn;\n>\n>  \tcamera_->stop();\n> @@ -66,7 +66,7 @@ void Capture::stop()\n>\n>  \tStream *stream = config_->at(0).stream();\n>  \trequests_.clear();\n> -\tallocator_->free(stream);\n> +\tallocator_.free(stream);\n>  }\n>\n>  /* CaptureBalanced */\n> @@ -81,7 +81,7 @@ void CaptureBalanced::capture(unsigned int numRequests)\n>  \tstart();\n>\n>  \tStream *stream = config_->at(0).stream();\n> -\tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_->buffers(stream);\n> +\tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_.buffers(stream);\n>\n>  \t/* No point in testing less requests then the camera depth. */\n>  \tif (buffers.size() > numRequests) {\n> @@ -153,7 +153,7 @@ void CaptureUnbalanced::capture(unsigned int numRequests)\n>  \tstart();\n>\n>  \tStream *stream = config_->at(0).stream();\n> -\tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_->buffers(stream);\n> +\tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_.buffers(stream);\n>\n>  \tcaptureCount_ = 0;\n>  \tcaptureLimit_ = numRequests;\n> diff --git a/src/apps/lc-compliance/helpers/capture.h b/src/apps/lc-compliance/helpers/capture.h\n> index 19b6927c6..a4cc3a99e 100644\n> --- a/src/apps/lc-compliance/helpers/capture.h\n> +++ b/src/apps/lc-compliance/helpers/capture.h\n> @@ -30,7 +30,7 @@ protected:\n>  \tEventLoop *loop_;\n>\n>  \tstd::shared_ptr<libcamera::Camera> camera_;\n> -\tstd::unique_ptr<libcamera::FrameBufferAllocator> allocator_;\n> +\tlibcamera::FrameBufferAllocator allocator_;\n>  \tstd::unique_ptr<libcamera::CameraConfiguration> config_;\n>  \tstd::vector<std::unique_ptr<libcamera::Request>> requests_;\n>  };\n> --\n> 2.47.1\n>\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 D8C8ABD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  7 Jan 2025 16:31:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8E69D684EA;\n\tTue,  7 Jan 2025 17:31:54 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AF726684CD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  7 Jan 2025 17:31:52 +0100 (CET)","from ideasonboard.com (mob-5-90-140-128.net.vodafone.it\n\t[5.90.140.128])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 46C42675;\n\tTue,  7 Jan 2025 17:31:00 +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=\"rex+94o+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1736267460;\n\tbh=8JcaXU/P7a3nLSoGR9udChgHcIcTLjWZdOoNp2J9TQU=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=rex+94o+jtqhJAdgDiJXKwzJu0g81Qmv/jg7DrKZbbnZXN2aWp+bF89Mylt5R56xv\n\tOJzWGqOqd0ApkRCZUeVb1ANU5e+XV61ZCq5qQOb/E/dNHnanWpgIXoG3NhDtvPBbE4\n\tuA4+qB7gBem76WTUOwKwJ0DgsbIzni5dWryzKs24=","Date":"Tue, 7 Jan 2025 17:31:49 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v1 05/12] apps: lc-compliance: Don't allocate\n\t`FrameBufferAllocator` dynamically","Message-ID":"<rfncfaaeji7tb4h4o3g3sc2iepooa6z6qtlwrag2gtx2sjwpp3@rvhrputluobx>","References":"<20241220150759.709756-1-pobrn@protonmail.com>\n\t<20241220150759.709756-6-pobrn@protonmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20241220150759.709756-6-pobrn@protonmail.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>"}},{"id":32996,"web_url":"https://patchwork.libcamera.org/comment/32996/","msgid":"<Z4BKwUSGP3d77FjS@pyrite.rasen.tech>","date":"2025-01-09T22:16:33","subject":"Re: [RFC PATCH v1 05/12] apps: lc-compliance: Don't allocate\n\t`FrameBufferAllocator` dynamically","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Fri, Dec 20, 2024 at 03:08:25PM +0000, Barnabás Pőcze wrote:\n> There is no reason to do so.\n> \n> Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  src/apps/lc-compliance/helpers/capture.cpp | 12 ++++++------\n>  src/apps/lc-compliance/helpers/capture.h   |  2 +-\n>  2 files changed, 7 insertions(+), 7 deletions(-)\n> \n> diff --git a/src/apps/lc-compliance/helpers/capture.cpp b/src/apps/lc-compliance/helpers/capture.cpp\n> index d1dafb6cf..91c4d4400 100644\n> --- a/src/apps/lc-compliance/helpers/capture.cpp\n> +++ b/src/apps/lc-compliance/helpers/capture.cpp\n> @@ -13,7 +13,7 @@ using namespace libcamera;\n>  \n>  Capture::Capture(std::shared_ptr<Camera> camera)\n>  \t: loop_(nullptr), camera_(std::move(camera)),\n> -\t  allocator_(std::make_unique<FrameBufferAllocator>(camera_))\n> +\t  allocator_(camera_)\n>  {\n>  }\n>  \n> @@ -45,7 +45,7 @@ void Capture::configure(StreamRole role)\n>  void Capture::start()\n>  {\n>  \tStream *stream = config_->at(0).stream();\n> -\tint count = allocator_->allocate(stream);\n> +\tint count = allocator_.allocate(stream);\n>  \n>  \tASSERT_GE(count, 0) << \"Failed to allocate buffers\";\n>  \tEXPECT_EQ(count, config_->at(0).bufferCount) << \"Allocated less buffers than expected\";\n> @@ -57,7 +57,7 @@ void Capture::start()\n>  \n>  void Capture::stop()\n>  {\n> -\tif (!config_ || !allocator_->allocated())\n> +\tif (!config_ || !allocator_.allocated())\n>  \t\treturn;\n>  \n>  \tcamera_->stop();\n> @@ -66,7 +66,7 @@ void Capture::stop()\n>  \n>  \tStream *stream = config_->at(0).stream();\n>  \trequests_.clear();\n> -\tallocator_->free(stream);\n> +\tallocator_.free(stream);\n>  }\n>  \n>  /* CaptureBalanced */\n> @@ -81,7 +81,7 @@ void CaptureBalanced::capture(unsigned int numRequests)\n>  \tstart();\n>  \n>  \tStream *stream = config_->at(0).stream();\n> -\tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_->buffers(stream);\n> +\tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_.buffers(stream);\n>  \n>  \t/* No point in testing less requests then the camera depth. */\n>  \tif (buffers.size() > numRequests) {\n> @@ -153,7 +153,7 @@ void CaptureUnbalanced::capture(unsigned int numRequests)\n>  \tstart();\n>  \n>  \tStream *stream = config_->at(0).stream();\n> -\tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_->buffers(stream);\n> +\tconst std::vector<std::unique_ptr<FrameBuffer>> &buffers = allocator_.buffers(stream);\n>  \n>  \tcaptureCount_ = 0;\n>  \tcaptureLimit_ = numRequests;\n> diff --git a/src/apps/lc-compliance/helpers/capture.h b/src/apps/lc-compliance/helpers/capture.h\n> index 19b6927c6..a4cc3a99e 100644\n> --- a/src/apps/lc-compliance/helpers/capture.h\n> +++ b/src/apps/lc-compliance/helpers/capture.h\n> @@ -30,7 +30,7 @@ protected:\n>  \tEventLoop *loop_;\n>  \n>  \tstd::shared_ptr<libcamera::Camera> camera_;\n> -\tstd::unique_ptr<libcamera::FrameBufferAllocator> allocator_;\n> +\tlibcamera::FrameBufferAllocator allocator_;\n>  \tstd::unique_ptr<libcamera::CameraConfiguration> config_;\n>  \tstd::vector<std::unique_ptr<libcamera::Request>> requests_;\n>  };\n> -- \n> 2.47.1\n> \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 07748C32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  9 Jan 2025 22:16:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B9B9D68503;\n\tThu,  9 Jan 2025 23:16:41 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 300BA61884\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  9 Jan 2025 23:16:40 +0100 (CET)","from pyrite.rasen.tech (h175-177-049-030.catv02.itscom.jp\n\t[175.177.49.30])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 81FF9C62;\n\tThu,  9 Jan 2025 23:15:45 +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=\"X4X6TvWR\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1736460946;\n\tbh=Z6cY/Zq8VnPugyrYU/bioJ2IGuSZQvrbWB5guZxl5fE=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=X4X6TvWRubmeGPkjBHDjZhcypj//DeRfnurvg8fIL+7B7BVh0aPFQaVwfrDYP/2y4\n\td4ZEHqPP1xZLvXiVIBnlTgaHtSeMhoKsTkA7H1Kue2ZD2DUHnS1x98MWO/WasbiUIR\n\toDq51bK6Vef+XePblivdV1MpbpZK939Yw0o0P5I0=","Date":"Fri, 10 Jan 2025 07:16:33 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <pobrn@protonmail.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH v1 05/12] apps: lc-compliance: Don't allocate\n\t`FrameBufferAllocator` dynamically","Message-ID":"<Z4BKwUSGP3d77FjS@pyrite.rasen.tech>","References":"<20241220150759.709756-1-pobrn@protonmail.com>\n\t<20241220150759.709756-6-pobrn@protonmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20241220150759.709756-6-pobrn@protonmail.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>"}}]