Patch Detail
Show a patch.
GET /api/patches/22502/?format=api
{ "id": 22502, "url": "https://patchwork.libcamera.org/api/patches/22502/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22502/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20250109143211.11939-5-david.plowman@raspberrypi.com>", "date": "2025-01-09T14:32:08", "name": "[v3,4/7] pipeline: rpi:: Add wallclock timestamp support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "c91e7c64dcff96672311913c0d42279be040fdb2", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22502/mbox/", "series": [ { "id": 4939, "url": "https://patchwork.libcamera.org/api/series/4939/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4939", "date": "2025-01-09T14:32:04", "name": "Camera synchronisation", "version": 3, "mbox": "https://patchwork.libcamera.org/series/4939/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22502/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22502/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 BFE9EC32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 9 Jan 2025 14:32:26 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 678F468536;\n\tThu, 9 Jan 2025 15:32:26 +0100 (CET)", "from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EF5F5684E2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 9 Jan 2025 15:32:19 +0100 (CET)", "by mail-wr1-x42a.google.com with SMTP id\n\tffacd0b85a97d-3862b40a6e0so571433f8f.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 09 Jan 2025 06:32:19 -0800 (PST)", "from raspberrypi.pitowers.org\n\t([2a00:1098:3142:1f:ffc9:aff6:7f7f:893b])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-38a8e4b80b2sm1952569f8f.80.2025.01.09.06.32.18\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 09 Jan 2025 06:32:18 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"AvJDToAo\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1736433139; x=1737037939;\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=MyqtSsrjam7Je3P1fuyUgnWz9ifuQumfixpMt1SesR8=;\n\tb=AvJDToAoHZSSO8mAaGWWBClu+O2VO6im+UE5Iau8nrVQKPdvcOw0hu588fzi5HJaT4\n\t+YO35Q4vAGVNG3xhUm6PXtJxH7HClxo5CwG0F3wcABBC4mEMl79d0KCETyfmmKTw0+rt\n\tRWSpLJZcPDtvQE9AybcY2nFQGUPbMfiJjnuM6FbX51dzBVTzfJY5Bh2UriDDMJsnCXEP\n\tAbyE1z4XPw0bATJd4UH/fnbjm9z5qQ7X8ce4R7c4qDJ7HP2f1JXlXJinqHLS4fLLtkha\n\tUjUni+zFaF6TlN9b5zynQAHj/g79R75iA3b5NdVV+h5Bl+1GMC3of/NEd0kpQpl9PdSh\n\tQEsg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1736433139; x=1737037939;\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=MyqtSsrjam7Je3P1fuyUgnWz9ifuQumfixpMt1SesR8=;\n\tb=o/FofA25uSJwUgqfj57cbG09lDSNU+byEA4O0f/yk9vwE6vXUt/Z2PjUlpACuE0PYJ\n\tNb8qrYyl/yJHw5NvpJ9WueXJ19GflRwvVdrymP3Gq/pVInTjvaxobT/AJRfrDSeu32TS\n\tW3lfX21OLJhwjP8YrsKZFj3EGze9r+j9GmQcd/9h8XFkhYkNqXHO5lclhN3S3vhRj8Pb\n\tVaoqQ8sEPksWkNjioII45NMIn4qLy75X33DoRRIw0uISKg8MKJkz+Lbaa1pzkv5qQNTP\n\trLtccg6NkaQyUUt1Er1V/7MFUvb9oI7MFHwhsANwet23rdRT4o6Ob+3s7aFlKZcO5QSl\n\tb3lg==", "X-Gm-Message-State": "AOJu0YzGU5sc4387VxI8aRuk2ON5R3sBqP84I8tJ0iGA4SVDWYeRN+KZ\n\tVx8MHpeRMvcMGic5KU+EEYvD2ULSnWgQFvyhIoedEc2kmuUT4MXKJdMG944koC4F98OJvbl9x9E\n\tl", "X-Gm-Gg": "ASbGncsmC3AhbB8JPyrt5xBvFLWR+m8i1SdGoOfovx2IdskxZJa/uDfHPJ4hjj0AUEm\n\t2Vivc69O3Zs/pA98drpQWHD1YyBRSU6+n5V9Tbh/jA2w591hogCdQPxT0pFTXbYPO0ZOay8dYri\n\tSAnYa/Ya5oHANHvzJnd1zuX+2taDZ/NUaCqoZhGSH1k8n8YqCU6K2HUlF0b2dJMwcS1gwD+HGMh\n\tHGaW2W3Hl7aA6RSOonWV+QXrvxDJ182yWbfXbxJsIzEt9hfde8GgFndspKOhxl3blt03chOQ6nU\n\tYWcSEv+r2gXC", "X-Google-Smtp-Source": "AGHT+IEIIp/CBeq9Y5yD9yFHh7cQhsebEOG/gj/u8RRQhR/Xpq/nx7Mog1Bh2vaL9BTZPcUVKlJoXQ==", "X-Received": "by 2002:a05:6000:18a8:b0:388:c790:1dff with SMTP id\n\tffacd0b85a97d-38a8733fd71mr4965527f8f.47.1736433139182; \n\tThu, 09 Jan 2025 06:32:19 -0800 (PST)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "David Plowman <david.plowman@raspberrypi.com>", "Subject": "[PATCH v3 4/7] pipeline: rpi:: Add wallclock timestamp support", "Date": "Thu, 9 Jan 2025 14:32:08 +0000", "Message-Id": "<20250109143211.11939-5-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.39.5", "In-Reply-To": "<20250109143211.11939-1-david.plowman@raspberrypi.com>", "References": "<20250109143211.11939-1-david.plowman@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": "A ClockRecovery object is added for derived classes to use, and\nwallclock timetamps are copied into the request metadata for\napplications.\n\nIn the derived class, wallclock timestamps are derived corresponding\nto the sensor timestamp, and made available to the base pipeline\nhandler class.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 5 +++++\n src/libcamera/pipeline/rpi/common/pipeline_base.h | 3 +++\n src/libcamera/pipeline/rpi/vc4/vc4.cpp | 10 ++++++++--\n 3 files changed, 16 insertions(+), 2 deletions(-)", "diff": "diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex 4b147fdb..56f3c4df 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -686,6 +686,9 @@ int PipelineHandlerBase::start(Camera *camera, const ControlList *controls)\n \t\treturn ret;\n \t}\n \n+\t/* A good moment to add an initial clock sample. */\n+\tdata->wallClockRecovery_.addSample();\n+\n \t/*\n \t * Reset the delayed controls with the gain and exposure values set by\n \t * the IPA.\n@@ -1510,6 +1513,8 @@ void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request\n {\n \trequest->metadata().set(controls::SensorTimestamp,\n \t\t\t\tbufferControls.get(controls::SensorTimestamp).value_or(0));\n+\trequest->metadata().set(controls::FrameWallClock,\n+\t\t\t\tbufferControls.get(controls::FrameWallClock).value_or(0));\n \n \tif (cropParams_.size()) {\n \t\tstd::vector<Rectangle> crops;\ndiff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h\nindex aae0c2f3..ca706bf3 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.h\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h\n@@ -20,6 +20,7 @@\n #include \"libcamera/internal/bayer_format.h\"\n #include \"libcamera/internal/camera.h\"\n #include \"libcamera/internal/camera_sensor.h\"\n+#include \"libcamera/internal/clock_recovery.h\"\n #include \"libcamera/internal/framebuffer.h\"\n #include \"libcamera/internal/media_device.h\"\n #include \"libcamera/internal/media_object.h\"\n@@ -177,6 +178,8 @@ public:\n \n \tConfig config_;\n \n+\tClockRecovery wallClockRecovery_;\n+\n protected:\n \tvoid fillRequestMetadata(const ControlList &bufferControls,\n \t\t\t\t Request *request);\ndiff --git a/src/libcamera/pipeline/rpi/vc4/vc4.cpp b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\nindex fd8d84b1..3d8c65c6 100644\n--- a/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n+++ b/src/libcamera/pipeline/rpi/vc4/vc4.cpp\n@@ -781,9 +781,15 @@ void Vc4CameraData::unicamBufferDequeue(FrameBuffer *buffer)\n \t\tauto [ctrl, delayContext] = delayedCtrls_->get(buffer->metadata().sequence);\n \t\t/*\n \t\t * Add the frame timestamp to the ControlList for the IPA to use\n-\t\t * as it does not receive the FrameBuffer object.\n+\t\t * as it does not receive the FrameBuffer object. Also derive a\n+\t\t * corresponding wallclock value.\n \t\t */\n-\t\tctrl.set(controls::SensorTimestamp, buffer->metadata().timestamp);\n+\t\twallClockRecovery_.addSample();\n+\t\tuint64_t sensorTimestamp = buffer->metadata().timestamp;\n+\t\tuint64_t wallClockTimestamp = wallClockRecovery_.getOutput(sensorTimestamp / 1000);\n+\n+\t\tctrl.set(controls::SensorTimestamp, sensorTimestamp);\n+\t\tctrl.set(controls::FrameWallClock, wallClockTimestamp);\n \t\tbayerQueue_.push({ buffer, std::move(ctrl), delayContext });\n \t} else {\n \t\tembeddedQueue_.push(buffer);\n", "prefixes": [ "v3", "4/7" ] }