From patchwork Fri Aug 27 07:47:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 13534 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 C7429BD87C for ; Fri, 27 Aug 2021 07:46:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 2B8BC68932; Fri, 27 Aug 2021 09:46:34 +0200 (CEST) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E03B668891 for ; Fri, 27 Aug 2021 09:46:32 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 1377520008; Fri, 27 Aug 2021 07:46:31 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 27 Aug 2021 09:47:15 +0200 Message-Id: <20210827074715.65537-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] android: Refuse Manual template if not supported 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" If the camera devices does not support the MANUAL_SENSOR capabilities there is no point in generating a request template for the Manual capture use case. This change fixes CTS tests android.hardware.camera2.cts.CameraDeviceTest#testCameraDeviceManualTemplate android.hardware.camera2.cts.NativeCameraDeviceTest#testCameraDeviceCreateCaptureRequest For devices that do not support MANUAL_SENSOR capabilities. Signed-off-by: Jacopo Mondi Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart --- src/android/camera_capabilities.cpp | 12 ++++++++---- src/android/camera_capabilities.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index bd661675c7cc..c16e755f4695 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -1271,13 +1271,12 @@ int CameraCapabilities::initializeStaticMetadata() numOutStreams); /* Check capabilities */ - std::set - capabilities = computeCapabilities(); + capabilities_ = computeCapabilities(); std::vector - capsVec(capabilities.begin(), capabilities.end()); + capsVec(capabilities_.begin(), capabilities_.end()); staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CAPABILITIES, capsVec); - computeHwLevel(capabilities); + computeHwLevel(capabilities_); staticMetadata_->addEntry(ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL, hwLevel_); LOG(HAL, Info) @@ -1326,6 +1325,11 @@ PixelFormat CameraCapabilities::toPixelFormat(int format) const std::unique_ptr CameraCapabilities::requestTemplateManual() const { + if (!capabilities_.count(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR)) { + LOG(HAL, Error) << "Manual template not supported"; + return nullptr; + } + std::unique_ptr manualTemplate = requestTemplatePreview(); if (!manualTemplate) return nullptr; diff --git a/src/android/camera_capabilities.h b/src/android/camera_capabilities.h index 576f1e7c7b46..a12596993ee5 100644 --- a/src/android/camera_capabilities.h +++ b/src/android/camera_capabilities.h @@ -70,6 +70,7 @@ private: int orientation_; bool rawStreamAvailable_; camera_metadata_enum_android_info_supported_hardware_level hwLevel_; + std::set capabilities_; std::vector streamConfigurations_; std::map formatsMap_;