From patchwork Mon May 24 09:41:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 12383 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 3E3C7C3200 for ; Mon, 24 May 2021 09:41:46 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6DD6C68919; Mon, 24 May 2021 11:41:45 +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="LP6elPQa"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2EAD3602B1 for ; Mon, 24 May 2021 11:41:44 +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 B66501315; Mon, 24 May 2021 11:41:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1621849303; bh=GE4lpxILJTxBXAw4pQM2MuTHqGglrsjRTfDYsfUgAvU=; h=From:To:Cc:Subject:Date:From; b=LP6elPQad5lpzjZys21DOWssIaj9FMxRUOOX5yy3xzX3ZRAk4rnj+w0JKy7ZtjJTk r3TCX7nUQ5aVWMDQj9sHKgah/25ByfKDgFP2ELLGt+FWMzndzBiHM5EqVobLcya+lL WDLTFBuMzlAYHVSIoXsoY0QnsQf1l5F/DuMBROuQ= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 24 May 2021 18:41:21 +0900 Message-Id: <20210524094123.1187354-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 --- include/libcamera/ipa/raspberrypi.h | 2 +- src/android/camera_device.cpp | 2 +- src/ipa/raspberrypi/raspberrypi.cpp | 4 ++-- src/libcamera/control_ids.yaml | 8 +++++++- src/libcamera/pipeline/ipu3/ipu3.cpp | 6 +++--- 5 files changed, 14 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 b32e8be5..0eea2b95 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -824,7 +824,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 52d91db2..79a327e2 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -860,7 +860,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; @@ -1075,7 +1075,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..338fbdc9 100644 --- a/src/libcamera/control_ids.yaml +++ b/src/libcamera/control_ids.yaml @@ -323,7 +323,13 @@ 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 nominal frame duration from start of frame exposure to start of + next exposure, expressed in microseconds. + + - 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 8ae47c6d..6e17753f 100644 --- a/src/libcamera/pipeline/ipu3/ipu3.cpp +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp @@ -980,9 +980,9 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data) frameDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U); } - controls[&controls::FrameDurations] = ControlInfo(frameDurations[0], - frameDurations[1], - frameDurations[2]); + controls[&controls::FrameDuration] = ControlInfo(frameDurations[0], + frameDurations[1], + frameDurations[2]); /* * Compute the scaler crop limits.