From patchwork Tue Sep 28 12:25:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13965 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 0A8E4C3243 for ; Tue, 28 Sep 2021 12:24:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4BEA76918D; Tue, 28 Sep 2021 14:24:34 +0200 (CEST) Received: from relay12.mail.gandi.net (relay12.mail.gandi.net [217.70.178.232]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2149469185 for ; Tue, 28 Sep 2021 14:24:33 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by relay12.mail.gandi.net (Postfix) with ESMTPSA id A82D6200013; Tue, 28 Sep 2021 12:24:32 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 28 Sep 2021 14:25:14 +0200 Message-Id: <20210928122515.28034-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 0/1] 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. v3: - Squash the two patches in one - Set acquire_fence = -1 in post-processor - Correct handling of buffer status in CameraDevice::requestCompleted() v2: - Handle ::Internal stream type and shuffle the patch order as suggested by Hiro. Jacopo Mondi (1): android: Wait on fences in CameraStream::process() src/android/camera_device.cpp | 39 +++++++++++++++++++++++---- src/android/camera_stream.cpp | 50 +++++++++++++++++++++++++++++++++-- src/android/camera_stream.h | 4 ++- 3 files changed, 85 insertions(+), 8 deletions(-) --- 2.32.0