From patchwork Thu Jun 18 12:38:34 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: 26982 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 2BBCBC3316 for ; Thu, 18 Jun 2026 12:39:24 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5B54965702; Thu, 18 Jun 2026 14:39:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AvJvnfSl"; 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 C6CBC62C6F for ; Thu, 18 Jun 2026 14:38:51 +0200 (CEST) Received: from pb-laptop.local (185.182.214.63.nat.pool.zt.hu [185.182.214.63]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D5BAF2F8 for ; Thu, 18 Jun 2026 14:38:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1781786297; bh=EcfYKHGpz3/abJQGTuFyGSU5AQ37uNVNq64FIVh25TU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AvJvnfSl/7UrpaGsaU+coLMMfLH04T/HUm+rvjb8AS+I/JidDkYDg0qKoJiq+/2Fq LAtUTjzizLmjU3hRB1YDSV0gjiT6GiCh1aLKYmcEF6hdnY+YAzevZ9hRPPrA0GIYlt 37x+TNOO3FDl4fusehcpPdM7GQCKnYuXYYx9BdXM= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [RFC PATCH v1 17/27] libcamera: pipeline_handler: Use `std::deque` Date: Thu, 18 Jun 2026 14:38:34 +0200 Message-ID: <20260618123844.656396-18-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260618123844.656396-1-barnabas.pocze@ideasonboard.com> References: <20260618123844.656396-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 8a2e9ed589..be3e5ff97e 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 @@ -36,8 +35,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 99f35d1e42..5376fee299 100644 --- a/src/libcamera/pipeline_handler.cpp +++ b/src/libcamera/pipeline_handler.cpp @@ -372,7 +372,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. */ @@ -381,7 +381,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 @@ -472,7 +472,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); request->_d()->prepare(300ms); } @@ -521,7 +521,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); } }