{"id":14671,"url":"https://patchwork.libcamera.org/api/1.1/patches/14671/?format=json","web_url":"https://patchwork.libcamera.org/patch/14671/","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":"<20211120111313.106621-4-jacopo@jmondi.org>","date":"2021-11-20T11:13:04","name":"[libcamera-devel,v2,03/12] libcamera: framebuffer: private: Add Fence","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"7b63faea9d735627ccb8ac560437420a2923ac6b","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/14671/mbox/","series":[{"id":2739,"url":"https://patchwork.libcamera.org/api/1.1/series/2739/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2739","date":"2021-11-20T11:13:01","name":"libcamera: Add support for Fence","version":2,"mbox":"https://patchwork.libcamera.org/series/2739/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/14671/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/14671/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 CB839BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 20 Nov 2021 11:12:28 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 96DED60442;\n\tSat, 20 Nov 2021 12:12:28 +0100 (CET)","from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6F5C960378\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 20 Nov 2021 12:12:24 +0100 (CET)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 05BC2100002;\n\tSat, 20 Nov 2021 11:12:23 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Sat, 20 Nov 2021 12:13:04 +0100","Message-Id":"<20211120111313.106621-4-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.33.1","In-Reply-To":"<20211120111313.106621-1-jacopo@jmondi.org>","References":"<20211120111313.106621-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v2 03/12] libcamera: framebuffer: private:\n\tAdd Fence","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":"Add to the FrameBuffer::Private class a uniquely owned Fence instance.\n\nThe Fence will be used to signal the availability of the Framebuffer to\nincoming data transfer.\n\nAdd a set of function to set, cancel and retrieve a refence to the\nFence.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n include/libcamera/framebuffer.h          |  3 +++\n include/libcamera/internal/framebuffer.h |  9 ++++++++\n src/libcamera/framebuffer.cpp            | 26 ++++++++++++++++++++++++\n 3 files changed, 38 insertions(+)","diff":"diff --git a/include/libcamera/framebuffer.h b/include/libcamera/framebuffer.h\nindex 7f2f176af691..aa2a1f5193c7 100644\n--- a/include/libcamera/framebuffer.h\n+++ b/include/libcamera/framebuffer.h\n@@ -19,6 +19,7 @@\n \n namespace libcamera {\n \n+class Fence;\n class Request;\n \n struct FrameMetadata {\n@@ -66,6 +67,8 @@ public:\n \tunsigned int cookie() const { return cookie_; }\n \tvoid setCookie(unsigned int cookie) { cookie_ = cookie; }\n \n+\tFence *fence() const;\n+\n \tvoid cancel() { metadata_.status = FrameMetadata::FrameCancelled; }\n \n private:\ndiff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h\nindex cd33c295466e..9e1699a6875d 100644\n--- a/include/libcamera/internal/framebuffer.h\n+++ b/include/libcamera/internal/framebuffer.h\n@@ -7,10 +7,14 @@\n #ifndef __LIBCAMERA_INTERNAL_FRAMEBUFFER_H__\n #define __LIBCAMERA_INTERNAL_FRAMEBUFFER_H__\n \n+#include <memory>\n+\n #include <libcamera/base/class.h>\n \n #include <libcamera/framebuffer.h>\n \n+#include <libcamera/internal/fence.h>\n+\n namespace libcamera {\n \n class FrameBuffer::Private : public Extensible::Private\n@@ -23,8 +27,13 @@ public:\n \tvoid setRequest(Request *request) { request_ = request; }\n \tbool isContiguous() const { return isContiguous_; }\n \n+\tvoid setFence(std::unique_ptr<Fence> &&fence) { fence_ = std::move(fence); }\n+\tvoid closeFence() { fence_.reset(); }\n+\tFence *fence() const { return fence_.get(); }\n+\n private:\n \tRequest *request_;\n+\tstd::unique_ptr<Fence> fence_;\n \tbool isContiguous_;\n };\n \ndiff --git a/src/libcamera/framebuffer.cpp b/src/libcamera/framebuffer.cpp\nindex 337ea1155a38..63c4ce6ab450 100644\n--- a/src/libcamera/framebuffer.cpp\n+++ b/src/libcamera/framebuffer.cpp\n@@ -126,6 +126,23 @@ FrameBuffer::Private::Private()\n  * handlers, it is called by the pipeline handlers themselves.\n  */\n \n+/**\n+ * \\fn FrameBuffer::Private::setFence()\n+ * \\brief Set the synchronization fence for this buffer\n+ * \\param[in] fence The synchronization fence\n+ */\n+\n+/**\n+ * \\fn FrameBuffer::Private::closeFence()\n+ * \\brief Close the synchronization fence for this buffer\n+ */\n+\n+/**\n+ * \\fn FrameBuffer::Private::fence()\n+ * \\brief Retrieve a pointer to the synchronization fence of this buffer\n+ * \\return A pointer to the buffer fence, nullptr if the buffer has not fence\n+ */\n+\n /**\n  * \\fn FrameBuffer::Private::isContiguous()\n  * \\brief Check if the frame buffer stores planes contiguously in memory\n@@ -305,6 +322,15 @@ Request *FrameBuffer::request() const\n  * libcamera core never modifies the buffer cookie.\n  */\n \n+/**\n+ * \\brief Retrieve a reference to the Fence associated with this Framebuffer\n+ * \\return A pointer to the Fence, if set, nullptr otherwise\n+ */\n+Fence *FrameBuffer::fence() const\n+{\n+\treturn _d()->fence();\n+}\n+\n /**\n  * \\fn FrameBuffer::cancel()\n  * \\brief Marks the buffer as cancelled\n","prefixes":["libcamera-devel","v2","03/12"]}