From patchwork Tue Jan 14 18:22:32 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: 22570 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 B8E0EC3301 for ; Tue, 14 Jan 2025 18:22:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6E6F46854A; Tue, 14 Jan 2025 19:22:38 +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="qbWgplmp"; dkim-atps=neutral Received: from mail-10628.protonmail.ch (mail-10628.protonmail.ch [79.135.106.28]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8D2A668536 for ; Tue, 14 Jan 2025 19:22:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1736878955; x=1737138155; bh=dFg6NaZS/ejGUsUCrx8TsDPmCurA3lVC80DO2Jz8mEs=; 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=qbWgplmpWDqduPvprWedWTbhAtZ+NXTEnr7EjHYI/Zv3LcZg1Jai/wz+fQqMVLl5P wta7EQtHIQ0pnmj4WP44VJXy1/GS+i4Dae5S5Sod4cvDLV1cjU7Hr2HByH+0LoNbPg f+g0OupdoYvyVMGBOv5eS0k2HlkRlXw80jT9/cF6n0q8asfnsO+1h04C/Rx6MwZwJG /icxYREuqedPsIq9s3jxxqG7nGPzNJBnAa7yOjDw9VcEhg5AkGKQwjfY5NjnF1HRq6 IbGn8+fbAJ1g4kFVUuiiIJQ0rvZNuaBosB9J9r+ZuARY0XMHZa7/feZi4HmHWfyrPh Tf8QCtXZ/FfjQ== Date: Tue, 14 Jan 2025 18:22:32 +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 v2 09/16] apps: lc-compliance: Don't allocate `FrameBufferAllocator` dynamically Message-ID: <20250114182143.1773762-10-pobrn@protonmail.com> In-Reply-To: <20250114182143.1773762-1-pobrn@protonmail.com> References: <20250114182143.1773762-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: 85c058acd4f6844cbe1d43d9caf70ef40a8e09da 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_; };