Show a patch.

GET /api/patches/21513/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 21513,
    "url": "https://patchwork.libcamera.org/api/patches/21513/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21513/",
    "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": "<20241004115558.9166-3-david.plowman@raspberrypi.com>",
    "date": "2024-10-04T11:55:54",
    "name": "[2/6] pipeline: rpi: Add queue of wallclock timestamps",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "44532fa90aeac73c1188bff01624adf4e09408c4",
    "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/21513/mbox/",
    "series": [
        {
            "id": 4658,
            "url": "https://patchwork.libcamera.org/api/series/4658/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4658",
            "date": "2024-10-04T11:55:52",
            "name": "Raspberry Pi software camera sync algorithm",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4658/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21513/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21513/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 88654BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  4 Oct 2024 11:56:14 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5CAA863530;\n\tFri,  4 Oct 2024 13:56:12 +0200 (CEST)",
            "from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n\t[IPv6:2a00:1450:4864:20::329])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4C3FD63524\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  4 Oct 2024 13:56:04 +0200 (CEST)",
            "by mail-wm1-x329.google.com with SMTP id\n\t5b1f17b1804b1-42e748f78d6so18538215e9.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 04 Oct 2024 04:56:04 -0700 (PDT)",
            "from raspberrypi.pitowers.org\n\t([2a00:1098:3142:1f:daa2:371b:a97:3e3e])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-37d081f743esm3107147f8f.21.2024.10.04.04.56.02\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 04 Oct 2024 04:56:02 -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=\"cvKvB1Lz\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1728042963; x=1728647763;\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=m60dYGWd9WItWVLwXEyJ3xnk5Efq/SYRBpGuZAumOCc=;\n\tb=cvKvB1LztbUKQHOzW+i69zeTVKC6rfU6S4AkNS1zMalubwvVFilVcfGSXoZlsVa8C+\n\tmge5irmj1Dn1bFnEeuyLPUvp8r9ScJcIcxOGFPWcFicH0KPRpvfXy03u5K3OlpxqeXz5\n\t1Ob05EFyc9ebNuo97O4RTaM8NpjF+MhRfXXnoDCDGbC1irFMlRApIjFL7DQLBS6m0C2b\n\tWBwKb03duGs7WMGtz62XTpRAUZ+FDQLwwAYyMR+ZRdMgB7ysRiUKotp3T62LuaRoDfiP\n\tzAH+Xrg8cbis9NJjgyzkPat+yrxNoQ/+McxdcrIkwALmigKyih8JmjSTmFg0ZDFyemMo\n\tfIBg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1728042963; x=1728647763;\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=m60dYGWd9WItWVLwXEyJ3xnk5Efq/SYRBpGuZAumOCc=;\n\tb=R3pr72F23ID8bygG0wSNjYV20LPPGcGQ387qD5fZpR6NdrubQmy50FJgPkF7W12e0K\n\tXVwwNQsf3ua786MfUJQDTzfIYdzHvIIcgUmOktVihVB7ZWpY4aCozirZ/X6sIpsnX7zh\n\tvCQxXMG4bkANhpizFQLFZyVw/NIzjqIKC95tBLLjj/VWjZ+h/dn7+LDyKhXZ7nN7obrk\n\tuFcLiQo4pVePZ6CJ/yggSVdDZdaxnDcUkoKXp0Ay/D8iFmbns/p1k2uvfwXwO21UAPZ0\n\tBYcpxRp14ENx4xhjWs14TbbcKZ06ykuoeAV3htgynuDTHCtdQbDGnO43YrssfdEu6uHi\n\tK11Q==",
        "X-Gm-Message-State": "AOJu0Yx9+YzbMFJBYTM2oiLDgtHWD9fVVAcdbm6qLqe44nBsnKJwOfHS\n\tlKtAqxp8cXmyCSQFQpxUjx8uP1pNgRHun7d/KsJWbf380oHPhXOKbNF98x/NemIcVOKBiaG3TSe\n\tC",
        "X-Google-Smtp-Source": "AGHT+IHz1gvW0tNf8QpT1yvW+NcTJuny1KzCpe5X12VUmadgkeykxN67q3LVJYvONwJf5K9ml2wK0A==",
        "X-Received": "by 2002:adf:a18e:0:b0:37c:d54c:a41 with SMTP id\n\tffacd0b85a97d-37d0e7d53f9mr1229535f8f.54.1728042963361; \n\tFri, 04 Oct 2024 04:56:03 -0700 (PDT)",
        "From": "David Plowman <david.plowman@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Naushir Patuck <naush@raspberrypi.com>,\n\tDavid Plowman <david.plowman@raspberrypi.com>",
        "Subject": "[PATCH 2/6] pipeline: rpi: Add queue of wallclock timestamps",
        "Date": "Fri,  4 Oct 2024 12:55:54 +0100",
        "Message-Id": "<20241004115558.9166-3-david.plowman@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.39.5",
        "In-Reply-To": "<20241004115558.9166-1-david.plowman@raspberrypi.com>",
        "References": "<20241004115558.9166-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": "From: Naushir Patuck <naush@raspberrypi.com>\n\nSubsequent commits will add actual values to this queue, which we can\nthen use for sending wallclock timestamps over to the IPAs, where a\nfuture \"synchonisation algorithm\" can use them.\n\nAlso add code to return the wallclock time to the application through\nthe frame metadata.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/libcamera/pipeline/rpi/common/pipeline_base.cpp | 9 +++++++++\n src/libcamera/pipeline/rpi/common/pipeline_base.h   | 2 ++\n 2 files changed, 11 insertions(+)",
    "diff": "diff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\nindex 3041fd1e..253fac96 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.cpp\n@@ -676,6 +676,7 @@ int PipelineHandlerBase::start(Camera *camera, const ControlList *controls)\n \t */\n \tdata->delayedCtrls_->reset(0);\n \tdata->state_ = CameraData::State::Idle;\n+\tdata->frameWallClock_ = {};\n \n \t/* Enable SOF event generation. */\n \tdata->frontendDevice()->setFrameStartEnabled(true);\n@@ -1353,6 +1354,11 @@ void CameraData::cameraTimeout()\n \n void CameraData::frameStarted(uint32_t sequence)\n {\n+\t/* Get frame wall clock. */\n+\tauto now = std::chrono::system_clock::now();\n+\tauto durNow = std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch());\n+\tframeWallClock_.emplace(sequence, durNow);\n+\n \tLOG(RPI, Debug) << \"Frame start \" << sequence;\n \n \t/* Write any controls for the next frame as soon as we can. */\n@@ -1483,6 +1489,9 @@ void CameraData::fillRequestMetadata(const ControlList &bufferControls, Request\n \trequest->metadata().set(controls::SensorTimestamp,\n \t\t\t\tbufferControls.get(controls::SensorTimestamp).value_or(0));\n \n+\trequest->metadata().set(controls::rpi::FrameWallClock,\n+\t\t\t\tbufferControls.get(controls::rpi::FrameWallClock).value_or(0));\n+\n \trequest->metadata().set(controls::ScalerCrop, scalerCrop_);\n }\n \ndiff --git a/src/libcamera/pipeline/rpi/common/pipeline_base.h b/src/libcamera/pipeline/rpi/common/pipeline_base.h\nindex f9cecf70..b7f5470f 100644\n--- a/src/libcamera/pipeline/rpi/common/pipeline_base.h\n+++ b/src/libcamera/pipeline/rpi/common/pipeline_base.h\n@@ -163,6 +163,8 @@ public:\n \n \tConfig config_;\n \n+\tstd::queue<std::pair<uint64_t, utils::Duration>> frameWallClock_;\n+\n protected:\n \tvoid fillRequestMetadata(const ControlList &bufferControls,\n \t\t\t\t Request *request);\n",
    "prefixes": [
        "2/6"
    ]
}