From patchwork Wed May 26 03:47:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 12418 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 499F0C3203 for ; Wed, 26 May 2021 03:47:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9DB6568921; Wed, 26 May 2021 05:47:39 +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="LeuvGw0+"; 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 67834602AB for ; Wed, 26 May 2021 05:47:37 +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 6AF6F332; Wed, 26 May 2021 05:47:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1622000856; bh=Gv8ny0/BZG6QU6EuEdfTMM/QbW7QQ+UN4cfmNPnFwzM=; h=From:To:Cc:Subject:Date:From; b=LeuvGw0+IwSLY4ic3Oi1jk2jvc+qcKmNzdMyLuIKPIy+TcddfjtCdeOpBxJFYzT9o eHXjqE4cDFeXi6X3RzNHtm7mt2yuvyWQSCyfplCJWykHVJ4rj1ybkJEOAZpfYhEuiD x4NhO1qF+ZMBVQnfx9lruIiuDef4jqXkP1UjMkT4= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 26 May 2021 12:47:18 +0900 Message-Id: <20210526034720.1253094-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 1/3] controls: Split FrameDurations into FrameDuration and FrameDurationLimits 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" We need a separate control to report the nominal frame duration, but it's also useful to report the min/max frame duration values that will be used. Split the FrameDurations control into FrameDuration and FrameDurationLimits respectively to support both of these. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Hirokazu Honda Reviewed-by: Jacopo Mondi --- Changes in v4: - set FrameDurationLimits (instead of FrameDuration) in the ipu3 pipeline handler Changes in v3: - mention that the control is meant to be returned in metadata - s/nominal/instantaneous --- include/libcamera/ipa/raspberrypi.h | 2 +- src/android/camera_device.cpp | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 4 ++-- src/libcamera/control_ids.yaml | 9 ++++++++- src/libcamera/pipeline/ipu3/ipu3.cpp | 7 ++++--- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h index d10c1733..a8790000 100644 --- a/include/libcamera/ipa/raspberrypi.h +++ b/include/libcamera/ipa/raspberrypi.h @@ -44,7 +44,7 @@ static const ControlInfoMap Controls = { { &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) }, { &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) }, { &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) }, - { &controls::FrameDurations, ControlInfo(INT64_C(1000), INT64_C(1000000000)) }, + { &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) }, { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }, }; diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index dc0c8f5f..9e267b5f 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -864,7 +864,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata() int64_t minFrameDurationNsec = -1; int64_t maxFrameDurationNsec = -1; - const auto frameDurationsInfo = controlsInfo.find(&controls::FrameDurations); + const auto frameDurationsInfo = controlsInfo.find(&controls::FrameDurationLimits); if (frameDurationsInfo != controlsInfo.end()) { minFrameDurationNsec = frameDurationsInfo->second.min().get() * 1000; maxFrameDurationNsec = frameDurationsInfo->second.max().get() * 1000; diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index e5bb8159..0c4752ec 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -859,7 +859,7 @@ void IPARPi::queueRequest(const ControlList &controls) break; } - case controls::FRAME_DURATIONS: { + case controls::FRAME_DURATION_LIMITS: { auto frameDurations = ctrl.second.get>(); applyFrameDurations(frameDurations[0], frameDurations[1]); break; @@ -1074,7 +1074,7 @@ void IPARPi::applyFrameDurations(double minFrameDuration, double maxFrameDuratio maxFrameDuration_ = std::max(maxFrameDuration_, minFrameDuration_); /* Return the validated limits via metadata. */ - libcameraMetadata_.set(controls::FrameDurations, + libcameraMetadata_.set(controls::FrameDurationLimits, { static_cast(minFrameDuration_), static_cast(maxFrameDuration_) }); diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml index 88d81ac4..f62ade48 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -323,7 +323,14 @@ controls: step to respect the received gain factor and shall report their total value in the request metadata. - - FrameDurations: + - FrameDuration: + type: int64_t + description: | + The instantaneous frame duration from start of frame exposure to start + of next exposure, expressed in microseconds. This control is meant to + be returned in metadata. + + - FrameDurationLimits: type: int64_t description: | The minimum and maximum (in that order) frame duration, diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp index 25203256..2d15d488 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -983,9 +983,10 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data) frameDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U); } - controls[&controls::FrameDurations] = ControlInfo(frameDurations[0], - frameDurations[1], - frameDurations[2]); + controls[&controls::FrameDurationLimits] = + ControlInfo(frameDurations[0], + frameDurations[1], + frameDurations[2]); /* * Compute the scaler crop limits. From patchwork Wed May 26 03:47:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 12419 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 59252C3203 for ; Wed, 26 May 2021 03:47:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 16EDB68923; Wed, 26 May 2021 05:47:42 +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="aaLKxOJR"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DA9C568923 for ; Wed, 26 May 2021 05:47:39 +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 A30AD332; Wed, 26 May 2021 05:47:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1622000859; bh=di9P3RyVubxN4G1YO43OgG8vc+SQEPYroQq40orjZ+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aaLKxOJRpBCmc4bd3RCAuDKN/qcZkei0soPdIYMAa27xyEzsVUL4if4fdDHkiTi+x b1j/ZvV9g+diN3d+dUksHTudrAV9dSH51V0/xwn6c8+S3EWxYEKJrSPyuQ+K8KpTq6 WqzQUjrUIEuQxHIIn5aBVBGymti6r9QnUUL/Dvlw= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 26 May 2021 12:47:19 +0900 Message-Id: <20210526034720.1253094-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210526034720.1253094-1-paul.elder@ideasonboard.com> References: <20210526034720.1253094-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 2/3] android: camera_device: Fix sensor frame duration 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 sensor frame duration should be set by IPA. Get the information for the result metadata from libcamera. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/android/camera_device.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 9e267b5f..376bfd5f 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -2299,6 +2299,12 @@ CameraDevice::getResultMetadata(const Camera3RequestDescriptor &descriptor) cons resultMetadata->addEntry(ANDROID_SENSOR_EXPOSURE_TIME, exposure); } + if (metadata.contains(controls::FrameDuration)) { + int64_t duration = metadata.get(controls::FrameDuration) * 1000; + resultMetadata->addEntry(ANDROID_SENSOR_FRAME_DURATION, + duration); + } + if (metadata.contains(controls::ScalerCrop)) { Rectangle crop = metadata.get(controls::ScalerCrop); int32_t cropRect[] = { From patchwork Wed May 26 03:47:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 12420 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 B3420C3203 for ; Wed, 26 May 2021 03:47:44 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7079C68921; Wed, 26 May 2021 05:47:44 +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="nmb+a/74"; 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 95CE4602AB for ; Wed, 26 May 2021 05:47:42 +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 1EC43332; Wed, 26 May 2021 05:47:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1622000862; bh=vG29wqoHeH3ewKzjFlPcZ0Do28b51qvNRQoADeCzxGA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nmb+a/74ALltja9PgPqdjLuOlK8SD1Y184OeFaXNOG6S9bP9OCx9L9ckpE5HbBuwk 86HnwKH6Gd8qGScdIC2XWV493ukpWoBzy6lPSYzxOlPhB2YmqT4d3TpqN2zXTxyP1v BXfPAk5htb09okx8e1OIHSFFIOgcPHN+f5yOwBcc= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Wed, 26 May 2021 12:47:20 +0900 Message-Id: <20210526034720.1253094-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210526034720.1253094-1-paul.elder@ideasonboard.com> References: <20210526034720.1253094-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 3/3] ipa: ipu3: Set output frame duration 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 sensor frame duration should be set by the IPA. Hardcode it for now. Signed-off-by: Paul Elder Reviewed-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Reviewed-by: Hirokazu Honda --- src/ipa/ipu3/ipu3.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ipa/ipu3/ipu3.cpp b/src/ipa/ipu3/ipu3.cpp index 769c24d3..6b9aeab6 100644 --- a/src/ipa/ipu3/ipu3.cpp +++ b/src/ipa/ipu3/ipu3.cpp @@ -267,6 +267,10 @@ void IPAIPU3::parseStatistics(unsigned int frame, if (agcAlgo_->updateControls()) setControls(frame); + /* \todo Populate this with real values */ + ctrls.set(controls::FrameDuration, + static_cast(33334)); + IPU3Action op; op.op = ActionMetadataReady; op.controls = ctrls;