From patchwork Thu Jan 30 11:51:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 22669 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 820A3BDB1C for ; Thu, 30 Jan 2025 11:51:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 3F6A268570; Thu, 30 Jan 2025 12:51:08 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=protonmail.com header.i=@protonmail.com header.b="NMa3+OXk"; dkim-atps=neutral Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B74D468564 for ; Thu, 30 Jan 2025 12:51:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1738237866; x=1738497066; bh=eTzvA6QdrvQ08lkMvjYmvyl55ZnFctQsHD25rsc9d9Q=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=NMa3+OXkJ1ckPT2CxxkHYi3G3L04mRmwJRakxzIfA38vCnJRbSOaT78I9QxkHU98D QKKGD0KYHSpz3niyhAB7rTxoAd0Fo8CIHH6g/msqJ7VBEPqhnpbUHnPEu7k/AJuyfQ jzHQqLqpKGKwfsCZce1aSBrVW6g4+GrJ6Tsg2R+jazSLaiC4O4kh8f88PJ3zzcmCU/ J1U/IZ/SH2QigGop5HnaFdCyXBCCrEnY7UDg307HhneI6Bw+habRsMOnk7L2/HULdL m/ItjibqGD1GWJOdvB/AiR5kgDp9m+ylQWroDBXa5KHeXB1m0slua+yrDrNfRnJw7A LEe9D0OwaRF/A== Date: Thu, 30 Jan 2025 11:51:00 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Cc: Jacopo Mondi , Paul Elder Subject: [RFC PATCH v3 12/21] apps: lc-compliance: Don't allocate `FrameBufferAllocator` dynamically Message-ID: <20250130115001.1129305-13-pobrn@protonmail.com> In-Reply-To: <20250130115001.1129305-1-pobrn@protonmail.com> References: <20250130115001.1129305-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: c35f6f3e271be92d064a82957fcffec90216fc3b 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" There is no reason to do so. Signed-off-by: Barnabás Pőcze Reviewed-by: Jacopo Mondi Reviewed-by: Paul Elder --- src/apps/lc-compliance/helpers/capture.cpp | 12 ++++++------ src/apps/lc-compliance/helpers/capture.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/apps/lc-compliance/helpers/capture.cpp b/src/apps/lc-compliance/helpers/capture.cpp index d1dafb6cf..91c4d4400 100644 --- a/src/apps/lc-compliance/helpers/capture.cpp +++ b/src/apps/lc-compliance/helpers/capture.cpp @@ -13,7 +13,7 @@ using namespace libcamera; Capture::Capture(std::shared_ptr camera) : loop_(nullptr), camera_(std::move(camera)), - allocator_(std::make_unique(camera_)) + allocator_(camera_) { } @@ -45,7 +45,7 @@ void Capture::configure(StreamRole role) void Capture::start() { Stream *stream = config_->at(0).stream(); - int count = allocator_->allocate(stream); + int count = allocator_.allocate(stream); ASSERT_GE(count, 0) << "Failed to allocate buffers"; EXPECT_EQ(count, config_->at(0).bufferCount) << "Allocated less buffers than expected"; @@ -57,7 +57,7 @@ void Capture::start() void Capture::stop() { - if (!config_ || !allocator_->allocated()) + if (!config_ || !allocator_.allocated()) return; camera_->stop(); @@ -66,7 +66,7 @@ void Capture::stop() Stream *stream = config_->at(0).stream(); requests_.clear(); - allocator_->free(stream); + allocator_.free(stream); } /* CaptureBalanced */ @@ -81,7 +81,7 @@ void CaptureBalanced::capture(unsigned int numRequests) start(); Stream *stream = config_->at(0).stream(); - const std::vector> &buffers = allocator_->buffers(stream); + const std::vector> &buffers = allocator_.buffers(stream); /* No point in testing less requests then the camera depth. */ if (buffers.size() > numRequests) { @@ -153,7 +153,7 @@ void CaptureUnbalanced::capture(unsigned int numRequests) start(); Stream *stream = config_->at(0).stream(); - const std::vector> &buffers = allocator_->buffers(stream); + const std::vector> &buffers = allocator_.buffers(stream); captureCount_ = 0; captureLimit_ = numRequests; diff --git a/src/apps/lc-compliance/helpers/capture.h b/src/apps/lc-compliance/helpers/capture.h index 19b6927c6..a4cc3a99e 100644 --- a/src/apps/lc-compliance/helpers/capture.h +++ b/src/apps/lc-compliance/helpers/capture.h @@ -30,7 +30,7 @@ protected: EventLoop *loop_; std::shared_ptr camera_; - std::unique_ptr allocator_; + libcamera::FrameBufferAllocator allocator_; std::unique_ptr config_; std::vector> requests_; };