{"id":22258,"url":"https://patchwork.libcamera.org/api/patches/22258/?format=json","web_url":"https://patchwork.libcamera.org/patch/22258/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20241209162747.2961-2-david.plowman@raspberrypi.com>","date":"2024-12-09T16:27:47","name":"[1/1] controls: Add camera synchronisation controls","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"49ff45bbdfc7c295fd733b154c0d983fef737de7","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/22258/mbox/","series":[{"id":4866,"url":"https://patchwork.libcamera.org/api/series/4866/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4866","date":"2024-12-09T16:27:47","name":"Camera synchonrisation controls","version":1,"mbox":"https://patchwork.libcamera.org/series/4866/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/22258/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/22258/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 52A22BE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  9 Dec 2024 16:27:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A3E3467E6E;\n\tMon,  9 Dec 2024 17:27:53 +0100 (CET)","from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com\n\t[IPv6:2a00:1450:4864:20::32d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 93A1467E5F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  9 Dec 2024 17:27:51 +0100 (CET)","by mail-wm1-x32d.google.com with SMTP id\n\t5b1f17b1804b1-434f3d934fcso9467575e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 09 Dec 2024 08:27:51 -0800 (PST)","from raspberrypi.pitowers.org\n\t([2a00:1098:3142:1f:c68a:6be1:5ba3:eddd])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-434f2b08972sm67631325e9.27.2024.12.09.08.27.50\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 09 Dec 2024 08:27:50 -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=\"O8hsH5hy\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1733761671; x=1734366471;\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=/JZQehJkjkg/nlRQ144f+Imy3KC1ThU+0sq9ZOmOejk=;\n\tb=O8hsH5hy68lm2KeOO+FusaRCEiz6SwvNWxa3OOhn4/tIftHXT4tREF0cHq+f8yfXqp\n\thRcAOWDgxfsrY+AMJv6gFJPYQik9cmeb63SP06lx09qOqFtVJkaGaxiyuley9aP3q7NO\n\t8xivVMqC8Z4cIQw663IbNm8PbBKKEXZt0pfZDkbsqZhKx9ENKzjxeEOcMJq/jPjPIVxn\n\tu6BL6BaL2YNge6sArhtMFagowNeriA5ZZkbr5KKlSlLovBQRalFFaBSGdUnzmdnDIXgf\n\tO8PON4NNMNQjUCAdkq5mHZkzvCWHncr+jitSVI3k0SOsxVSOXI6sBiFcySy57SwqFeNw\n\tBziQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1733761671; x=1734366471;\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=/JZQehJkjkg/nlRQ144f+Imy3KC1ThU+0sq9ZOmOejk=;\n\tb=emLeBOY/s7ocxgjp6gvNmfxzPisvBoNZ/Fw5EJDAIanzwS9Ddxpg/hXggBEFlGzwuW\n\thhKHi5ywtIA3E8Vzb5FSViaNdcC6NXjtrvSka/4RKTrTYPvmlNMycU7MyVk1Ku/gwnW7\n\tr5vCze1l3nizzzaI9x4mOBwl3e/9xgEPU608etmdH0rmcbbttALdZuOk0n7O/ZqSrYVz\n\tp51ah64f5dLcqjJ3YjU+B9WYW973tWIUdrKFvvYJ8PDxcbbyt4e7aaZkNLfd3JpUtbxc\n\tpc9GEsPPSTLdlcz24KkTdQJxTSMFMmuakX3F11L6c5triYdMPdos/sfo/rG6m/yiBSRs\n\tnFog==","X-Gm-Message-State":"AOJu0YyRwd9zF1R1tzre0+sm6kHo5/ZbP7KFybZBukSzk9pBCRYeXe3Q\n\tuk+yrpZbeEw8U4Fkr2sgOFl8MNSz70uQldS3pNFFes6uWgSFh7GcuknV6Avs4HAlMWHg5842aMP\n\tx","X-Gm-Gg":"ASbGncs1Bw5pHbUO63lQJcTZxp3Ygg4ZSE3nnPFt5N5i11CdG+YPnfLpQs/JY0/tM52\n\tc4t8qB77AEd2ctgeSFmu/VdN0bn3QTWIi1CnsjjkOW1iXbMAjufPpzwD5t6mbji9UQNy7Jyprh9\n\tKFhECrZ8y/xsDkkUMqW0VgC/lOWNo3IjeUsKUA3CH38U4CH008IHO8GJ5/wbEVDyAJKDGnXTeqd\n\tby7ieZuVKKo/u7Uk7aZ9GVxZK5OlGSfg6i2xVJ6OY8GTSajUji6dylKPKqP/NZkQW50LtYxKrrt\n\tbYD7Ew==","X-Google-Smtp-Source":"AGHT+IErfOkbpUMgZjbG1oSYM86SiComIBk3WfyNYDGgoxg3pTD78w/1f1xMbLcCv/8iytPjdaLUmw==","X-Received":"by 2002:a05:600c:1c21:b0:434:f82b:c5e6 with SMTP id\n\t5b1f17b1804b1-434fff5b64fmr9754375e9.1.1733761670826; \n\tMon, 09 Dec 2024 08:27:50 -0800 (PST)","From":"David Plowman <david.plowman@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"David Plowman <david.plowman@raspberrypi.com>","Subject":"[PATCH 1/1] controls: Add camera synchronisation controls","Date":"Mon,  9 Dec 2024 16:27:47 +0000","Message-Id":"<20241209162747.2961-2-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.39.5","In-Reply-To":"<20241209162747.2961-1-david.plowman@raspberrypi.com>","References":"<20241209162747.2961-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":"New controls are added to control the camera \"sync\" algorithm, which\nallows different cameras to synchronise their frames.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/libcamera/control_ids_core.yaml | 104 ++++++++++++++++++++++++++++\n 1 file changed, 104 insertions(+)","diff":"diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml\nindex d45cf8e5..6d45b757 100644\n--- a/src/libcamera/control_ids_core.yaml\n+++ b/src/libcamera/control_ids_core.yaml\n@@ -971,4 +971,108 @@ controls:\n       description: |\n         Enable or disable the debug metadata.\n \n+  - SyncMode:\n+      type: int32_t\n+      description: |\n+        Enable or disable camera synchronisation (\"sync\") mode.\n+\n+        When sync mode is enabled, a camera will synchronise frames temporally\n+        with other cameras, either attached to the same device or a different\n+        one. There should be one \"server\" device, which broadcasts timing\n+        information to one or more \"clients\".\n+\n+        Sync mode requires all cameras to be running at (as far as possible) the\n+        same fixed framerate, and may continue to make adjustments to keep the\n+        cameras together for the duration of the session.\n+\n+      enum:\n+        - name: SyncModeOff\n+          value: 0\n+          description: Disable sync mode.\n+        - name: SyncModeServer\n+          value: 1\n+          description: |\n+            Enable sync mode, act as server. The server broadcasts timing\n+            messages to any clients that are listening, so that the clients can\n+            synchronise their camera frames with the server's.\n+        - name: SyncModeClient\n+          value: 2\n+          description: |\n+            Enable sync mode, act as client. A client listens for any server\n+            messages, and arranges for its camera frames to synchronise as\n+            closely as possible with the server's. Many clients can listen out\n+            for the same server. Clients can also be started ahead of any\n+            servers, causing them merely to wait for the server to start.\n+\n+        \\sa SyncReady\n+        \\sa SyncTimer\n+        \\sa SyncFrames\n+\n+  - SyncReady:\n+      type: bool\n+      description: |\n+        When using the camera synchronisation algorithm, the server broadcasts\n+        timing information to the clients. This also includes the time (some\n+        number of frames in the future, called the \"ready time\") at which the\n+        server will signal its controlling application, using this control, to\n+        start using the image frames.\n+\n+        The client receives the \"ready time\" from the server, and will signal\n+        its application to start using the frames at this same moment.\n+\n+        While this control value is false, applications (on both client and\n+        server) should continue to wait, and not use the frames.\n+\n+        Once this value becomes true, it means that this is the first frame\n+        where client and server have agreed that they will both be synchronised\n+        and that applications should begin consuming frames.\n+\n+        \\sa SyncMode\n+        \\sa SyncTImer\n+        \\sa SyncFrames\n+\n+  - SyncTimer:\n+      type: int64_t\n+      description: |\n+        This reports the amount of time, in microseconds, until the \"ready\n+        time\", at which the server and client will signal their controlling\n+        applications that the frames are now synchronised and should be\n+        used. The value may be refined slightly over time, becoming more precise\n+        as the \"ready time\" approaches.\n+\n+        Servers always report this value, whereas clients will omit this control\n+        until they have received a message from the server that enables them to\n+        calculate it.\n+\n+        Normally the value will start positive (the \"ready time\" is in the\n+        future), and decrease towards zero, before becoming negative (the \"ready\n+        time\" has elapsed). So there should be just one frame where the timer\n+        value is, or is very close to, zero - the one for which the SyncReady\n+        control becomes true. At this moment, the value indicates how closely\n+        synchronised the client believes it is with the server.\n+\n+        But note that if frames are being dropped, then the \"near zero\" valued\n+        frame, or indeed any other, could be skipped. In these cases the timer\n+        value allows an application to deduce that this has happened.\n+\n+        \\sa SyncMode\n+        \\sa SyncReady\n+        \\sa SyncFrames\n+\n+  - SyncFrames:\n+      type: int32_t\n+      description: |\n+        The number of frames the server should wait, after enabling\n+        SyncModeServer, before signalling (via the SyncReady control) that\n+        frames should be used. This therefore determines the \"ready time\" for\n+        all synchronised cameras.\n+\n+        This control value should be set only for the device that is to act as\n+        the server, before or at the same moment that SyncModeServer is\n+        enabled.\n+\n+        \\sa SyncMode\n+        \\sa SyncReady\n+        \\sa SyncTimer\n+\n ...\n","prefixes":["1/1"]}