From patchwork Tue Jan 26 17:30:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 11022 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 B2390BD808 for ; Tue, 26 Jan 2021 17:29:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4ACA768318; Tue, 26 Jan 2021 18:29:58 +0100 (CET) Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 850D068328 for ; Tue, 26 Jan 2021 18:29:55 +0100 (CET) X-Originating-IP: 93.34.118.233 Received: from uno.lan (93-34-118-233.ip49.fastwebnet.it [93.34.118.233]) (Authenticated sender: jacopo@jmondi.org) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 3439DE0004 for ; Tue, 26 Jan 2021 17:29:55 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Tue, 26 Jan 2021 18:30:08 +0100 Message-Id: <20210126173008.446321-7-jacopo@jmondi.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210126173008.446321-1-jacopo@jmondi.org> References: <20210126173008.446321-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 6/6] android: camera_device: Return AE FPS range 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 result metadata reported an arbitrary {30, 30} FPS range for the AE algorithm. The actual FPS range should be returned in the Request::metadata, but as libcamera currently does not support that feature temporary work around the issue and return the FPS range requested by the camera framework. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index f3f59f7dcb77..6339ef257906 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1951,6 +1951,7 @@ std::unique_ptr CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor, int64_t timestamp) { + const CameraMetadata &settings = descriptor->settings_; const ControlList &metadata = descriptor->request_->metadata(); /* @@ -1977,9 +1978,21 @@ CameraDevice::getResultMetadata(Camera3RequestDescriptor *descriptor, value = ANDROID_CONTROL_AE_MODE_ON; resultMetadata->addEntry(ANDROID_CONTROL_AE_MODE, &value, 1); - std::vector aeFpsTarget = { 30, 30 }; - resultMetadata->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, - aeFpsTarget.data(), aeFpsTarget.size()); + camera_metadata_ro_entry_t entry; + bool found = settings.getEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, &entry); + if (found) { + /* + * \todo Retrieve the AE FPS range from the libcamera metadata. + * As libcamera does not support that control, as a temporary + * workaround return what the framework asked. + */ + const int32_t *data = entry.data.i32; + std::vector aeFpsTarget = { + data[0], data[1], + }; + resultMetadata->addEntry(ANDROID_CONTROL_AE_TARGET_FPS_RANGE, + aeFpsTarget.data(), aeFpsTarget.size()); + } value = ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER_IDLE; resultMetadata->addEntry(ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER,