From patchwork Tue Oct 6 16:06:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 9983 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 DC128BEEE0 for ; Tue, 6 Oct 2020 16:02:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4A51663C57; Tue, 6 Oct 2020 18:02:45 +0200 (CEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B956260363 for ; Tue, 6 Oct 2020 18:02:43 +0200 (CEST) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 133301BF215; Tue, 6 Oct 2020 16:02:42 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 6 Oct 2020 18:06:35 +0200 Message-Id: <20201006160637.29841-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [libcamera-devel] [RFC 0/2] android: Introduce CameraWorker 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" This two small patches, sent as RFC mostly for comments on the design, implement a worker in the libcamera HAL that is used to handle synchronization fences before queueing a Request to the libcamera::Camera. The camera framework provides, for each buffer part of a capture request an acquisition fence the camera HAL is supposed to wait on before using the buffer. The wait procedure cannot be performed in the Camera HAL thread, as the HAL runs in the global CameraManager thread. As fences are handled through a simple poll, it would be possible to install a Notifier for each fence and handle their completion through a Signal in the CameraDevice. Although this would make the class over-complicated. Introducing a worker that synchronously waits on fences using its own thread is a cleaner design a provides a cleaner interface for the CameraDevice. The waitFence() function implementes the same mechanism as the libdrm provided sync_wait() function without introducing an explicit dependency in libcamera. Jacopo Mondi (2): android: camera_worker: Introduce CameraWorker android: camera_device: Queue request to Worker src/android/camera_device.cpp | 21 ++++------ src/android/camera_device.h | 3 ++ src/android/camera_worker.cpp | 67 +++++++++++++++++++++++++++++++ src/android/camera_worker.h | 75 +++++++++++++++++++++++++++++++++++ src/android/meson.build | 1 + 5 files changed, 154 insertions(+), 13 deletions(-) create mode 100644 src/android/camera_worker.cpp create mode 100644 src/android/camera_worker.h --- 2.28.0