From patchwork Mon Sep 27 21:36:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13956 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 A891FBDC71 for ; Mon, 27 Sep 2021 21:36:18 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 115306918E; Mon, 27 Sep 2021 23:36:18 +0200 (CEST) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8F2D96012C for ; Mon, 27 Sep 2021 23:36:16 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 150B2C0002; Mon, 27 Sep 2021 21:36:15 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 27 Sep 2021 23:36:58 +0200 Message-Id: <20210927213700.25365-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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. v2: - Handle ::Internal stream type and shuffle the patch order as suggested by Hiro. Jacopo Mondi (2): android: Post-pone fences reset in capture result android: Wait on fences in CameraStream::process() src/android/camera_device.cpp | 50 ++++++++++++++++++++++++----------- src/android/camera_stream.cpp | 48 +++++++++++++++++++++++++++++++-- src/android/camera_stream.h | 4 ++- 3 files changed, 84 insertions(+), 18 deletions(-) --- 2.32.0