From patchwork Mon Jan 25 07:14:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 10985 X-Patchwork-Delegate: paul.elder@ideasonboard.com 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 622AEC0F2B for ; Mon, 25 Jan 2021 07:15:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2E1D3682B5; Mon, 25 Jan 2021 08:15:12 +0100 (CET) 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="o0VFO2JW"; 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 40A4F682A0 for ; Mon, 25 Jan 2021 08:15:11 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5F1E83E; Mon, 25 Jan 2021 08:15:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1611558911; bh=fEHYRnVKDxIJ3DteNfKAKKIz9m8zVBI5LbT43da0sek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o0VFO2JWWHk4caT2SaCGWLVdqTewhT9/oiulaHuNfAyy4hXuO7oMSebUBs77z9Rus MLkB3qH9ZflfT8H2ZkU1Ge3ElQddNCL4ATkzDcUzUSmxhUOlW2WHrR0HoXysB8/IqB gfyJLLMOM8EvYzHlE2peb3BlSXDzSPxQ1MuvajN0= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 25 Jan 2021 16:14:43 +0900 Message-Id: <20210125071444.26252-8-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210125071444.26252-1-paul.elder@ideasonboard.com> References: <20210125071444.26252-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 7/8] android: camera_device: Cache request metadata 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" The settings in an android capture request may be null, in which case the settings from the most recently submitted capture request should be used. Cache the request settings to achieve this. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- Changes in v4: - use default CameraMetadata constructor for lastSettings_ (so no initialization in CameraDevice constructor) - add todo for incremental caching of android request settings Changes in v3: - rebase on "android: camera device and metatada improvements", so it's a bit cleaner New in v2 --- src/android/camera_device.cpp | 6 +++++- src/android/camera_device.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 3068f89f..9330db39 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1688,9 +1688,13 @@ int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Reques * The descriptor and the associated memory reserved here are freed * at request complete time. */ - /* \todo Handle null request settings */ Camera3RequestDescriptor *descriptor = new Camera3RequestDescriptor(camera_.get(), camera3Request); + /* \todo Set cache incrementally? */ + if (camera3Request->settings) + lastSettings_ = camera3Request->settings; + else + descriptor->settings_ = lastSettings_; LOG(HAL, Debug) << "Queueing Request to libcamera with " << descriptor->numBuffers_ << " HAL streams"; diff --git a/src/android/camera_device.h b/src/android/camera_device.h index 058a3f9a..fa4fb544 100644 --- a/src/android/camera_device.h +++ b/src/android/camera_device.h @@ -134,6 +134,8 @@ private: int orientation_; unsigned int maxJpegBufferSize_; + + CameraMetadata lastSettings_; }; #endif /* __ANDROID_CAMERA_DEVICE_H__ */