From patchwork Mon Jun 29 16:29:48 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: 27105 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 4CB21C3261 for ; Mon, 29 Jun 2026 16:31:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id AD1FB65FAC; Mon, 29 Jun 2026 18:31:15 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="CzL4CWuz"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A342165F4D for ; Mon, 29 Jun 2026 18:30:26 +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 7C160E91 for ; Mon, 29 Jun 2026 18:29:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1782750583; bh=pQVAW6iCf58KirUIatCJzbQJHIklbZA5CfRyGTd+i54=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CzL4CWuzeL39rqXVSGOkUtpnrZxDTtEGTUL9I9XsG5d0zTDu0DB54pr8c2JIDGHyu lN/GAt3ON3BhcwgyoJcRD7WWpmpPO/HQFprtgXwKRfSEdIvNuWMbfuq9s7kDb0ANn7 /SMo1TMSREYVwGBc5MSceI5s1hxMWgr+uPi20CRE= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [RFC PATCH v1 25/54] libcamera: request: Store count of pending buffers Date: Mon, 29 Jun 2026 18:29:48 +0200 Message-ID: <20260629163017.863145-26-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" With the split of requests and buffers, a request will have no information about which specific buffers are pending for itself, so make the previous set member into a simple integer counter. Signed-off-by: Barnabás Pőcze --- include/libcamera/internal/request.h | 5 ++--- src/libcamera/request.cpp | 19 +++++-------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/include/libcamera/internal/request.h b/include/libcamera/internal/request.h index 8f570e4f79..09768c6fcd 100644 --- a/include/libcamera/internal/request.h +++ b/include/libcamera/internal/request.h @@ -8,7 +8,6 @@ #pragma once #include -#include #include @@ -28,7 +27,7 @@ public: ~Private(); Camera *camera() const { return camera_; } - bool hasPendingBuffers() const { return !pending_.empty(); } + bool hasPendingBuffers() const { return pending_ > 0; } ControlList &metadata() { return metadata_; } @@ -47,7 +46,7 @@ private: bool cancelled_; uint32_t sequence_ = 0; - std::unordered_set pending_; + size_t pending_ = 0; ControlList metadata_; }; diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index 8819ba0ce3..9544a8993d 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -108,8 +108,8 @@ bool Request::Private::completeBuffer(FrameBuffer *buffer) ASSERT(request->findBuffer(buffer->_d()->stream_) == buffer); - int ret = pending_.erase(buffer); - ASSERT(ret == 1); + ASSERT(pending_ > 0); + pending_ -= 1; buffer->_d()->setRequest(nullptr); buffer->_d()->stream_ = nullptr; @@ -143,17 +143,8 @@ void Request::Private::complete() void Request::Private::doCancelRequest() { - Request *request = _o(); - - for (FrameBuffer *buffer : pending_) { - buffer->_d()->cancel(); - camera_->bufferCompleted.emit(request, buffer); - buffer->_d()->setRequest(nullptr); - buffer->_d()->stream_ = nullptr; - } - cancelled_ = true; - pending_.clear(); + pending_ = 0; } /** @@ -184,7 +175,7 @@ void Request::Private::reset() { sequence_ = 0; cancelled_ = false; - pending_.clear(); + pending_ = 0; } #endif /* __DOXYGEN_PUBLIC__ */ @@ -426,7 +417,7 @@ std::ostream &operator<<(std::ostream &out, const Request &r) /* Example Output: Request(55:P:1/2:6523524) */ out << "Request(" << r.sequence() << ":" << statuses[r.status()] << ":" - << r._d()->pending_.size() << "/" << r.buffers().size() << ":" + << r._d()->pending_ << "/" << r.buffers().size() << ":" << r.cookie() << ")"; return out;