From patchwork Mon Jun 29 16:29:56 2026 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: 27113 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 26418C3261 for ; Mon, 29 Jun 2026 16:31:25 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9BFCD65F9D; Mon, 29 Jun 2026 18:31:24 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="T6nfMgIM"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 574D165F5D for ; Mon, 29 Jun 2026 18:30:28 +0200 (CEST) Received: from pb-laptop.local (185.221.140.128.nat.pool.zt.hu [185.221.140.128]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 2E488E91 for ; Mon, 29 Jun 2026 18:29:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1782750585; bh=L5i53BnAprfOLEtDEsx738K9H6ut2Q3E9lZn67Z1evo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=T6nfMgIMsbqecOO2Og80SmRIekHc1LXmw6oyni3K6BXavU4CpG/lNrJxB0MJkptl9 aaJSvUrIiaHBp2b+d5p0dA16wJM6rkEaNaDSPFg7UkZPmmVjNToOwCE1dqrdGc+TLb K76HQL4WPL8UobV65iu32vMfMULrFl2na3DUfKn8= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [RFC PATCH v1 33/54] libcamera: pipeline_handler: Use `std::deque` Date: Mon, 29 Jun 2026 18:29:56 +0200 Message-ID: <20260629163017.863145-34-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260629163017.863145-1-barnabas.pocze@ideasonboard.com> References: <20260629163017.863145-1-barnabas.pocze@ideasonboard.com> 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" `std::queue` already uses `std::deque` as its implementation, so there is no difference there. And getting a specific index of `std::list` is a linear operation, so replace it with an `std::deque`, to enable pipeline handlers to look into the list more easily. Signed-off-by: Barnabás Pőcze --- include/libcamera/internal/camera.h | 7 +++---- src/libcamera/pipeline_handler.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h index 13b72258ff..7298b150e5 100644 --- a/include/libcamera/internal/camera.h +++ b/include/libcamera/internal/camera.h @@ -8,9 +8,8 @@ #pragma once #include -#include +#include #include -#include #include #include #include @@ -40,8 +39,8 @@ public: PipelineHandler *pipe() { return pipe_.get(); } const PipelineHandler *pipe() const { return pipe_.get(); } - std::list queuedRequests_; - std::queue waitingRequests_; + std::deque queuedRequests_; + std::deque waitingRequests_; ControlInfoMap controlInfo_; ControlList properties_; diff --git a/src/libcamera/pipeline_handler.cpp b/src/libcamera/pipeline_handler.cpp index 16f218831c..ad1174d043 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -399,7 +399,7 @@ void PipelineHandler::stop(Camera *camera) * after the device to keep them in order. */ Camera::Private *data = camera->_d(); - std::queue waitingRequests; + std::deque waitingRequests; waitingRequests.swap(data->waitingRequests_); /* Stop the pipeline handler and let the queued requests complete. */ @@ -408,7 +408,7 @@ void PipelineHandler::stop(Camera *camera) /* Cancel and signal as complete all waiting requests. */ while (!waitingRequests.empty()) { Request *request = waitingRequests.front(); - waitingRequests.pop(); + waitingRequests.pop_front(); /* * Cancel all requests by marking them as cancelled and calling @@ -498,7 +498,7 @@ void PipelineHandler::queueRequest(Request *request) Camera *camera = request->_d()->camera(); Camera::Private *data = camera->_d(); - data->waitingRequests_.push(request); + data->waitingRequests_.push_back(request); doQueueRequests(camera); } @@ -582,7 +582,7 @@ void PipelineHandler::doQueueRequests(Camera *camera) * Pop the request first, in case doQueueRequests() is called * recursively from within doQueueRequest() */ - data->waitingRequests_.pop(); + data->waitingRequests_.pop_front(); doQueueRequest(request); } }