From patchwork Tue Sep 7 19:56:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13749 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 A3624BDC71 for ; Tue, 7 Sep 2021 19:57:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1FE426916C; Tue, 7 Sep 2021 21:57:19 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="lJmHIs2f"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 18B5160251 for ; Tue, 7 Sep 2021 21:57:18 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.2]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E1B22499; Tue, 7 Sep 2021 21:57:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631044637; bh=rOaD/dBOfE8B71S3ZxxDEnUeY6LqIQ7vSRtzmVu8T00=; h=From:To:Cc:Subject:Date:From; b=lJmHIs2fmOIgsOnlmfsHKPptTHAmXZRnFaoLgtNPOIYIE32qRPkINqn1xOGqGZvAa i/lAgmq1csvpsuDeMaJiuxbCxVJtPQuuMGlZRInxFUtxA1ijRGr/eRKfzQZXaU2Pfk BS+QaFkGEMnYijvD5xsogV3MDCGMPeWTqA2tr7+g= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Wed, 8 Sep 2021 01:26:58 +0530 Message-Id: <20210907195704.338079-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 0/6] Async post-processor 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 series aims to enable async post-processing of streams in the HAL layer. Patch (1,2,3)/6 introduces basic plumbing with respect to signals. The signals notify about the post-processing status to upper layers, based on which slots in upper layers can send back results(or errors) to framework. Patch 4/6 adds a queue and slot to signal introduced in previous patches. Signals are emitted for post-processing completion and capture results are added to queue if there is a request for post-processing. The queue ensures we send back capture results in order, to the framework. This patch also saves the context(as part of Camera3RequestDescriptor) while queuing so that, we can ressurect all the context information again, when we actually send back capture results to the framework. Uptill this point, the post-processing still runs synchrously i.e. status quo is maintained as per master. Patch 5/6 and 6/6 brings in a new Thread to run the post-processor, which actually makes the post-processor run async. --- Testing: post-processor-jpeg runs in a separate thread and saves an image on shutter-click. Streaming of image data continues as usual. Multiple shutter-click with reasonable gap(one-ish shutter-click per second) saves image as expected. However, if you become a woodpecker with the shutter button, you might be able to see https://paste.debian.net/1210728/. Kieran and I will be looking into it. There seems a current breakage of camera service with CTS on master. I'll keep an eye and will try to get CTS results with this series, once fixed. --- Umang Jain (6): android: camera_stream: Pass FrameBuffer pointer instead of reference android: post_processor: Notify post processing completion status android: camera_stream: Notify process() status with a Signal android: camera_device: Add a queue for sending capture results android: camera_device: Move buffer mapping for post-processing android: camera_stream: Run post-processor in a separate thread src/android/camera_device.cpp | 149 +++++++++++++++++++++-- src/android/camera_device.h | 28 +++++ src/android/camera_stream.cpp | 39 +++--- src/android/camera_stream.h | 43 ++++++- src/android/jpeg/encoder.h | 2 +- src/android/jpeg/encoder_libjpeg.cpp | 4 +- src/android/jpeg/encoder_libjpeg.h | 2 +- src/android/jpeg/post_processor_jpeg.cpp | 11 +- src/android/jpeg/post_processor_jpeg.h | 4 +- src/android/jpeg/thumbnailer.cpp | 4 +- src/android/jpeg/thumbnailer.h | 2 +- src/android/post_processor.h | 10 +- src/android/yuv/post_processor_yuv.cpp | 22 ++-- src/android/yuv/post_processor_yuv.h | 4 +- 14 files changed, 272 insertions(+), 52 deletions(-)