From patchwork Fri Dec 20 15:08:25 2024 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: 22431 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 774B6C3272 for ; Fri, 20 Dec 2024 15:08:32 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 34C38684AB; Fri, 20 Dec 2024 16:08:32 +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="dT7RtF+E"; dkim-atps=neutral Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DAB8A6849B for ; Fri, 20 Dec 2024 16:08:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1734707310; x=1734966510; bh=czeInqymJn87RyMONeijTyPwqNtDX9fQTMA0VzZy9ec=; h=Date:To:From: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=dT7RtF+EkUutxBYYWG05ILLPVAYG1mQeA3A1TlnExl1XRcO/Y/O5/jOIPLHdHvTgS NOKnU6X3HvN4mg0REPQHQwGUBc3861swI5WFaJToHinkR5aRvpxAyHCFWvDgx2VXOr s6hwCd7T6j8rsKWdmO3PPN64KzLkavVMrmcB6RcwtURl9+5bmR/A4YjOLaNqjBffUh /BNp6wbxljFk7xPApOPchHkBhnojMicAUkHqnVDQS6BY11ag5it0Bq9CWHhz1b/gTz pCDESPPKW+cbo5PpPlua/n7rfceXc4n9vSRjfwGScxaAtewq++9xJLhPrJJnqLEAK0 lQyGRv52oIL1w== Date: Fri, 20 Dec 2024 15:08:25 +0000 To: libcamera-devel@lists.libcamera.org From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [RFC PATCH v1 05/12] apps: lc-compliance: Don't allocate `FrameBufferAllocator` dynamically Message-ID: <20241220150759.709756-6-pobrn@protonmail.com> In-Reply-To: <20241220150759.709756-1-pobrn@protonmail.com> References: <20241220150759.709756-1-pobrn@protonmail.com> Feedback-ID: 20568564:user:proton X-Pm-Message-ID: 88254bb79732204b8edf1020dda697d23bb7cc5d 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 --- 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_; };