From patchwork Mon Oct 25 20:38:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 14294 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 B858EBF415 for ; Mon, 25 Oct 2021 20:38:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 20F2D64878; Mon, 25 Oct 2021 22:38:43 +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="p4eEtvX7"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1912860125 for ; Mon, 25 Oct 2021 22:38:42 +0200 (CEST) Received: from perceval.ideasonboard.com (unknown [103.251.226.211]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0FDC1119F; Mon, 25 Oct 2021 22:38:40 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1635194321; bh=Hn5vdi0XSUS2dUIAchy4STrdWXQzaGdtsuvG1ZEzw9w=; h=From:To:Cc:Subject:Date:From; b=p4eEtvX7SpEADGNZ/WKJdapwV+JKBypFbBxoJEMnxrGVMLeYnJShT9cPB9/pqs3uT KZkxCgM8o0x6i8oMKxtEK29e+hf43MVELiaZE4Adq+zFUNUqVfZhgmjwyZCcI1lpO8 sJJJlJmDaiesR1JcA1x6n9nlyqN4iYOdxjaLLkyc= From: Umang Jain To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Oct 2021 02:08:26 +0530 Message-Id: <20211025203833.122460-1-umang.jain@ideasonboard.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v7 0/7] 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 primarily introduces a Thread worker class along with a queue, in which request for post-process of streams are queued and processed ansychronously. All the context information is carried via Camera3RequestDescriptor. 1/7 and 2/7 are improved !nullptr checks that were spotted in previous review. 3/7 under takes a refactor of splitting Camera3RequestDescriptor::Status to denote only status(success/error). The "pending" status is de-coupled into a separate variable now. 4/7 Consolidates all the information we need to run the post-processor into Camera3RequestDescriptor::Stream. Now use this structure only and update signature of PostProcessor::process() vfunc. 5/7 Introduces a post-processing request tracking std::map and a signal of completion. The tracking map will help us to know if there are multiple post-processing streams per descriptor (i.e. capture request). If so, we need to wait, track until all streams are processed. Only then we can mark descriptor for completion. 6/7 is a small inherent patch based on 5/7's change 7/7 is where a post-processor's worker class is introduced. At this point, the post-processor will run asynchronously. Changes v6 -> v7: - Remove all local boolean flags, hasPostProcessingErrors and needPostProcessing. - Code out internal buffer placing back into camera-stream from setBufferStatus - Use map.empty() instead of map.size() == 0 - Make CameraStream::process() and PostProcessor::process() coherent - Few minor code migration from patch 5/7 to 7/7. Umang Jain (7): android: camera_stream: Replace post-processor nullptr check android: post_processor_jpeg: Replace encoder_ nullptr check android: camera_device: Refactor descriptor status and sendCaptureResults() android: post_processor: Consolidate contextual information android: Track and notify post processing of streams android: post_processor: Drop return value for process() android: post_processor: Make post processing async src/android/camera_device.cpp | 143 +++++++++++++--------- src/android/camera_device.h | 5 + src/android/camera_request.cpp | 5 +- src/android/camera_request.h | 17 ++- src/android/camera_stream.cpp | 144 ++++++++++++++++++++--- src/android/camera_stream.h | 41 ++++++- src/android/jpeg/post_processor_jpeg.cpp | 20 ++-- src/android/jpeg/post_processor_jpeg.h | 4 +- src/android/post_processor.h | 16 ++- src/android/yuv/post_processor_yuv.cpp | 21 ++-- src/android/yuv/post_processor_yuv.h | 4 +- 11 files changed, 310 insertions(+), 110 deletions(-)