{"id":27129,"url":"https://patchwork.libcamera.org/api/patches/27129/?format=json","web_url":"https://patchwork.libcamera.org/patch/27129/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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-52-barnabas.pocze@ideasonboard.com>","date":"2026-06-29T16:30:14","name":"[RFC,v1,51/54] android: camera_device: Move fence restoration into `prepareToReturn()`","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"df7c5a3fee95cc4e638501b6e97ef4eed12ea151","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/?format=json","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27129/mbox/","series":[{"id":6025,"url":"https://patchwork.libcamera.org/api/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/27129/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27129/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 111CEC3303\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 29 Jun 2026 16:31:42 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CDE6A65FC3;\n\tMon, 29 Jun 2026 18:31:41 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D483A65F75\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2026 18:30:33 +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 ACF3E1044\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 29 Jun 2026 18:29:50 +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=\"X2SGzmWb\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1782750590;\n\tbh=XKl2eO1QWEXdNrfLES9PG0IyEzsv415hXcC0a7vSego=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=X2SGzmWberaZBNnyg+iQhlIQPEADpozfybXnn0qFXaW1W/kkFsc+SnH3cDeaChgca\n\tE2PEus6OKn36N9iLhGH6SJFVtSf4y4RQ3jpJdcW3C5//cT08tWedkt2tFi2Z3H4dW4\n\tYDr7ArLZZQslK2tffdV8bSwMht+8M/SomsLDyATE=","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[RFC PATCH v1 51/54] android: camera_device: Move fence restoration\n\tinto `prepareToReturn()`","Date":"Mon, 29 Jun 2026 18:30:14 +0200","Message-ID":"<20260629163017.863145-52-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":"It is sufficient to restore the fence for returning it to the camera framework\njust before the returned `camera3_stream_buffer_t` is constructed, so do that.\n\nSigned-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n---\n src/android/camera_device.cpp  | 19 +------------------\n src/android/camera_request.cpp | 13 +++++++++++++\n 2 files changed, 14 insertions(+), 18 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex 0d5b5b97eb..09aa129e0a 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -1146,25 +1146,8 @@ void CameraDevice::requestComplete(Request *request)\n \t * The buffer status is set to Success and later changed to Error if\n \t * post-processing/compression fails.\n \t */\n-\tfor (auto &buffer : descriptor->buffers_) {\n-\t\tCameraStream *stream = buffer.stream;\n-\n-\t\t/*\n-\t\t * Streams of type Direct have been queued to the\n-\t\t * libcamera::Camera and their acquire fences have\n-\t\t * already been waited on by the library.\n-\t\t *\n-\t\t * Acquire fences of streams of type Internal and Mapped\n-\t\t * will be handled during post-processing.\n-\t\t */\n-\t\tif (stream->type() == CameraStream::Type::Direct) {\n-\t\t\t/* If handling of the fence has failed restore buffer.fence. */\n-\t\t\tstd::unique_ptr<Fence> fence = buffer.frameBuffer->releaseFence();\n-\t\t\tif (fence)\n-\t\t\t\tbuffer.fence = fence->release();\n-\t\t}\n+\tfor (auto &buffer : descriptor->buffers_)\n \t\tbuffer.status = Camera3RequestDescriptor::Status::Success;\n-\t}\n \n \t/*\n \t * If the Request has failed, abort the request by notifying the error\ndiff --git a/src/android/camera_request.cpp b/src/android/camera_request.cpp\nindex feac7a3e19..6dfe692f09 100644\n--- a/src/android/camera_request.cpp\n+++ b/src/android/camera_request.cpp\n@@ -10,6 +10,7 @@\n #include <libcamera/base/span.h>\n \n #include \"camera_buffer.h\"\n+#include \"camera_stream.h\"\n \n using namespace libcamera;\n \n@@ -195,6 +196,18 @@ Camera3RequestDescriptor::StreamBuffer::operator=(Camera3RequestDescriptor::Stre\n \n camera3_stream_buffer_t Camera3RequestDescriptor::StreamBuffer::prepareToReturn()\n {\n+\t/*\n+\t * Streams of type Direct have a non-nullptr `frameBuffer` and\n+\t * have been queued to the libcamera::Camera and their acquire\n+\t * fences have already been waited on by the library.\n+\t */\n+\tif (frameBuffer) {\n+\t\t/* If handling of the fence has failed restore buffer.fence. */\n+\t\tauto f = frameBuffer->releaseFence();\n+\t\tif (f)\n+\t\t\tfence = f->release();\n+\t}\n+\n \t/*\n \t * Pass the buffer fence back to the camera framework as\n \t * a release fence. This instructs the framework to wait\n","prefixes":["RFC","v1","51/54"]}