[{"id":34822,"web_url":"https://patchwork.libcamera.org/comment/34822/","msgid":"<CAHW6GYKXUWaOxp0vN5wdrRpeaGQfOx_2+Cv1heC-BnXRv2A-Nw@mail.gmail.com>","date":"2025-07-08T09:08:22","subject":"Re: [PATCH v1 2/2] libcamera: controls: Use nanoseconds units for\n\tFrameWallClock","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Naush\n\nThanks for the patch.\n\nOn Tue, 8 Jul 2025 at 09:52, Naushir Patuck <naush@raspberrypi.com> wrote:\n>\n> Use nanoseconds for the FrameWallClock control to match the units for\n> other timestamp controls, including SensorTimestamp.\n>\n> Update the RPi pipeline handlers to match the new nanoseconds units when\n> converting from SensorTimestamp to FrameWallClock.\n>\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/libcamera/control_ids_core.yaml      | 3 ++-\n>  src/libcamera/pipeline/rpi/pisp/pisp.cpp | 2 +-\n>  src/libcamera/pipeline/rpi/vc4/vc4.cpp   | 2 +-\n>  3 files changed, 4 insertions(+), 3 deletions(-)\n>\n> diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml\n> index 566e1533702f..eec4b4f937ee 100644\n> --- a/src/libcamera/control_ids_core.yaml\n> +++ b/src/libcamera/control_ids_core.yaml\n> @@ -1274,7 +1274,8 @@ controls:\n>        description: |\n>          This timestamp corresponds to the same moment in time as the\n>          SensorTimestamp, but is represented as a wall clock time as measured by\n> -        the CLOCK_REALTIME clock.\n> +        the CLOCK_REALTIME clock. Like SensorTimestamp, the timestamp value is\n> +        expressed in nanoseconds.\n>\n>          Being a wall clock measurement, it can be used to synchronise timing\n>          across different devices.\n> diff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> index 2df91bacf3be..92b9070c1bc2 100644\n> --- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> +++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> @@ -1760,7 +1760,7 @@ void PiSPCameraData::cfeBufferDequeue(FrameBuffer *buffer)\n>                  */\n>                 wallClockRecovery_.addSample();\n>                 uint64_t sensorTimestamp = buffer->metadata().timestamp;\n> -               uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp / 1000);\n> +               uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp);\n>\n>                 ctrl.set(controls::SensorTimestamp, sensorTimestamp);\n>                 ctrl.set(controls::FrameWallClock, wallClockTimestamp);\n> diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n> index e99a7edf809c..5cadef52712f 100644\n> --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n> +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n> @@ -778,7 +778,7 @@ void Vc4CameraData::unicamBufferDequeue(FrameBuffer *buffer)\n>                  */\n>                 wallClockRecovery_.addSample();\n>                 uint64_t sensorTimestamp = buffer->metadata().timestamp;\n> -               uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp / 1000);\n> +               uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp);\n\nYes, looks good to me.\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks!\nDavid\n\n>\n>                 ctrl.set(controls::SensorTimestamp, sensorTimestamp);\n>                 ctrl.set(controls::FrameWallClock, wallClockTimestamp);\n> --\n> 2.43.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 56C87C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Jul 2025 09:08:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F251968EDC;\n\tTue,  8 Jul 2025 11:08:35 +0200 (CEST)","from mail-qt1-x830.google.com (mail-qt1-x830.google.com\n\t[IPv6:2607:f8b0:4864:20::830])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4E20168E3A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Jul 2025 11:08:34 +0200 (CEST)","by mail-qt1-x830.google.com with SMTP id\n\td75a77b69052e-4a43972dcd7so50584571cf.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 08 Jul 2025 02:08:34 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"Agr9MhR2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1751965713; x=1752570513;\n\tdarn=lists.libcamera.org; \n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:from:to:cc:subject:date:message-id:reply-to;\n\tbh=UcR0dUcqBU+L5I7a1ljXsCptFDh59rqNDWmhFI2lNqQ=;\n\tb=Agr9MhR29NmYX5xedsK6x+2KdumW3HHkeoNmwF8neiZGkvxE3VMfac/r5DaL3jgrKc\n\tSaku7tsrVSKK6MCj44cIhlg1VOVXYsnArWSKYrHTFpbVCcg1GDVMH6DWT/5ODreCzbGX\n\tNfBCPeQ8wVArXn3EJwFSCDYlX+ZCUswlhyja1S7qzJI0Sr+jhL20xJL/LmArq5D8d4b0\n\tauyyicLCu5L7Q2mvhGupi+NCGAI3kteVUf4qfeknwM4UnkG58q54y61VVF2antuKVpVc\n\to1xYH3tMS3lihHYW1mSQf+yhzJiWbNCY8bCIMj1GjZXgw8Ha/sLMk+l7vwtBqObcwY1x\n\tP5cw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1751965713; x=1752570513;\n\th=cc:to:subject:message-id:date:from:in-reply-to:references\n\t:mime-version:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=UcR0dUcqBU+L5I7a1ljXsCptFDh59rqNDWmhFI2lNqQ=;\n\tb=pRkemjkZQP5NrZyLsW5QzzMlO77l9cdpj0NIyRiZY0LYhr7oJgSKAaK32oP9yY2zxY\n\tkxp+0efvd556gRnGrAd0vi5lucAG8Zu8NdrFvZ3mq+P0rCkKN+/8P7iVg6tIT7+nqKgG\n\t0IBovLPkDHoKq5Zuyp8AhJsSdZ1qzuuf+RLUo8dacHTahglKXrEwA0pW8TEkAwUeJHe1\n\taBwz5IWglN7bnLp7anAEgMMe27V4381QNObYd4+zPlMkem7G8B00Ta/tTZBSim6AHuKj\n\tSUTwaHitY+WDIXDwDkCtVGdBfx2reQT70mALxtAokk2YU5Q5EVYIA/uVdFFlNKOO8O+B\n\tzpyA==","X-Gm-Message-State":"AOJu0YzWDygrgEcahrU933M/BaCJkmSMlOQMe5TbHxkA6AwM8ayCwzGm\n\tlwaUgmBlf+XfX05d6Jj5fMNQPyjqVMbM7W5AlG067dtZk2ywoKit8snKVnnBSM6H1F5GufL4kfb\n\tCJacF3PVz+QsFRgfD6oa3WitN1v7B8PCFh1tAk6NQRA==","X-Gm-Gg":"ASbGncuCQ0VQ3rGmdXcz+osngujsETCeh1zhDcGiKT8iSfkoyJl7MXVGccurfoDabZ6\n\tPxVdvrxMEOju6BEl+/KeERHVSjVnDGNAcwp4d52qIzpKc9IQDm40am2N8PWqgPIRkFd9NW2NKEp\n\tLoHQOPGGQmSNNrCw7HtuIlh6C9YfMW9Oy94kB+xPm0sPFcORvRqNrvhP6+2Fli3BJw740zHIh0j\n\t9o=","X-Google-Smtp-Source":"AGHT+IG0DqkAfyabJm03SGbPNw3PRTbuNPUwpCkEBTYKOVBS/jaEis0MwBaRTOvcHrTbpv4mkn7HILpaLFMH675PWRo=","X-Received":"by 2002:a05:622a:4890:b0:4a9:af47:6495 with SMTP id\n\td75a77b69052e-4a9af4764d0mr197886121cf.52.1751965713080;\n\tTue, 08 Jul 2025 02:08:33 -0700 (PDT)","MIME-Version":"1.0","References":"<20250708085147.752248-1-naush@raspberrypi.com>\n\t<20250708085147.752248-3-naush@raspberrypi.com>","In-Reply-To":"<20250708085147.752248-3-naush@raspberrypi.com>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Tue, 8 Jul 2025 10:08:22 +0100","X-Gm-Features":"Ac12FXw20qQzDFMreEWn0KvfeOmDZTURJ1AWoHAStBQ8yBjOM-_VUe_hh6OV4Jw","Message-ID":"<CAHW6GYKXUWaOxp0vN5wdrRpeaGQfOx_2+Cv1heC-BnXRv2A-Nw@mail.gmail.com>","Subject":"Re: [PATCH v1 2/2] libcamera: controls: Use nanoseconds units for\n\tFrameWallClock","To":"Naushir Patuck <naush@raspberrypi.com>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"UTF-8\"","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>"}},{"id":34823,"web_url":"https://patchwork.libcamera.org/comment/34823/","msgid":"<175196745321.2340557.10286788567096866856@ping.linuxembedded.co.uk>","date":"2025-07-08T09:37:33","subject":"Re: [PATCH v1 2/2] libcamera: controls: Use nanoseconds units for\n\tFrameWallClock","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Naushir Patuck (2025-07-08 09:49:15)\n> Use nanoseconds for the FrameWallClock control to match the units for\n> other timestamp controls, including SensorTimestamp.\n> \n> Update the RPi pipeline handlers to match the new nanoseconds units when\n> converting from SensorTimestamp to FrameWallClock.\n\nThanks, I think this removes the ambiguity/inconsistency.\n\nI noted that the ROS discussion was also worried that FrameWallClock is\nonly applicable on Raspberry Pi at the moment - I know we went round in\ncircles on that before too - I might try to see how we can make it\neasily work for all pipelines (they only noticed the lack of\nFrameWallClock in UVC ... but anyway - that's not related/blocking this\npatch)\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> ---\n>  src/libcamera/control_ids_core.yaml      | 3 ++-\n>  src/libcamera/pipeline/rpi/pisp/pisp.cpp | 2 +-\n>  src/libcamera/pipeline/rpi/vc4/vc4.cpp   | 2 +-\n>  3 files changed, 4 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml\n> index 566e1533702f..eec4b4f937ee 100644\n> --- a/src/libcamera/control_ids_core.yaml\n> +++ b/src/libcamera/control_ids_core.yaml\n> @@ -1274,7 +1274,8 @@ controls:\n>        description: |\n>          This timestamp corresponds to the same moment in time as the\n>          SensorTimestamp, but is represented as a wall clock time as measured by\n> -        the CLOCK_REALTIME clock.\n> +        the CLOCK_REALTIME clock. Like SensorTimestamp, the timestamp value is\n> +        expressed in nanoseconds.\n>  \n>          Being a wall clock measurement, it can be used to synchronise timing\n>          across different devices.\n> diff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> index 2df91bacf3be..92b9070c1bc2 100644\n> --- a/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> +++ b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\n> @@ -1760,7 +1760,7 @@ void PiSPCameraData::cfeBufferDequeue(FrameBuffer *buffer)\n>                  */\n>                 wallClockRecovery_.addSample();\n>                 uint64_t sensorTimestamp = buffer->metadata().timestamp;\n> -               uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp / 1000);\n> +               uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp);\n>  \n>                 ctrl.set(controls::SensorTimestamp, sensorTimestamp);\n>                 ctrl.set(controls::FrameWallClock, wallClockTimestamp);\n> diff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n> index e99a7edf809c..5cadef52712f 100644\n> --- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n> +++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n> @@ -778,7 +778,7 @@ void Vc4CameraData::unicamBufferDequeue(FrameBuffer *buffer)\n>                  */\n>                 wallClockRecovery_.addSample();\n>                 uint64_t sensorTimestamp = buffer->metadata().timestamp;\n> -               uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp / 1000);\n> +               uint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp);\n>  \n>                 ctrl.set(controls::SensorTimestamp, sensorTimestamp);\n>                 ctrl.set(controls::FrameWallClock, wallClockTimestamp);\n> -- \n> 2.43.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 7E77BC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Jul 2025 09:37:39 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 747A568EE3;\n\tTue,  8 Jul 2025 11:37:38 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5112E68EDB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Jul 2025 11:37:36 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D60A43DC;\n\tTue,  8 Jul 2025 11:37:08 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"b9Z2Cq3e\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1751967428;\n\tbh=3Al0ki/zJRWguiWOtYvarYwn5TzOrEgY7hRmiZzqgwA=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=b9Z2Cq3eA0Dbn59fFPTlOmgTrBOZRsntgw7kwvLre2HIs4aC7Hm0lKVbyAeOAtj3b\n\tzhGK+nClUm0Kj8icLXfKw6YnOWjSb/C9wNtILbZN8EC6I/PBXD1/cSuXnknJX+/xZg\n\tTL/vpcWhjr/IBAZI4AAnOxJB9mZJh70HU0IuF4Wk=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250708085147.752248-3-naush@raspberrypi.com>","References":"<20250708085147.752248-1-naush@raspberrypi.com>\n\t<20250708085147.752248-3-naush@raspberrypi.com>","Subject":"Re: [PATCH v1 2/2] libcamera: controls: Use nanoseconds units for\n\tFrameWallClock","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Naushir Patuck <naush@raspberrypi.com>","To":"Naushir Patuck <naush@raspberrypi.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 08 Jul 2025 10:37:33 +0100","Message-ID":"<175196745321.2340557.10286788567096866856@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}}]