{"id":23774,"url":"https://patchwork.libcamera.org/api/1.1/patches/23774/?format=json","web_url":"https://patchwork.libcamera.org/patch/23774/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20250708085147.752248-3-naush@raspberrypi.com>","date":"2025-07-08T08:49:15","name":"[v1,2/2] libcamera: controls: Use nanoseconds units for FrameWallClock","commit_ref":"29a88d85b730baed52a2f2e5fde2a927474ce41c","pull_url":null,"state":"accepted","archived":false,"hash":"545536612fcd5692e1b34cd588eceef56b20229d","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/23774/mbox/","series":[{"id":5277,"url":"https://patchwork.libcamera.org/api/1.1/series/5277/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5277","date":"2025-07-08T08:49:13","name":"FrameWallClock units","version":1,"mbox":"https://patchwork.libcamera.org/series/5277/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/23774/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/23774/checks/","tags":{},"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 D06A3C0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  8 Jul 2025 08:52:03 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D5FC068ED9;\n\tTue,  8 Jul 2025 10:51:58 +0200 (CEST)","from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com\n\t[IPv6:2a00:1450:4864:20::42b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A0A468ED8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  8 Jul 2025 10:51:52 +0200 (CEST)","by mail-wr1-x42b.google.com with SMTP id\n\tffacd0b85a97d-3a4eb4dfd8eso651681f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 08 Jul 2025 01:51:52 -0700 (PDT)","from NAUSH-P-DELL.tail9c427.ts.net ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-454cd4938ffsm15112805e9.21.2025.07.08.01.51.51\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 08 Jul 2025 01:51:51 -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=\"ScPGHqrH\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1751964712; x=1752569512;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=Cwrk/J36Sca+wZPcZjNJQiPdG4DcMzwpKlU4oI1zKXU=;\n\tb=ScPGHqrHiuqnPesie2Z4u49NYPOQdFsa5icWkRETbj/n7GZ0qP/KWp/bgIFjWHfgaU\n\tDFNXE2SvvOnl6vLWVQUBdPQZZP3Ez+rcD3uUmQg6qUyV6RmkrG8zxIUmNSnfMIj1Eh0v\n\tlmz4k8cJ6bcTnpmXtsvVMzrDmxhG9jbtgbFePBpqbZ01QWVG0lhzIRte0ojXxsoNONe9\n\tyWq03zLuf/v4qmEXpF2R4PVRM71ncJAjtvmxJdAzARmCe9uG/jmblxqIuP+3qfhVpjXk\n\tIBhK3A59rIirewk9/l6u1Sx1jwe3jNhnL5TkbMmEPVr6GL9wC+/YPYh70P8r1BVz1vdM\n\t+l7A==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1751964712; x=1752569512;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=Cwrk/J36Sca+wZPcZjNJQiPdG4DcMzwpKlU4oI1zKXU=;\n\tb=sq0GUliLdLEnjg0mX2Tra5itdI4hINPC0Wy9hy0mu/hkzhxnu/sDUMTzmzMvWaMDpt\n\tO7XatslF7XwcojBB0zV8LE7l3XL5iWv5Un70kRghh7WayADcHAgVOtAmIDZH1ut+jpSW\n\t1iqL7aTuSj4FDZPxDzomFWRIJ+dUIvbDJx17qoV0MuJ0h0z8a1OVfagbZT5PuonyDmKu\n\tJDrxC3ZpHy/pdjsGDhDHt7ZYgYTWly4uNIaAtNY+nWdZisA++ALqiYFScRpps36+n2BG\n\tBgIVZh1HUrip56AuFAqVwdMB9bhOGQ3VG7DUyMKdyr0ZOes56CifBWdzK/ch0yBkRoKr\n\t59LQ==","X-Gm-Message-State":"AOJu0Yw869xaFuTcieePuZtbvvzapCHWeuQ+dJifuFvqZTQGxJib+zdE\n\t3LQCuth7FNgVR5OQo+G+tRq97zbKdw13RIeHxS8iiMSnpl18f4gTzbwxfI1pF6sn/kgT8uZFhsN\n\tfZ4NH","X-Gm-Gg":"ASbGnctYBpPlndipv77QH19Brs9HXkWxg6O2YorE1DG5Y8yMyXt8jQaHteNiiI2xMvC\n\ttiF98kQZfM8NG77lpcy6RLh89S6yELgMXGBq6burO1QxTIHRiWIQozZxPL1tHdkkbWL3HoNzDLk\n\tTO7uk9Bg+Mjo9vKNS2uysghBM/jkLrfZA2B5WyfXmGK9bqc/XXi+gWIsx2jt5ArNACitYb6r8xD\n\tmzd1D6BsqNKwDiSAZei80VB2QQkH2K1K9xlu9ClWOMWsqrEvcTfdaQQf9L3myQ28PSnQJQB9oUg\n\twUH75IP2tt5mDLzAmJbem2oPZrTYo1uLlOW53605mYS++EqJFEaQekj2x036a7xlct6U1wg+q1M\n\tPQzis7JgPniU=","X-Google-Smtp-Source":"AGHT+IGqdkfUFXV6EAZ2r54LHsw8oM9XpWttqpC8nxJanzeFnk0UBysKPSMJ6zJrZWao/crchDk23g==","X-Received":"by 2002:a05:600c:a30a:b0:453:bf1:8895 with SMTP id\n\t5b1f17b1804b1-454ccefa197mr6476165e9.5.1751964711519; \n\tTue, 08 Jul 2025 01:51:51 -0700 (PDT)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Naushir Patuck <naush@raspberrypi.com>","Subject":"[PATCH v1 2/2] libcamera: controls: Use nanoseconds units for\n\tFrameWallClock","Date":"Tue,  8 Jul 2025 09:49:15 +0100","Message-ID":"<20250708085147.752248-3-naush@raspberrypi.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20250708085147.752248-1-naush@raspberrypi.com>","References":"<20250708085147.752248-1-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>"},"content":"Use nanoseconds for the FrameWallClock control to match the units for\nother timestamp controls, including SensorTimestamp.\n\nUpdate the RPi pipeline handlers to match the new nanoseconds units when\nconverting from SensorTimestamp to FrameWallClock.\n\nSigned-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(-)","diff":"diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml\nindex 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.\ndiff --git a/src/libcamera/pipeline/rpi/pisp/pisp.cpp b/src/libcamera/pipeline/rpi/pisp/pisp.cpp\nindex 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 \t\t */\n \t\twallClockRecovery_.addSample();\n \t\tuint64_t sensorTimestamp = buffer->metadata().timestamp;\n-\t\tuint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp / 1000);\n+\t\tuint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp);\n \n \t\tctrl.set(controls::SensorTimestamp, sensorTimestamp);\n \t\tctrl.set(controls::FrameWallClock, wallClockTimestamp);\ndiff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\nindex 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 \t\t */\n \t\twallClockRecovery_.addSample();\n \t\tuint64_t sensorTimestamp = buffer->metadata().timestamp;\n-\t\tuint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp / 1000);\n+\t\tuint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp);\n \n \t\tctrl.set(controls::SensorTimestamp, sensorTimestamp);\n \t\tctrl.set(controls::FrameWallClock, wallClockTimestamp);\n","prefixes":["v1","2/2"]}