[{"id":17240,"web_url":"https://patchwork.libcamera.org/comment/17240/","msgid":"<20210525102337.fhfomlsc5olsymmu@uno.localdomain>","date":"2021-05-25T10:23:37","subject":"Re: [libcamera-devel] [PATCH v3 1/3] controls: Split FrameDurations\n\tinto FrameDuration and FrameDurationLimits","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Paul,\n\nOn Tue, May 25, 2021 at 06:18:10PM +0900, Paul Elder wrote:\n> We need a separate control to report the nominal frame duration, but\n> it's also useful to report the min/max frame duration values that will\n> be used. Split the FrameDurations control into FrameDuration and\n> FrameDurationLimits respectively to support both of these.\n>\n> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n>\n> ---\n> Changes in v3:\n> - mention that the control is meant to be returned in metadata\n> - s/nominal/instantaneous\n> ---\n>  include/libcamera/ipa/raspberrypi.h  | 2 +-\n>  src/android/camera_device.cpp        | 2 +-\n>  src/ipa/raspberrypi/raspberrypi.cpp  | 4 ++--\n>  src/libcamera/control_ids.yaml       | 9 ++++++++-\n>  src/libcamera/pipeline/ipu3/ipu3.cpp | 6 +++---\n>  5 files changed, 15 insertions(+), 8 deletions(-)\n>\n> diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\n> index d10c1733..a8790000 100644\n> --- a/include/libcamera/ipa/raspberrypi.h\n> +++ b/include/libcamera/ipa/raspberrypi.h\n> @@ -44,7 +44,7 @@ static const ControlInfoMap Controls = {\n>  \t{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n>  \t{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },\n>  \t{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n> -\t{ &controls::FrameDurations, ControlInfo(INT64_C(1000), INT64_C(1000000000)) },\n> +\t{ &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) },\n>  \t{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },\n>  };\n>\n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index b32e8be5..0eea2b95 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -824,7 +824,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n>\n>  \tint64_t minFrameDurationNsec = -1;\n>  \tint64_t maxFrameDurationNsec = -1;\n> -\tconst auto frameDurationsInfo = controlsInfo.find(&controls::FrameDurations);\n> +\tconst auto frameDurationsInfo = controlsInfo.find(&controls::FrameDurationLimits);\n>  \tif (frameDurationsInfo != controlsInfo.end()) {\n>  \t\tminFrameDurationNsec = frameDurationsInfo->second.min().get<int64_t>() * 1000;\n>  \t\tmaxFrameDurationNsec = frameDurationsInfo->second.max().get<int64_t>() * 1000;\n> diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\n> index e5bb8159..0c4752ec 100644\n> --- a/src/ipa/raspberrypi/raspberrypi.cpp\n> +++ b/src/ipa/raspberrypi/raspberrypi.cpp\n> @@ -859,7 +859,7 @@ void IPARPi::queueRequest(const ControlList &controls)\n>  \t\t\tbreak;\n>  \t\t}\n>\n> -\t\tcase controls::FRAME_DURATIONS: {\n> +\t\tcase controls::FRAME_DURATION_LIMITS: {\n>  \t\t\tauto frameDurations = ctrl.second.get<Span<const int64_t>>();\n>  \t\t\tapplyFrameDurations(frameDurations[0], frameDurations[1]);\n>  \t\t\tbreak;\n> @@ -1074,7 +1074,7 @@ void IPARPi::applyFrameDurations(double minFrameDuration, double maxFrameDuratio\n>  \tmaxFrameDuration_ = std::max(maxFrameDuration_, minFrameDuration_);\n>\n>  \t/* Return the validated limits via metadata. */\n> -\tlibcameraMetadata_.set(controls::FrameDurations,\n> +\tlibcameraMetadata_.set(controls::FrameDurationLimits,\n>  \t\t\t       { static_cast<int64_t>(minFrameDuration_),\n>  \t\t\t\t static_cast<int64_t>(maxFrameDuration_) });\n>\n> diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\n> index 88d81ac4..f62ade48 100644\n> --- a/src/libcamera/control_ids.yaml\n> +++ b/src/libcamera/control_ids.yaml\n> @@ -323,7 +323,14 @@ controls:\n>          step to respect the received gain factor and shall report\n>          their total value in the request metadata.\n>\n> -  - FrameDurations:\n> +  - FrameDuration:\n> +      type: int64_t\n> +      description: |\n> +        The instantaneous frame duration from start of frame exposure to start\n> +        of next exposure, expressed in microseconds. This control is meant to\n> +        be returned in metadata.\n> +\n> +  - FrameDurationLimits:\n>        type: int64_t\n>        description: |\n>          The minimum and maximum (in that order) frame duration,\n> diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> index 25203256..15ba5cf8 100644\n> --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> @@ -983,9 +983,9 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n>  \t\tframeDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);\n>  \t}\n>\n> -\tcontrols[&controls::FrameDurations] = ControlInfo(frameDurations[0],\n> -\t\t\t\t\t\t\t  frameDurations[1],\n> -\t\t\t\t\t\t\t  frameDurations[2]);\n> +\tcontrols[&controls::FrameDuration] = ControlInfo(frameDurations[0],\n> +\t\t\t\t\t\t\t frameDurations[1],\n> +\t\t\t\t\t\t\t frameDurations[2]);\n\nShould we register both FrameDuration and FrameDurationLimits ?\n\nFrameDuration has to be returned, but also the limits are (or will be\nsupported)....\n\n>\n>  \t/*\n>  \t * Compute the scaler crop limits.\n> --\n> 2.27.0\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 2967FC3202\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 May 2021 10:22:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AA67D68918;\n\tTue, 25 May 2021 12:22:54 +0200 (CEST)","from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net\n\t[217.70.183.195])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B654A6050E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 May 2021 12:22:52 +0200 (CEST)","(Authenticated sender: jacopo@jmondi.org)\n\tby relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 2672E60014;\n\tTue, 25 May 2021 10:22:51 +0000 (UTC)"],"Date":"Tue, 25 May 2021 12:23:37 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Paul Elder <paul.elder@ideasonboard.com>","Message-ID":"<20210525102337.fhfomlsc5olsymmu@uno.localdomain>","References":"<20210525091812.1225580-1-paul.elder@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210525091812.1225580-1-paul.elder@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v3 1/3] controls: Split FrameDurations\n\tinto FrameDuration and FrameDurationLimits","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":17245,"web_url":"https://patchwork.libcamera.org/comment/17245/","msgid":"<YKzZ6OD4h1OPsR2V@pendragon.ideasonboard.com>","date":"2021-05-25T11:05:12","subject":"Re: [libcamera-devel] [PATCH v3 1/3] controls: Split FrameDurations\n\tinto FrameDuration and FrameDurationLimits","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, May 25, 2021 at 12:23:37PM +0200, Jacopo Mondi wrote:\n> On Tue, May 25, 2021 at 06:18:10PM +0900, Paul Elder wrote:\n> > We need a separate control to report the nominal frame duration, but\n> > it's also useful to report the min/max frame duration values that will\n> > be used. Split the FrameDurations control into FrameDuration and\n> > FrameDurationLimits respectively to support both of these.\n> >\n> > Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>\n> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> >\n> > ---\n> > Changes in v3:\n> > - mention that the control is meant to be returned in metadata\n> > - s/nominal/instantaneous\n> > ---\n> >  include/libcamera/ipa/raspberrypi.h  | 2 +-\n> >  src/android/camera_device.cpp        | 2 +-\n> >  src/ipa/raspberrypi/raspberrypi.cpp  | 4 ++--\n> >  src/libcamera/control_ids.yaml       | 9 ++++++++-\n> >  src/libcamera/pipeline/ipu3/ipu3.cpp | 6 +++---\n> >  5 files changed, 15 insertions(+), 8 deletions(-)\n> >\n> > diff --git a/include/libcamera/ipa/raspberrypi.h b/include/libcamera/ipa/raspberrypi.h\n> > index d10c1733..a8790000 100644\n> > --- a/include/libcamera/ipa/raspberrypi.h\n> > +++ b/include/libcamera/ipa/raspberrypi.h\n> > @@ -44,7 +44,7 @@ static const ControlInfoMap Controls = {\n> >  \t{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n> >  \t{ &controls::ColourCorrectionMatrix, ControlInfo(-16.0f, 16.0f) },\n> >  \t{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n> > -\t{ &controls::FrameDurations, ControlInfo(INT64_C(1000), INT64_C(1000000000)) },\n> > +\t{ &controls::FrameDurationLimits, ControlInfo(INT64_C(1000), INT64_C(1000000000)) },\n> >  \t{ &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) },\n> >  };\n> >\n> > diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> > index b32e8be5..0eea2b95 100644\n> > --- a/src/android/camera_device.cpp\n> > +++ b/src/android/camera_device.cpp\n> > @@ -824,7 +824,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()\n> >\n> >  \tint64_t minFrameDurationNsec = -1;\n> >  \tint64_t maxFrameDurationNsec = -1;\n> > -\tconst auto frameDurationsInfo = controlsInfo.find(&controls::FrameDurations);\n> > +\tconst auto frameDurationsInfo = controlsInfo.find(&controls::FrameDurationLimits);\n> >  \tif (frameDurationsInfo != controlsInfo.end()) {\n> >  \t\tminFrameDurationNsec = frameDurationsInfo->second.min().get<int64_t>() * 1000;\n> >  \t\tmaxFrameDurationNsec = frameDurationsInfo->second.max().get<int64_t>() * 1000;\n> > diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\n> > index e5bb8159..0c4752ec 100644\n> > --- a/src/ipa/raspberrypi/raspberrypi.cpp\n> > +++ b/src/ipa/raspberrypi/raspberrypi.cpp\n> > @@ -859,7 +859,7 @@ void IPARPi::queueRequest(const ControlList &controls)\n> >  \t\t\tbreak;\n> >  \t\t}\n> >\n> > -\t\tcase controls::FRAME_DURATIONS: {\n> > +\t\tcase controls::FRAME_DURATION_LIMITS: {\n> >  \t\t\tauto frameDurations = ctrl.second.get<Span<const int64_t>>();\n> >  \t\t\tapplyFrameDurations(frameDurations[0], frameDurations[1]);\n> >  \t\t\tbreak;\n> > @@ -1074,7 +1074,7 @@ void IPARPi::applyFrameDurations(double minFrameDuration, double maxFrameDuratio\n> >  \tmaxFrameDuration_ = std::max(maxFrameDuration_, minFrameDuration_);\n> >\n> >  \t/* Return the validated limits via metadata. */\n> > -\tlibcameraMetadata_.set(controls::FrameDurations,\n> > +\tlibcameraMetadata_.set(controls::FrameDurationLimits,\n> >  \t\t\t       { static_cast<int64_t>(minFrameDuration_),\n> >  \t\t\t\t static_cast<int64_t>(maxFrameDuration_) });\n> >\n> > diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\n> > index 88d81ac4..f62ade48 100644\n> > --- a/src/libcamera/control_ids.yaml\n> > +++ b/src/libcamera/control_ids.yaml\n> > @@ -323,7 +323,14 @@ controls:\n> >          step to respect the received gain factor and shall report\n> >          their total value in the request metadata.\n> >\n> > -  - FrameDurations:\n> > +  - FrameDuration:\n> > +      type: int64_t\n> > +      description: |\n> > +        The instantaneous frame duration from start of frame exposure to start\n> > +        of next exposure, expressed in microseconds. This control is meant to\n> > +        be returned in metadata.\n> > +\n> > +  - FrameDurationLimits:\n> >        type: int64_t\n> >        description: |\n> >          The minimum and maximum (in that order) frame duration,\n> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > index 25203256..15ba5cf8 100644\n> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n> > @@ -983,9 +983,9 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)\n> >  \t\tframeDurations[i] = frameSize / (sensorInfo.pixelRate / 1000000U);\n> >  \t}\n> >\n> > -\tcontrols[&controls::FrameDurations] = ControlInfo(frameDurations[0],\n> > -\t\t\t\t\t\t\t  frameDurations[1],\n> > -\t\t\t\t\t\t\t  frameDurations[2]);\n> > +\tcontrols[&controls::FrameDuration] = ControlInfo(frameDurations[0],\n> > +\t\t\t\t\t\t\t frameDurations[1],\n> > +\t\t\t\t\t\t\t frameDurations[2]);\n> \n> Should we register both FrameDuration and FrameDurationLimits ?\n> \n> FrameDuration has to be returned, but also the limits are (or will be\n> supported)....\n\nI have missed this one. This patch should use FrameDurationLimits to\nreplace FrameDurations in the whole code base, adding support for\nFrameDuration in selected pipeline handlers should be done in a\nsubsequent patch.\n\n> >\n> >  \t/*\n> >  \t * Compute the scaler crop limits.","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id C5B99C3202\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 May 2021 11:05:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2A29F68922;\n\tTue, 25 May 2021 13:05:20 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E3616050E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 May 2021 13:05:19 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4E764880;\n\tTue, 25 May 2021 13:05:18 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"gmYiatiD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1621940718;\n\tbh=E70B5BgmZSNNBeVz9tiXokmPnqavPv1PRg6VfLOSlas=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=gmYiatiDX59V/7Tm+d8LOW+mVFXZN+bP/eazQjNgLrG2b1EBHrtqJ0vpJfwECleuN\n\tfQSsw4xghPafExa1lFVNk0NaBHIYd6ZBaRNTxyzDmjCzTYH9CD25eqa0POzOsgajYE\n\t2UVFndWhB+8/K5VcC8tfrtKhj+lmr5k9AzdZ6xZY=","Date":"Tue, 25 May 2021 14:05:12 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Message-ID":"<YKzZ6OD4h1OPsR2V@pendragon.ideasonboard.com>","References":"<20210525091812.1225580-1-paul.elder@ideasonboard.com>\n\t<20210525102337.fhfomlsc5olsymmu@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210525102337.fhfomlsc5olsymmu@uno.localdomain>","Subject":"Re: [libcamera-devel] [PATCH v3 1/3] controls: Split FrameDurations\n\tinto FrameDuration and FrameDurationLimits","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]