From patchwork Fri Oct 9 13:39:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 10038 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 B2B21BEEE0 for ; Fri, 9 Oct 2020 13:36:28 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5A15660730; Fri, 9 Oct 2020 15:36:28 +0200 (CEST) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 52F5360358 for ; Fri, 9 Oct 2020 15:36:27 +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 relay9-d.mail.gandi.net (Postfix) with ESMTPSA id CC0C2FF80E; Fri, 9 Oct 2020 13:36:26 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 9 Oct 2020 15:39:54 +0200 Message-Id: <20201009133956.77396-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 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 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 camera service thread. The CameraWorker::Worker::waitFence() function implementes the same mechanism as the libdrm provided sync_wait() function without introducing an explicit dependency in libcamera. Compared to the RFC version the following has changed: - Add a start()/stop() function to start and stop the Worker thread and call them from the CameraDevice at Camera::stop() and Camera::start() time - Add CaptureRequest::queue(Camera *camera) and CaptureRequest::fences() methods to remove friend statement in CaptureRequest - Add more context to 1/2 commit message Rework will be needed to rebase on the reusable Request patch. Thanks j Jacopo Mondi (2): android: camera_worker: Introduce CameraWorker android: camera_device: Queue request to Worker src/android/camera_device.cpp | 19 ++++---- src/android/camera_device.h | 3 ++ src/android/camera_worker.cpp | 88 +++++++++++++++++++++++++++++++++++ src/android/camera_worker.h | 73 +++++++++++++++++++++++++++++ src/android/meson.build | 1 + 5 files changed, 174 insertions(+), 10 deletions(-) create mode 100644 src/android/camera_worker.cpp create mode 100644 src/android/camera_worker.h --- 2.28.0