From patchwork Fri Sep 10 07:06:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 13798 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 A91E7BDC71 for ; Fri, 10 Sep 2021 07:06:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id F3DB16916E; Fri, 10 Sep 2021 09:06:47 +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="dc18XwQA"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D747169169 for ; Fri, 10 Sep 2021 09:06:46 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.149]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8F989883; Fri, 10 Sep 2021 09:06:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1631257606; bh=9Db2plMs1VCD/58aMbRXzQKZMXAuEjm7ddEl41UfoJ0=; h=From:To:Cc:Subject:Date:From; b=dc18XwQANBtNSjESFtJwfGc1D9Ueq9xqEZpI0S132LfjLPsAiar47H7NSDs/R+se0 hEMVKngQCzVSeOYTuhjb4pgLrOMATSjuRvdr4tAzscArxho0slZq1VeuJ5W6aqvJp0 4aE+E3y/O24oU/Xy2lynoAOhwiKWV6cNCqP52jWY= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Fri, 10 Sep 2021 12:36:29 +0530 Message-Id: <20210910070638.467294-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 0/9] 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-5]/9 introduces basic plumbing preparation to run post-processing async. The idea here is to send enough information for the post-processor and retrieve it back(via signal mechanism) to complete capture results and sending it back to framework. Patch 6/9 adds a queue. When a request requires post-processing it is first added to a queue. Before queueing, a lot of context information is saved in form of Camera3RequestDescriptor struct. The struct is then pushed to the queue. When the post-processing is completed, CameraDevice::streamProcessingComplete() is called and the status of corresponding Camera3RequestDescriptor is updated(failed/succeeded). After that sendQueuedCaptureResults() inspects the queue to check if any capture results are ready to be sent to the framework. If yes, it shall send it and de-queue it from the queue. Patch 7/9 is a simple move of buffer mapping from CameraStream to CameraDevice. Patch 8/9 adds a worker class and a thread. The worker will be used to PostProcessor::process() in that thread. Patch 9/9 is a really a RFC which temporarily address one of \todo in 8/9. --- Changes in v2: - Move Camera3RequestDescriptor struct out of CameraDevice private(2/9) - Pass Camera3RequestDescriptor pointer as a context to PostProcessor class and emit it back via processComplete signal. - RFC patch (needs some discussion) --- Umang Jain (9): android: camera_stream: Pass FrameBuffer pointer instead of reference camera_device: Remove private scope of Camera3RequestDescriptor android: post_processor: Plumb down the process() with context android: post_processor: Notify post processing completion status android: camera_stream: Query post-processing status 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 RFC: Stop PostProcessor when camera is stopped src/android/camera_device.cpp | 146 +++++++++++++++++++++-- src/android/camera_device.h | 56 ++++++--- src/android/camera_stream.cpp | 47 +++++--- src/android/camera_stream.h | 57 ++++++++- 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 | 14 ++- src/android/jpeg/post_processor_jpeg.h | 7 +- src/android/jpeg/thumbnailer.cpp | 4 +- src/android/jpeg/thumbnailer.h | 2 +- src/android/post_processor.h | 15 ++- src/android/yuv/post_processor_yuv.cpp | 25 ++-- src/android/yuv/post_processor_yuv.h | 7 +- 14 files changed, 314 insertions(+), 74 deletions(-)