From patchwork Mon Jun 29 16:29:43 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: 27100 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 C56A3C3261 for ; Mon, 29 Jun 2026 16:31:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5223B65F5D; Mon, 29 Jun 2026 18:31:04 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ULN9oESJ"; 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 953A265F35 for ; Mon, 29 Jun 2026 18:30:25 +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 6B7808D4 for ; Mon, 29 Jun 2026 18:29:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1782750582; bh=4/PLcbRs+8EHIOon+V3jxlyjcguVLwiBB0QOCOiWP3w=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ULN9oESJed7hs5pDqshUAAI5qPett158uwFfSRI7vKFB/yM1WK957HbPz8LR7GX8q XZT47C62TSKt6H3oS9FW91Iyh2ekXAi0y/PfmbbrbMIwj9/wq+3I12SUSj6+OvJ+ZJ K9w6DVSYlMUhhXIveNbYpwkUvlZsbf/Qi5gRgO2I= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [RFC PATCH v1 20/54] libcamera: framebuffer: Store associated Stream Date: Mon, 29 Jun 2026 18:29:43 +0200 Message-ID: <20260629163017.863145-21-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" Store the Stream of the Camera that will capture data into the buffer. Signed-off-by: Barnabás Pőcze --- include/libcamera/internal/framebuffer.h | 4 ++++ src/libcamera/framebuffer.cpp | 8 ++++++++ src/libcamera/request.cpp | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h index 7e96100b6c..466ddc1b73 100644 --- a/include/libcamera/internal/framebuffer.h +++ b/include/libcamera/internal/framebuffer.h @@ -19,6 +19,8 @@ namespace libcamera { +class Stream; + class FrameBuffer::Private : public Extensible::Private { LIBCAMERA_DECLARE_PUBLIC(FrameBuffer) @@ -39,6 +41,8 @@ public: FrameMetadata &metadata() { return metadata_; } + const Stream *stream_ = nullptr; + private: std::vector planes_; FrameMetadata metadata_; diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp index 4f23df6482..baa298a8e3 100644 --- a/src/libcamera/framebuffer.cpp +++ b/src/libcamera/framebuffer.cpp @@ -232,6 +232,14 @@ FrameBuffer::Private::~Private() * \brief Retrieve the dynamic metadata * \return Dynamic metadata for the frame contained in the buffer */ + +/** + * \var FrameBuffer::Private::stream_ + * \brief The Stream the buffer belongs to + * + * This member designates the Stream of the Camera that the buffer belongs + * to at the moment. + */ #endif /* __DOXYGEN_PUBLIC__ */ /** diff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp index b1a81e36ef..278d993445 100644 --- a/src/libcamera/request.cpp +++ b/src/libcamera/request.cpp @@ -107,10 +107,13 @@ bool Request::Private::completeBuffer(FrameBuffer *buffer) Request *request = LIBCAMERA_O_PTR(); camera_->bufferCompleted.emit(request, buffer); + ASSERT(request->findBuffer(buffer->_d()->stream_) == buffer); + int ret = pending_.erase(buffer); ASSERT(ret == 1); buffer->_d()->setRequest(nullptr); + buffer->_d()->stream_ = nullptr; if (buffer->metadata().status == FrameMetadata::FrameCancelled) cancelled_ = true; @@ -147,6 +150,7 @@ void Request::Private::doCancelRequest() buffer->_d()->cancel(); camera_->bufferCompleted.emit(request, buffer); buffer->_d()->setRequest(nullptr); + buffer->_d()->stream_ = nullptr; } cancelled_ = true; @@ -495,6 +499,7 @@ int Request::addBuffer(const Stream *stream, FrameBuffer *buffer, } buffer->_d()->setRequest(this); + buffer->_d()->stream_ = stream; _d()->pending_.insert(buffer); if (fence && fence->isValid())