From patchwork Mon Dec 20 23:26:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 15172 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 CC09CC3258 for ; Mon, 20 Dec 2021 23:26:47 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6CC28608F8; Tue, 21 Dec 2021 00:26:47 +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="BsIrXDOc"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1976A60868 for ; Tue, 21 Dec 2021 00:26:45 +0100 (CET) Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6BE04FD7; Tue, 21 Dec 2021 00:26:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1640042804; bh=5ShqKvB4tAmbmPpPVg2CCf6TooLNTQlMBVt2nKauTmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BsIrXDOcsFcSXZyu8qbbweyfXzu/ivPgZcDcWmoVq4BTuyoS9EJOb45lCWcP/OECD EPWNrk5X2h87c+RSyYu4dQsF3VH5DQaKEvXApwRKEtdEaBegfGW3DjKS6c+qbf6knM j8mLxQkvq/FQ9/OoU73qV6fQoBEvywAIMISB6Ils= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Dec 2021 17:26:24 -0600 Message-Id: <20211220232629.1485890-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211220232629.1485890-1-paul.elder@ideasonboard.com> References: <20211220232629.1485890-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/6] android: camera_capabilities: Add messages for lack of FULL support 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" Print messages when some feature is missing that causes hardware level FULL to not be supported. Signed-off-by: Paul Elder Reviewed-by: Jacopo Mondi Reviewed-by: Umang Jain --- src/android/camera_capabilities.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index c4c26089..6ae2cd4d 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -359,6 +359,9 @@ void CameraCapabilities::computeHwLevel( { camera_metadata_ro_entry_t entry; bool found; + + const char *noFull = "Hardware level FULL unavailable: "; + camera_metadata_enum_android_info_supported_hardware_level hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_FULL; @@ -372,8 +375,10 @@ void CameraCapabilities::computeHwLevel( hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED; found = staticMetadata_->getEntry(ANDROID_SYNC_MAX_LATENCY, &entry); - if (!found || *entry.data.i32 != 0) + if (!found || *entry.data.i32 != 0) { + LOG(HAL, Info) << noFull << "missing or invalid max sync latency"; hwLevel = ANDROID_INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED; + } hwLevel_ = hwLevel; } From patchwork Mon Dec 20 23:26:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 15173 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 B5980BE080 for ; Mon, 20 Dec 2021 23:26:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CC76A608A2; Tue, 21 Dec 2021 00:26:47 +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="Gq7Os8lB"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 679A960868 for ; Tue, 21 Dec 2021 00:26:46 +0100 (CET) Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 531BA881; Tue, 21 Dec 2021 00:26:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1640042806; bh=cM+1AIJ2vM69L80j+c++pEO03MKvd7KsedbCkZuR86E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gq7Os8lBYtPt1GyyWoLyoIqFgdJhtOaV8YYaN6vBmUDofNYK+GOF5MKtIIJ/LOIF1 0xiu6Dj1sTEC4cylOUNcuTjJEZLkyRjDTk1gfiIkIUTgWbzUsPM0wrUsOA64ZIX1rS udik+Xff9oXUM5YpX908v+1SWj6Xv07KfQh3xIC4= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Dec 2021 17:26:25 -0600 Message-Id: <20211220232629.1485890-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211220232629.1485890-1-paul.elder@ideasonboard.com> References: <20211220232629.1485890-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 2/6] android: camera_capabilities: Set read sensor settings capability 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" A libcamera camera that supports the manual sensor capability also satisfies all the requirements for the read sensor settings capability. Set it. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/android/camera_capabilities.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index 6ae2cd4d..6d383486 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -339,8 +339,11 @@ CameraCapabilities::computeCapabilities() capabilities.insert(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE); - if (validateManualSensorCapability()) + if (validateManualSensorCapability()) { capabilities.insert(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR); + /* The libcamera requirements cover this */ + capabilities.insert(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS); + } if (validateManualPostProcessingCapability()) capabilities.insert(ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING); From patchwork Mon Dec 20 23:26:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 15174 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 9AF7ABE080 for ; Mon, 20 Dec 2021 23:26:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 53BAF608E7; Tue, 21 Dec 2021 00:26:51 +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="ZwI9Bu0g"; 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 89482608F9 for ; Tue, 21 Dec 2021 00:26:47 +0100 (CET) Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7640EFD7; Tue, 21 Dec 2021 00:26:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1640042807; bh=EWvzbnAHQgmUJOa2+xZog7a/Z1C7NG0LPoqsKdrDNVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZwI9Bu0gJyNaVDn6AeSOq+Itprzb3o/5ZBReXwF44vonsu41c9v1FTdcuYP9s3t6Z nKZt6FBRNXisWjnhX4i8+9f+dweJfp/kkCZ3nAg31Rve49gk9dUHicymkqWymaWkFV i/YJfdEKnNKl+sr0t/EAhrdawphi6sPgOkhPjHW8= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Dec 2021 17:26:26 -0600 Message-Id: <20211220232629.1485890-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211220232629.1485890-1-paul.elder@ideasonboard.com> References: <20211220232629.1485890-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/6] android: camera_metadata: Add appendEntry helper 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" Add appendEntry() helper, that automatically detects if updateEntry() or addEntry() should be used. Note that updateEntry() will fail if the entry was not yet added, and addEntry() will fail is the entry was already added. They are silent failures that cause unexpected values to find their way into the android metadata instance. Previously this helper was not necessary, as (with respect to the current use case) the preview template generator would always add a key so the other template generators that used the preview template as boilerplate could reliably use updateEntry(). The preview template generator will soon decide based on capabilities whether or not to add keys, so the other template generators need a helper to decide whether to use updateEntry() or addEntry(). For now only implement it for enums and arithmetic values, as they will mainly be used in populating templates. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- Changes in v2: - expand on correctness of updateEntry() vs addEntry(), and the rationale for the patch --- src/android/camera_metadata.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/android/camera_metadata.h b/src/android/camera_metadata.h index e70f60af..f3b7c91e 100644 --- a/src/android/camera_metadata.h +++ b/src/android/camera_metadata.h @@ -33,6 +33,17 @@ public: bool hasEntry(uint32_t tag) const; + template || + std::is_enum_v> * = nullptr> + bool appendEntry(uint32_t tag, const T &data) + { + if (hasEntry(tag)) + return updateEntry(tag, &data, 1, sizeof(T)); + else + return addEntry(tag, &data, 1, sizeof(T)); + } + template || std::is_enum_v> * = nullptr> From patchwork Mon Dec 20 23:26:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 15175 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 2BE19C3258 for ; Mon, 20 Dec 2021 23:26:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D128F60868; Tue, 21 Dec 2021 00:26:51 +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="dfZDLG0L"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CEC64608E8 for ; Tue, 21 Dec 2021 00:26:48 +0100 (CET) Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A864D881; Tue, 21 Dec 2021 00:26:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1640042808; bh=iKjn8F9UvwcJvxXbq7jwKuFTXg0el1XgzXjdOKTgIm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dfZDLG0LVnmYk0zcaTwkDzprri2/byT+h16HUTU4O+Qzm59gmZzb8CnpO+EcDdKg8 egoogupWSezaH82J4bgjSkdHCo6TUi7xEyj5Kqo1obfU//JBUH/E62CwRrZyzYft5Q h6uVaFHpZ5vNF6FLrQ0+e3zlksE2sAzEGLVeW4P0= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Dec 2021 17:26:27 -0600 Message-Id: <20211220232629.1485890-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211220232629.1485890-1-paul.elder@ideasonboard.com> References: <20211220232629.1485890-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/6] android: camera_capabilities: Fix the type of the capability vector 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 type of elements of the capability vector that is set in the static metadata must be uint8_t. The enum will not suffice, as it is int32_t. Fix this. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/android/camera_capabilities.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index 6d383486..ea2aaf58 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -1389,7 +1389,8 @@ int CameraCapabilities::initializeStaticMetadata() /* Check capabilities */ capabilities_ = computeCapabilities(); - std::vector + /* This *must* uint8_t. */ + std::vector capsVec(capabilities_.begin(), capabilities_.end()); staticMetadata_->addEntry(ANDROID_REQUEST_AVAILABLE_CAPABILITIES, capsVec); From patchwork Mon Dec 20 23:26:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 15176 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 917B5BE080 for ; Mon, 20 Dec 2021 23:26:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4290A60900; Tue, 21 Dec 2021 00:26:53 +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="kB83+RuH"; 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 8B8C560592 for ; Tue, 21 Dec 2021 00:26:50 +0100 (CET) Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 065D7881; Tue, 21 Dec 2021 00:26:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1640042809; bh=8rD3COSOiiKGSzNYwbOlAfG9DmyFufP1nzpiA5vU9qU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kB83+RuHcameA8mSiPCWTKCA0FpBwy4ks/kUtXx225bo8CAYqeOWrWRW3aBl+D5IH 83daFUXQ9K+IFTAHW3KEt8QMhoWW/+2UpM6+kPrWoMxxUEad2bSCYqcN7pXwTXYn3Q oNcxPt4fDv2tdtHuGmkOSAecXUwfVF/ivtWtFFcA= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Dec 2021 17:26:28 -0600 Message-Id: <20211220232629.1485890-6-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211220232629.1485890-1-paul.elder@ideasonboard.com> References: <20211220232629.1485890-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 5/6] android: Increase result metadata size 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" Increase the initial size of the result metadata, as we will be adding more entries in the near future. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- src/android/camera_device.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index f28fdd6a..83825736 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1313,7 +1313,7 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons * Total bytes for JPEG metadata: 82 */ std::unique_ptr resultMetadata = - std::make_unique(44, 166); + std::make_unique(88, 166); if (!resultMetadata->isValid()) { LOG(HAL, Error) << "Failed to allocate result metadata"; return nullptr; From patchwork Mon Dec 20 23:26:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 15177 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 1F4B3C3259 for ; Mon, 20 Dec 2021 23:26:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A5011608E8; Tue, 21 Dec 2021 00:26:53 +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="noJgvEQW"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DB7D9608E8 for ; Tue, 21 Dec 2021 00:26:51 +0100 (CET) Received: from pyrite.mediacom.info (unknown [IPv6:2604:2d80:ad90:fb00:96fd:8874:873:6c16]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BBF96881; Tue, 21 Dec 2021 00:26:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1640042811; bh=+C/aKL8lVxGRY1vrIaEejDjaGTKhF+Z4JU4WvIiT0Pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=noJgvEQW38hpHAGKhy0pVziT4a56OzLin92b+5DO0LYpHxtPH2+NHIir4/f3upCku wal9XAwOqsi8iSwI83bmH10DQ6jld5tyr1y7rC42S3pdn9SpN+J+0USzBvmBYCtcff JZ4vMZ22jHsWTpCF7LxxNHqdSBMpebNxXg8aGc1A= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 20 Dec 2021 17:26:29 -0600 Message-Id: <20211220232629.1485890-7-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211220232629.1485890-1-paul.elder@ideasonboard.com> References: <20211220232629.1485890-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 6/6] android: Add CONTROL_MODE_OFF in template and static 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" Add CONTROL_MODE_OFF to the available control modes in static metadata, if both AE off and AWB off are available. Also set CONTROL_MODE_OFF in the manual template. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham --- src/android/camera_capabilities.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/android/camera_capabilities.cpp b/src/android/camera_capabilities.cpp index ea2aaf58..a2e42a5c 100644 --- a/src/android/camera_capabilities.cpp +++ b/src/android/camera_capabilities.cpp @@ -996,7 +996,17 @@ int CameraCapabilities::initializeStaticMetadata() staticMetadata_->addEntry(ANDROID_CONTROL_AWB_LOCK_AVAILABLE, awbLockAvailable); - char availableControlModes = ANDROID_CONTROL_MODE_AUTO; + /* + * \todo Get this from some combination of the available AE and AWB + * modes + */ + std::vector availableControlModes = { ANDROID_CONTROL_MODE_AUTO }; + if (staticMetadata_->entryContains(ANDROID_CONTROL_AE_AVAILABLE_MODES, + ANDROID_CONTROL_AE_MODE_OFF) && + staticMetadata_->entryContains(ANDROID_CONTROL_AWB_AVAILABLE_MODES, + ANDROID_CONTROL_AWB_MODE_OFF)) { + availableControlModes.push_back(ANDROID_CONTROL_MODE_OFF); + } staticMetadata_->addEntry(ANDROID_CONTROL_AVAILABLE_MODES, availableControlModes); @@ -1452,6 +1462,12 @@ std::unique_ptr CameraCapabilities::requestTemplateManual() cons if (!manualTemplate) return nullptr; + if (staticMetadata_->entryContains(ANDROID_CONTROL_AVAILABLE_MODES, + ANDROID_CONTROL_MODE_OFF)) { + uint8_t mode = ANDROID_CONTROL_MODE_OFF; + manualTemplate->appendEntry(ANDROID_CONTROL_MODE, mode); + } + return manualTemplate; }