{"id":21512,"url":"https://patchwork.libcamera.org/api/1.1/patches/21512/?format=json","web_url":"https://patchwork.libcamera.org/patch/21512/","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":"<20241004115558.9166-2-david.plowman@raspberrypi.com>","date":"2024-10-04T11:55:53","name":"[1/6] controls: rpi: Add controls for the camera sync algorithm","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"ba808df79a0db6dcd2e48353bafc9e6bed0dbb63","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/1.1/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21512/mbox/","series":[{"id":4658,"url":"https://patchwork.libcamera.org/api/1.1/series/4658/?format=json","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/21512/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21512/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 DEAB0BD80A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  4 Oct 2024 11:56:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B58B76352C;\n\tFri,  4 Oct 2024 13:56:06 +0200 (CEST)","from mail-wr1-x435.google.com (mail-wr1-x435.google.com\n\t[IPv6:2a00:1450:4864:20::435])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 898FB62C8F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  4 Oct 2024 13:56:03 +0200 (CEST)","by mail-wr1-x435.google.com with SMTP id\n\tffacd0b85a97d-37cca239886so1274633f8f.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 04 Oct 2024 04:56:03 -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=\"dN8Y26yz\"; 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=/+QeznJmVtfJhdoE5niV18EGr1SvQlkkgJ2zxe7NDGY=;\n\tb=dN8Y26yzt5WjmV3vtX6+wWAWwaIjeMxzxqYUcdDZSlqyJdfKzlNeTuJYJOXXXBVpY7\n\t6yhrFf3U3VuWPIskENVscuhkRl5hLFfxuCuPrL8LMFoVOr9XPTiZQKQSTpTAF+wv2CN6\n\tQp9Q6KnsjQ4i99JK3fkJVrAIttnQvNYOrY+XbVqtylTT/vnBC6+YtbFn4g58oA++xw5b\n\tXJ+SmLGOnZ1LF8QERzII5rd24zWdovadvkCbhkRgGIRLdBYFZlY72s1pPdwQDBJ7KdDQ\n\t8WkmNtV5bRi21En4YBYsTNRtd5VCa0CKAy86LWUm4Eu4/JgFtHu9Zpqa6BeNjNe0cee9\n\t91xw==","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=/+QeznJmVtfJhdoE5niV18EGr1SvQlkkgJ2zxe7NDGY=;\n\tb=ZhpNTEHvVwwNvSVe/hru7mC0xvLbjwYgXPPisclU2wkqX7M5rPdQqcBpIEszz/4HuK\n\trOGwN7/hMkS4OkJTWrqmeBgrEA+MpVPv+2CkJ/ygD1bb0xfRbwlTiFgvNGOm8MBRAPSW\n\ttfSSCYdyekslmUmFPC6kwvEy63jNb+cI3WhT85TfBm3pcAmagPIItc/vFPXo8r4RgLnH\n\trrq1VS5xTSC4oPpAOiwsAdmZTMbGjU+mWwaojvdO/GV74uoawe7NpcOL/yhHOC0jM54U\n\tnQSb7bismNt9jO3yUf3vuBnq6WQS14MtLHRsbP7tyO4wYe7SSLR4JYSyU49jfStNG9Hk\n\tK+ww==","X-Gm-Message-State":"AOJu0YwRC6Pe7aUGTuAQl8NDd5yHfXo8wvOYzGfKqbcEa5VHrp/bSmI3\n\tlN5+DIdPM1bRajmwDbDYppvPwAa+pAIv5bI6asMloV0As4X+0cfGgzWVDBemWaL1jXpue/mcVFL\n\tU","X-Google-Smtp-Source":"AGHT+IGjx0fS5C7bqF5N73ZKjOKeyVP4nzVMjBqPgZBJgDMLhh1GbZFL4SOIQS4Yj8q/aJdRBuTelQ==","X-Received":"by 2002:a5d:64c8:0:b0:368:5ba0:622 with SMTP id\n\tffacd0b85a97d-37d0eafa3a2mr2132091f8f.44.1728042962696; \n\tFri, 04 Oct 2024 04:56:02 -0700 (PDT)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"David Plowman <david.plowman@raspberrypi.com>,\n\tArsen Mikovic <arsen.mikovic@raspberrypi.com>,\n\tNaushir Patuck <naush@raspberrypi.com>","Subject":"[PATCH 1/6] controls: rpi: Add controls for the camera sync\n\talgorithm","Date":"Fri,  4 Oct 2024 12:55:53 +0100","Message-Id":"<20241004115558.9166-2-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":"The camera sync algorithm uses the following new controls:\n\nSyncMode - a camera can be a server or client\nSyncWait - whether the sync point has been reached\nSyncLag - how far away from synchronisation a camera was\nSyncFrameWallClock - for passing wall clock time to the IPA.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nSigned-off-by: Arsen Mikovic <arsen.mikovic@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/libcamera/control_ids_rpi.yaml | 76 ++++++++++++++++++++++++++++++\n 1 file changed, 76 insertions(+)","diff":"diff --git a/src/libcamera/control_ids_rpi.yaml b/src/libcamera/control_ids_rpi.yaml\nindex 42c4bf5d..b5605dfa 100644\n--- a/src/libcamera/control_ids_rpi.yaml\n+++ b/src/libcamera/control_ids_rpi.yaml\n@@ -30,4 +30,80 @@ controls:\n \n         \\sa StatsOutputEnable\n \n+  - FrameWallClock:\n+      type: int64_t\n+      description: |\n+        Control that returns the wall clock timestamp of a frame. This\n+        is the \"time since epoch\" value obtained from the system, in\n+        microseconds. This value is likely to be subject to\n+        significantly more jitter than the recorded SensorTimestamp.\n+\n+  - SyncMode:\n+      type: int32_t\n+      description: |\n+        Puts the camera system into sync mode, so that frames can be\n+        temporally synchronised with another camera, either on the same\n+        device, or on a different one.\n+      enum:\n+        - name: SyncModeOff\n+          value: 0\n+          description: Sync not in use.\n+        - name: SyncModeServer\n+          value: 1\n+          description: |\n+            Sync on, act as server. The server broadcasts timing\n+            messages to any clients that are listening, so that the\n+            clients can synchronise their camera frames with the\n+            server's.\n+        - name: SyncModeClient\n+          value: 2\n+          description: |\n+            Sync on, act as client. A client listens for any server\n+            messages, and arranges for its camera frames to synchronise\n+            as closely as possible with the server's. Many clients\n+            can listen out for the same server.\n+\n+  - SyncWait:\n+      type: bool\n+      description: |\n+        When using the camera syncrhonisation algorithm, the server\n+        broadcasts timing information to the client. This also includes\n+        the time (some number of frames in the future) at which it will\n+        tell the application running on the server when to start using\n+        the image frames (the \"ready time\").\n+\n+        The client receives the \"ready time\" from the server, and will\n+        tell the application on its end to start using the frames at\n+        this same moment.\n+\n+        While this control value is true, applications (on both client\n+        and server) should continue to wait.\n+\n+        Once this value is false, it means that this is the frame where\n+        client and server have agreed that it is the first synchronised\n+        frame that should be used by the application.\n+\n+  - SyncLag:\n+      type: int64_t\n+      description: |\n+        The lag is the amount of time since the \"ready time\", at which\n+        the server and client will signal their controlling applications\n+        that the frames are now synchronised and should be used.\n+\n+        Normally, therefore, the value will start negative (the \"ready\n+        time\" is in the future), and increase towards zero, before\n+        becoming positive (the \"ready time\" has elapsed).\n+\n+        Servers always report this value; clients will omit this control\n+        until they have received a message from the server that enables\n+        them to calculate it.\n+\n+        Normally there will be just one frame where the lag value is, or\n+        is very close to, zero - the one for which SyncWait becomes\n+        false. But note that if frames are being dropped, then the \"near\n+        zero\" value, or indeed any other, could be skipped. In these\n+        cases the lag value allows an application to work out exactly\n+        what has happened.\n+\n+        \\sa SyncWait\n ...\n","prefixes":["1/6"]}