From patchwork Tue May 5 08:23:10 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: 26632 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 38113BDCB5 for ; Tue, 5 May 2026 08:23:16 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D80446301E; Tue, 5 May 2026 10:23:14 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rTrwcIIC"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4ACA062010 for ; Tue, 5 May 2026 10:23:13 +0200 (CEST) Received: from pb-laptop.local (185.221.140.217.nat.pool.zt.hu [185.221.140.217]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BDF1AC71 for ; Tue, 5 May 2026 10:23:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1777969390; bh=2dueRvIDcNFrXhqITo8J26f6nOm7UZc+iSzx2ZHVzj0=; h=From:To:Subject:Date:From; b=rTrwcIICUEbmUaDXMSF4zAlWZH5FFk+dREDXRX/Yd0wnFYYuD9285PClXJbi2NkNm kZsq+6CTwnlyKIAI9zRYRAVRdxogZzVaJxej9r4jh0oHCwduhtFvQbRvtHVb+lue+n yrbOyIoratJcbNHMlyc1LO9Hqh1qJ6XoXBZ4HHz8= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org Subject: [PATCH v1] libcamera: framebuffer: Reword documentation about cookie Date: Tue, 5 May 2026 10:23:10 +0200 Message-ID: <20260505082310.604873-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.54.0 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" First of all, move most of the documentation next to the `setCookie()` function to have it in a single place. Secondly, make it clear that applications using a `FrameBufferAllocator` are considered to be owners of the allocated FrameBuffer objects, and they may freely manage the cookies of those frame buffers. Closes: https://gitlab.freedesktop.org/camera/libcamera/-/work_items/331 Signed-off-by: Barnabás Pőcze --- src/libcamera/framebuffer.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) -- 2.54.0 diff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp index 765dab95a..acf5b5b33 100644 --- a/src/libcamera/framebuffer.cpp +++ b/src/libcamera/framebuffer.cpp @@ -236,12 +236,6 @@ FrameBuffer::Private::~Private() * during the processing of a queued capture request, and is valid from the * completion of the buffer as signaled by Camera::bufferComplete() until the * FrameBuffer is either reused in a new request or deleted. - * - * The creator of a FrameBuffer (application, IPA or pipeline handler) may - * associate to it an integer cookie for any private purpose. The cookie may be - * set when creating the FrameBuffer, and updated at any time with setCookie(). - * The cookie is transparent to the libcamera core and shall only be set by the - * creator of the FrameBuffer. This mechanism supplements the Request cookie. */ /** @@ -399,12 +393,7 @@ const FrameMetadata &FrameBuffer::metadata() const /** * \brief Retrieve the cookie - * - * The cookie belongs to the creator of the FrameBuffer, which controls its - * lifetime and value. - * * \sa setCookie() - * * \return The cookie */ uint64_t FrameBuffer::cookie() const @@ -416,10 +405,23 @@ uint64_t FrameBuffer::cookie() const * \brief Set the cookie * \param[in] cookie Cookie to set * - * The cookie belongs to the creator of the FrameBuffer. Its value may be - * modified at any time with this function. Applications and IPAs shall not - * modify the cookie value of buffers they haven't created themselves. The - * libcamera core never modifies the buffer cookie. + * The creator (and only the creator) of the FrameBuffer may store an arbitrary + * 64-bit integer value in the FrameBuffer, this value is called the cookie. + * It may be retrieved or set at any time, and is guaranteed not to be modified + * by the libcamera core. This mechanism is similar to the \ref Request cookie. + * + * An application using a \ref FrameBufferAllocator is considered to be the creator + * of the allocated FrameBuffer objects, and thus it may manage the cookie as it + * sees fit. + * + * \internal + * Similar rules apply to pipeline handlers and IPA modules, that is, they can only + * manage the cookies of FrameBuffer objects that they have created, with the exception + * that any FrameBuffer returned by \ref PipelineHandler::exportFrameBuffers() is considered + * to have been created by the application, and thus its cookie shall not be modified. + * \endinternal + * + * \sa cookie() */ void FrameBuffer::setCookie(uint64_t cookie) {