{"id":24302,"url":"https://patchwork.libcamera.org/api/1.1/patches/24302/?format=json","web_url":"https://patchwork.libcamera.org/patch/24302/","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":"<20250910151857.1502329-1-barnabas.pocze@ideasonboard.com>","date":"2025-09-10T15:18:57","name":"[v2] libcamera: request: addBuffer(): Do not destroy fence on failure","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"5e0678f736b78ccc61f90ee59766f709d48279d5","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/24302/mbox/","series":[{"id":5428,"url":"https://patchwork.libcamera.org/api/1.1/series/5428/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5428","date":"2025-09-10T15:18:57","name":"[v2] libcamera: request: addBuffer(): Do not destroy fence on failure","version":2,"mbox":"https://patchwork.libcamera.org/series/5428/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24302/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24302/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 63B42C324E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 10 Sep 2025 15:19:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 142EC6936E;\n\tWed, 10 Sep 2025 17:19:03 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A781469357\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Sep 2025 17:19:01 +0200 (CEST)","from pb-laptop.local (185.221.142.115.nat.pool.zt.hu\n\t[185.221.142.115])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 85199928\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 10 Sep 2025 17:17:47 +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=\"fgcs67Uh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1757517467;\n\tbh=qc3Cu11i53bpW5n/pvTW7gl9yqhorVIuWRc5aNFiV5U=;\n\th=From:To:Subject:Date:From;\n\tb=fgcs67UhH9rMu1+1mFLkfE6RL1ZPwy7le/WCAxq+KO3mZtpqz4hEw5twZLwQTyEvA\n\tFCua08+xuNUj7FnVe4OzeEZBnZGg610wi0fh3RJPQstzUiUZMatcou4U2/oBBnYylr\n\t3TiSmsOPj/YSp5zmDeo3rVI4pzDox/yqwvBMaJoY=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v2] libcamera: request: addBuffer(): Do not destroy fence on\n\tfailure","Date":"Wed, 10 Sep 2025 17:18:57 +0200","Message-ID":"<20250910151857.1502329-1-barnabas.pocze@ideasonboard.com>","X-Mailer":"git-send-email 2.51.0","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":"Take the unique pointer to the `Fence` object by rvalue reference\nso that it is not destroyed if the function returns an error code\nand does not take ownership of the unique pointer.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\nchanges in v2:\n  * modify function documentation\n\nv1: https://patchwork.libcamera.org/patch/22907/\n---\n include/libcamera/request.h | 2 +-\n src/libcamera/request.cpp   | 6 ++++--\n 2 files changed, 5 insertions(+), 3 deletions(-)\n\n--\n2.51.0","diff":"diff --git a/include/libcamera/request.h b/include/libcamera/request.h\nindex e214a9d13..0c5939f7b 100644\n--- a/include/libcamera/request.h\n+++ b/include/libcamera/request.h\n@@ -53,7 +53,7 @@ public:\n \tControlList &metadata() { return *metadata_; }\n \tconst BufferMap &buffers() const { return bufferMap_; }\n \tint addBuffer(const Stream *stream, FrameBuffer *buffer,\n-\t\t      std::unique_ptr<Fence> fence = nullptr);\n+\t\t      std::unique_ptr<Fence> &&fence = {});\n \tFrameBuffer *findBuffer(const Stream *stream) const;\n\n \tuint32_t sequence() const;\ndiff --git a/src/libcamera/request.cpp b/src/libcamera/request.cpp\nindex 7f1e11e8f..26bba8f28 100644\n--- a/src/libcamera/request.cpp\n+++ b/src/libcamera/request.cpp\n@@ -452,7 +452,9 @@ void Request::reuse(ReuseFlag flags)\n  *\n  * When a valid Fence is provided to this function, \\a fence is moved to \\a\n  * buffer and this Request will only be queued to the device once the\n- * fences of all its buffers have been correctly signalled.\n+ * fences of all its buffers have been correctly signalled. Ownership of the\n+ * fence will only be taken in case of success, otherwise the fence will\n+ * be left unmodified.\n  *\n  * If the \\a fence associated with \\a buffer isn't signalled, the request will\n  * fail after a timeout. The buffer will still contain the fence, which\n@@ -468,7 +470,7 @@ void Request::reuse(ReuseFlag flags)\n  * \\retval -EINVAL The buffer does not reference a valid Stream\n  */\n int Request::addBuffer(const Stream *stream, FrameBuffer *buffer,\n-\t\t       std::unique_ptr<Fence> fence)\n+\t\t       std::unique_ptr<Fence> &&fence)\n {\n \tif (!stream) {\n \t\tLOG(Request, Error) << \"Invalid stream reference\";\n","prefixes":["v2"]}