[{"id":32534,"web_url":"https://patchwork.libcamera.org/comment/32534/","msgid":"<20241205094600.GK10736@pendragon.ideasonboard.com>","date":"2024-12-05T09:46:00","subject":"Re: [RFC PATCH 1/3] controls: Add FrameWallClock and\n\tFrameWallClockRaw controls","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi David,\n\nThank you for the patch.\n\nOn Tue, Nov 26, 2024 at 12:17:04PM +0000, David Plowman wrote:\n> We add FrameWallClockRaw, a direct \"raw\" measurement of the wall clock\n> timestamp for the frame, and FrameWallClock, for a smoothed\n> (de-jittered) version of the same number.\n\nWill the two values always be returned together ? If so we could\npossibly combine them into a single array control of size 2. I don't\nmind too much either way, but it could make it slightly simpler for\napplications if they always (or often) need to process both values in\nconjunction.\n\n> Signed-off-by: David Plowman <david.plowman@raspberrypi.com>\n> ---\n>  src/libcamera/control_ids_core.yaml | 29 +++++++++++++++++++++++++++++\n>  1 file changed, 29 insertions(+)\n> \n> diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml\n> index d34a2d06..7cf0f481 100644\n> --- a/src/libcamera/control_ids_core.yaml\n> +++ b/src/libcamera/control_ids_core.yaml\n> @@ -973,4 +973,33 @@ controls:\n>        description: |\n>          Enable or disable the debug metadata.\n>  \n> +  - FrameWallClockRaw:\n> +      type: int64_t\n> +      description: |\n> +        The time in microseconds since the system clock's epoch.\n\nThe time of what ? Is it a start of frame, end of DMA or another time ?\nMy understanding is that it should correlate with the SensorTimestamp\ncontrol, so should be sampled at the same time, \"just\" with a different\nclock.\n\nLinux has four wall clocks: CLOCK_REALTIME, CLOCK_REALTIME_ALARM,\nCLOCK_REALTIME_COARSE and CLOCK_TAI. Would an application need to know\nwhich clock is used ?\n\n> +\n> +        This is a direct measurement of the number of microseconds since the\n> +        system clock's epoch. Because of the way it is sampled, this value is\n\nIt sounds like the control should define how this is sampled.\n\n> +        likely to be subject to significant amounts of system and system\n> +        load-dependent jitter, typically of many milliseconds in duration.\n> +\n> +        For a smoothed version of this timestamp, use the FramwWallClock\n> +        control.\n> +\n> +        \\sa FrameWallClock\n> +\n> +        The FrameWallClockRaw control can only be returned in metadata.\n> +\n> +  - FrameWallClock:\n> +      type: int64_t\n> +      description: |\n> +        The time in microseconds since the system clock's epoch.\n> +\n> +        This is a smoothed version of the FrameWallClockRaw timestamp, which\n> +        should show much reduced amounts of jitter.\n\nReading the documentation only I can't really tell what this is meant\nfor. I suppose the next patches will shed some more light, but the\ncontrol documentation should be expanded. Possible areas for improvement\nare how the clock is smoothed (at least the parts of the smoothing\nprocess that matter from a usage point of view), and why.\n\n> +\n> +        \\sa FrameWallClockRaw\n> +\n> +        The FrameWallClock control can only be returned in metadata.\n> +\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 7DD8FC323E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  5 Dec 2024 09:46:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7CCCA660E7;\n\tThu,  5 Dec 2024 10:46:14 +0100 (CET)","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 E5648618B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  5 Dec 2024 10:46:12 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 238E62B3;\n\tThu,  5 Dec 2024 10:45:44 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"OuP1TL4e\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1733391944;\n\tbh=qR6ky+UER1/rgM9Zpmo+ZHHT5YtHVvbxQytQfSrYMdM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=OuP1TL4eegpaw/vQAbWpWWVFgbkumK/XAOZ8aPnlVV6rnZKboJC2RqP2it8kEJFM8\n\tBF9U5tPYH8kl5PLfkN77iM0gZpbTKI5OztSlPqvENEQiF7+utGw+o1jfoyi7L/W9bz\n\tWbL18X65ObkSPKmTcledpbTVlCVI4bAfCJAz9Dp4=","Date":"Thu, 5 Dec 2024 11:46:00 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [RFC PATCH 1/3] controls: Add FrameWallClock and\n\tFrameWallClockRaw controls","Message-ID":"<20241205094600.GK10736@pendragon.ideasonboard.com>","References":"<20241126121706.4350-1-david.plowman@raspberrypi.com>\n\t<20241126121706.4350-2-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20241126121706.4350-2-david.plowman@raspberrypi.com>","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]