From patchwork Fri Jun 18 10:33: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: 12639 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 E4CD7C3219 for ; Fri, 18 Jun 2021 10:34:12 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A9D9D68943; Fri, 18 Jun 2021 12:34:12 +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="FlwYk9+V"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E701D60298 for ; Fri, 18 Jun 2021 12:34:11 +0200 (CEST) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7C0FF3E5; Fri, 18 Jun 2021 12:34:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1624012451; bh=Co965+o+kEO4rsN9l1QBlKtc1l/sUICPybNaaYUwMTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FlwYk9+Va1vcLfIXsGJDEyCuW+dfDiwnhuW7pIF24YCfQVr8IsYhuuGchp2Ear3cY b1fswtRncNb2yC0XzuvTCWCh/R1uLBzomV/Rx8/opJsqYsfaG0pkY5TAL2tumJpSQs wJjA6S3xv1O/5wqErqaFg/HDtC0mzaBkLCFjkHoo= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Fri, 18 Jun 2021 19:33:43 +0900 Message-Id: <20210618103351.1642060-7-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210618103351.1642060-1-paul.elder@ideasonboard.com> References: <20210618103351.1642060-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [RFC PATCH 06/14] android: Plumb AeEnable control 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" Plumb the AeEnable control into the HAL for CONTROL_AE_AVAILABLE_MODES for static metadata, and CONTROL_AE_MODE for result metadata. Bug: https://bugs.libcamera.org/show_bug.cgi?id=42 Signed-off-by: Paul Elder --- src/android/camera_device.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 86f47e00..3446cdb6 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -10,6 +10,7 @@ #include "camera_ops.h" #include "post_processor.h" +#include #include #include #include @@ -877,9 +878,24 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() staticMetadata_->addEntry(ANDROID_CONTROL_AE_AVAILABLE_ANTIBANDING_MODES, aeAvailableAntiBandingModes); - std::vector aeAvailableModes = { - ANDROID_CONTROL_AE_MODE_ON, - }; + std::vector aeAvailableModes; + aeAvailableModes.reserve(2); + const auto &aeModesInfo = controlsInfo.find(&controls::AeEnable); + if (aeModesInfo != controlsInfo.end()) { + aeAvailableModes.push_back(aeModesInfo->second.min().get()); + if (aeModesInfo->second.min() != aeModesInfo->second.max()) + aeAvailableModes.push_back(aeModesInfo->second.max().get()); + } else { + aeAvailableModes.push_back(ANDROID_CONTROL_AE_MODE_ON); + } + + if (std::find(aeAvailableModes.begin(), + aeAvailableModes.end(), + ANDROID_CONTROL_AE_MODE_OFF) == aeAvailableModes.end()) { + fullSupport = false; + /* \todo Double check if this is the correct capability */ + capabilities[ANDROID_REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR] = false; + } staticMetadata_->addEntry(ANDROID_CONTROL_AE_AVAILABLE_MODES, aeAvailableModes); @@ -2333,8 +2349,10 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons value = ANDROID_CONTROL_AE_LOCK_OFF; resultMetadata->addEntry(ANDROID_CONTROL_AE_LOCK, value); - value = ANDROID_CONTROL_AE_MODE_ON; - resultMetadata->addEntry(ANDROID_CONTROL_AE_MODE, value); + if (metadata.contains(controls::AeEnable)) { + uint8_t aeMode = metadata.get(controls::AeEnable); + resultMetadata->addEntry(ANDROID_CONTROL_AE_MODE, aeMode); + } if (settings.getEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, &entry)) /*