From patchwork Fri Sep 24 17:02:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13927 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 55768BF01C for ; Fri, 24 Sep 2021 17:01:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 87BF76918A; Fri, 24 Sep 2021 19:01:52 +0200 (CEST) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 975EC687DD for ; Fri, 24 Sep 2021 19:01:50 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 18210240006; Fri, 24 Sep 2021 17:01:49 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 24 Sep 2021 19:02:32 +0200 Message-Id: <20210924170234.152783-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 0/2] android: Wait on acquisition fences in CameraStream 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" An acquisition fence is associated to each camera3_stream_buffer_t part of a capture request. Streams generated by libcamera (Type::Direct) are queued to the libcamera::Camera and their fences are waited on by the CameraWorker class. Acquisition fences for Streams generated by post-processing have been so far ignored and the fence was not closed, resulting in a leak that crashed the camera service with: FATAL FileDescriptor file_descriptor.cpp:265 Failed to dup() fd: Too many open files Fix this by instrumenting CameraStream to handle fences in the process() function. This is a temporary workaround until libcamera is not instrumented with a mechanism to handle fences internally. Thanks j Jacopo Mondi (2): android: wait on fences in CameraStream::process() android: Post-pone fences reset in result src/android/camera_device.cpp | 46 +++++++++++++++++++++++----------- src/android/camera_stream.cpp | 47 ++++++++++++++++++++++++++++++++++- src/android/camera_stream.h | 4 ++- 3 files changed, 81 insertions(+), 16 deletions(-) --- 2.32.0