{"id":27105,"url":"https://patchwork.libcamera.org/api/1.1/patches/27105/?format=json","web_url":"https://patchwork.libcamera.org/patch/27105/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260629163017.863145-26-barnabas.pocze@ideasonboard.com>","date":"2026-06-29T16:29:48","name":"[RFC,v1,25/54] libcamera: request: Store count of pending buffers","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"b0016520dbf01451594ffe2373390b68aa34a33f","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/1.1/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27105/mbox/","series":[{"id":6025,"url":"https://patchwork.libcamera.org/api/1.1/series/6025/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6025","date":"2026-06-29T16:29:23","name":"libcamera: Split requests and buffers","version":1,"mbox":"https://patchwork.libcamera.org/series/6025/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27105/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27105/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4CB21C3261\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Jun 2026 16:31:16 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AD1FB65FAC;\n\tMon, 29 Jun 2026 18:31:15 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A342165F4D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2026 18:30:26 +0200 (CEST)","from pb-laptop.local (185.221.140.128.nat.pool.zt.hu\n\t[185.221.140.128])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7C160E91\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2026 18:29:43 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"CzL4CWuz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1782750583;\n\tbh=pQVAW6iCf58KirUIatCJzbQJHIklbZA5CfRyGTd+i54=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=CzL4CWuzeL39rqXVSGOkUtpnrZxDTtEGTUL9I9XsG5d0zTDu0DB54pr8c2JIDGHyu\n\tlN/GAt3ON3BhcwgyoJcRD7WWpmpPO/HQFprtgXwKRfSEdIvNuWMbfuq9s7kDb0ANn7\n\t/SMo1TMSREYVwGBc5MSceI5s1hxMWgr+uPi20CRE=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[RFC PATCH v1 25/54] libcamera: request: Store count of pending\n\tbuffers","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","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"With the split of requests and buffers, a request will have no information\nabout which specific buffers are pending for itself, so make the previous\nset member into a simple integer counter.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n include/libcamera/internal/request.h |  5 ++---\n src/libcamera/request.cpp            | 19 +++++--------------\n 2 files changed, 7 insertions(+), 17 deletions(-)","diff":"diff --git a/include/libcamera/internal/request.h b/include/libcamera/internal/request.h\nindex 8f570e4f79..09768c6fcd 100644\n--- a/include/libcamera/internal/request.h\n+++ b/include/libcamera/internal/request.h\n@@ -8,7 +8,6 @@\n #pragma once\n \n #include <stdint.h>\n-#include <unordered_set>\n \n #include <libcamera/base/event_notifier.h>\n \n@@ -28,7 +27,7 @@ public:\n \t~Private();\n \n \tCamera *camera() const { return camera_; }\n-\tbool hasPendingBuffers() const { return !pending_.empty(); }\n+\tbool hasPendingBuffers() const { return pending_ > 0; }\n \n \tControlList &metadata() { return metadata_; }\n \n@@ -47,7 +46,7 @@ private:\n \tbool cancelled_;\n \tuint32_t sequence_ = 0;\n \n-\tstd::unordered_set<FrameBuffer *> pending_;\n+\tsize_t pending_ = 0;\n \tControlList metadata_;\n };\n \ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex 8819ba0ce3..9544a8993d 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -108,8 +108,8 @@ bool Request::Private::completeBuffer(FrameBuffer *buffer)\n \n \tASSERT(request->findBuffer(buffer->_d()->stream_) == buffer);\n \n-\tint ret = pending_.erase(buffer);\n-\tASSERT(ret == 1);\n+\tASSERT(pending_ > 0);\n+\tpending_ -= 1;\n \n \tbuffer->_d()->setRequest(nullptr);\n \tbuffer->_d()->stream_ = nullptr;\n@@ -143,17 +143,8 @@ void Request::Private::complete()\n \n void Request::Private::doCancelRequest()\n {\n-\tRequest *request = _o<Request>();\n-\n-\tfor (FrameBuffer *buffer : pending_) {\n-\t\tbuffer->_d()->cancel();\n-\t\tcamera_->bufferCompleted.emit(request, buffer);\n-\t\tbuffer->_d()->setRequest(nullptr);\n-\t\tbuffer->_d()->stream_ = nullptr;\n-\t}\n-\n \tcancelled_ = true;\n-\tpending_.clear();\n+\tpending_ = 0;\n }\n \n /**\n@@ -184,7 +175,7 @@ void Request::Private::reset()\n {\n \tsequence_ = 0;\n \tcancelled_ = false;\n-\tpending_.clear();\n+\tpending_ = 0;\n }\n #endif /* __DOXYGEN_PUBLIC__ */\n \n@@ -426,7 +417,7 @@ std::ostream &operator<<(std::ostream &out, const Request &r)\n \n \t/* Example Output: Request(55:P:1/2:6523524) */\n \tout << \"Request(\" << r.sequence() << \":\" << statuses[r.status()] << \":\"\n-\t    << r._d()->pending_.size() << \"/\" << r.buffers().size() << \":\"\n+\t    << r._d()->pending_ << \"/\" << r.buffers().size() << \":\"\n \t    << r.cookie() << \")\";\n \n \treturn out;\n","prefixes":["RFC","v1","25/54"]}