Show a patch.

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

{
    "id": 11301,
    "url": "https://patchwork.libcamera.org/api/patches/11301/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11301/",
    "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": "<20210216085342.1012717-3-naush@raspberrypi.com>",
    "date": "2021-02-16T08:53:39",
    "name": "[libcamera-devel,v2,2/5] utils: raspberrypi: Add a DelayedControls log parser",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d3346342feced917ac3b4e0897f98526d9847ef6",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": {
        "id": 16,
        "url": "https://patchwork.libcamera.org/api/users/16/?format=api",
        "username": "neg",
        "first_name": "Niklas",
        "last_name": "Söderlund",
        "email": "niklas.soderlund@ragnatech.se"
    },
    "mbox": "https://patchwork.libcamera.org/patch/11301/mbox/",
    "series": [
        {
            "id": 1694,
            "url": "https://patchwork.libcamera.org/api/series/1694/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1694",
            "date": "2021-02-16T08:53:37",
            "name": "DelayedControls updates and fixes",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/1694/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11301/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11301/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 B9B72BD1EF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 16 Feb 2021 08:53:52 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BEC52637E4;\n\tTue, 16 Feb 2021 09:53:51 +0100 (CET)",
            "from mail-wr1-x430.google.com (mail-wr1-x430.google.com\n\t[IPv6:2a00:1450:4864:20::430])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 952B0637CC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Feb 2021 09:53:49 +0100 (CET)",
            "by mail-wr1-x430.google.com with SMTP id t15so11940932wrx.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Feb 2021 00:53:49 -0800 (PST)",
            "from naush-laptop.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\te1sm9300369wrd.44.2021.02.16.00.53.47\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 16 Feb 2021 00:53:48 -0800 (PST)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"imi5vIDH\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=+ImmBSuKB64yJiFyMrEt9UThLRyd9r3D1+xm3Snp0RU=;\n\tb=imi5vIDHQahPJzkjIAym22LGcN2fG5SZPBqMSJwZV0FGCK2sh2lVBrVGyKpd4J/pMz\n\tx1vC0xRGd+MP2nagfN+qtaC+rA20ZyJmODscLtAlGNvMaC+NHNKN1CTybEcYILKH72cq\n\tO+XpHOzJuj8XdAPyUED/OJ736aZLsviGXtE5IZ/rqINaJw0JB/nG8jlC3eQ5FHWvDC0s\n\teeeRE1xzczYxdUMi6ZVLsTUk2J2ObEdjXHNvDoBnHEnFVqO5AVPX7wp2xNdXrwqH8C1k\n\tIDzC8Pr1amoOHBQCSwQBuTqbHITwtVgNsn1UPQg2N1PtfvIVqLHH9MrKQll0jkAmPHgb\n\tXQJQ==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=+ImmBSuKB64yJiFyMrEt9UThLRyd9r3D1+xm3Snp0RU=;\n\tb=ZOxDBvjaWSjvR7gkVxH2yXjzvOU3jnNsYI7SYudl+BYRhl3aFNX5rAjvwYJHEdh9TV\n\tT5+paczf6Z24QxV7w7wD/D0aGOaebl+VZjTOCMIGpdM5gmfc7wv70XE0sXnDn3aeWQmU\n\tKeAU+rC09oyZpSWiL/RTc8FLkVm6/Gv6xmhf+c321oNdZSv33yCxkARF1lBpc5fbFGT9\n\tRnBIqCzdFPOQKOa0D2AX75SVzi4ZMMlAqvYehghYhT+d0qwcdr8bzroCD5BIOGHOGgy0\n\t0OKufoDTNd32Vue/CPx+Ps94SiJ4vnbksbuGIJAsRDLO9wNZgolLfgOnpaRkV1bcE4SR\n\tE+AA==",
        "X-Gm-Message-State": "AOAM531RuO/+a23em01+S4ho32Fs9k/7bVHBg02YGgs1o5yLEMDIG4pg\n\tM7ir27m5wh9CkHUyeU7fuLzqnKXqPZQEZ9bF",
        "X-Google-Smtp-Source": "ABdhPJzY1mfybuTppVcnxFDLGczNKPMujgvVyprKVVjs4yiMpsi5r2b1BuW0EFha+cO1Zjrb9Uyz0Q==",
        "X-Received": "by 2002:a05:6000:108f:: with SMTP id\n\ty15mr22895022wrw.195.1613465628622; \n\tTue, 16 Feb 2021 00:53:48 -0800 (PST)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Tue, 16 Feb 2021 08:53:39 +0000",
        "Message-Id": "<20210216085342.1012717-3-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210216085342.1012717-1-naush@raspberrypi.com>",
        "References": "<20210216085342.1012717-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v2 2/5] utils: raspberrypi: Add a\n\tDelayedControls log parser",
        "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>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "This script will parse log output from the DelayedControls helper, when\nenabled with:\n\nLIBCAMERA_LOG_LEVELS=DelayedControls:0\n\nIt tabulates all control queuing/writing/getting per frame and warns\nabout potential issues related to frame delays not being account for, or\nwrites that are lagging behind or missed.\n\nRun with the following command:\n\npython3 ./delayedctrls_parse.py <logfile>\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n utils/raspberrypi/delayedctrls_parse.py | 98 +++++++++++++++++++++++++\n 1 file changed, 98 insertions(+)\n create mode 100644 utils/raspberrypi/delayedctrls_parse.py",
    "diff": "diff --git a/utils/raspberrypi/delayedctrls_parse.py b/utils/raspberrypi/delayedctrls_parse.py\nnew file mode 100644\nindex 000000000000..20c92fb620e6\n--- /dev/null\n+++ b/utils/raspberrypi/delayedctrls_parse.py\n@@ -0,0 +1,98 @@\n+import re\n+import sys\n+import os\n+\n+if len(sys.argv) != 2:\n+    print(\"Usage: {} <infile>\".format(sys.argv[0]))\n+    sys.exit()\n+\n+infile = sys.argv[1]\n+insplit = os.path.splitext(infile)\n+outfile = insplit[0] + '_parsed' + insplit[1]\n+\n+frame_re = re.compile('frame (\\d+) started')\n+\n+delays = {'Analogue Gain': 1, 'Exposure': 2, 'Vertical Blanking': 2}\n+ctrl_action = {'Write': {}, 'Get': {}, 'Queue': {}, 'No-op': {}}\n+ctrl_re = {'Write': re.compile('Setting (.*?) to (\\d+) at index (\\d+)'),\n+           'No-op': re.compile('Queue is empty, (.*?) (.*?) (.*?)'),\n+           'Get': re.compile('Reading (.*?) to (\\d+) at index (\\d+)'),\n+           'Queue': re.compile('Queuing (.*?) to (\\d+) at index (\\d+)')}\n+\n+frame_num = -1\n+\n+max_delay = 0\n+for k, d in delays.items():\n+    if max_delay < d:\n+        max_delay = d\n+\n+with open(infile) as f:\n+    lines = f.readlines()\n+\n+for line in lines:\n+    r = frame_re.search(line)\n+    if r:\n+        frame_num = int(r.group(1))\n+\n+    for (key, re) in ctrl_re.items():\n+        r = re.search(line)\n+        if r:\n+            ctrl_action[key][(frame_num, r.group(1))] = (r.group(2), r.group(3))\n+\n+with open(outfile, 'wt') as f:\n+    queueIndex = 1\n+    f.write('{:<10}{:<15}{:<12}{:<18}{}\\n'.format('Frame', 'Action', 'Gain', 'Exposure', 'Vblank'))\n+    for frame in range(0, frame_num + 1):\n+        for (k, a) in ctrl_action.items():\n+            str = '{:<10}{:<10}'.format(frame, k)\n+\n+            for c in delays.keys():\n+                # Tabulate all results\n+                str += '{:>5} {:<10}'.format(a[(frame, c)][0] if (frame, c) in a.keys() else '---',\n+                                             '[' + (a[(frame, c)][1] if (frame, c) in a.keys() else '-') + ']')\n+\n+            f.write(str.strip() + '\\n')\n+\n+# Test the write -> get matches the set delay.\n+for (frame, c) in ctrl_action['Write'].keys():\n+    set_value = ctrl_action['Write'][(frame, c)][0]\n+    delay_frame = frame + delays[c]\n+    if (delay_frame <= frame_num):\n+        if (delay_frame, c) in ctrl_action['Get']:\n+            get_value = ctrl_action['Get'][(delay_frame, c)][0]\n+            if get_value != set_value:\n+                print('Error: {} written at frame {} to value {} != {} at frame {}'\n+                      .format(c, frame, set_value, get_value, delay_frame))\n+        else:\n+            print('Warning: {} written at frame {} to value {} did not get logged on frame {} - dropped frame?'\n+                  .format(c, frame, set_value, delay_frame))\n+\n+# Test the queue -> write matches the set delay.\n+for (frame, c) in ctrl_action['Queue'].keys():\n+    set_value = ctrl_action['Queue'][(frame, c)][0]\n+    delay_frame = frame + max_delay - delays[c] + 1\n+    if (delay_frame <= frame_num):\n+        if (delay_frame, c) in ctrl_action['Write']:\n+            write_value = ctrl_action['Write'][(delay_frame, c)][0]\n+            if write_value != set_value:\n+                print('Info: {} queued at frame {} to value {} != {} written at frame {}'\n+                      ' - lagging behind or double queue on a single frame!'\n+                      .format(c, frame, set_value, write_value, delay_frame))\n+        else:\n+            print('Warning: {} queued at frame {} to value {} did not get logged on frame {} - dropped frame?'\n+                  .format(c, frame, set_value, delay_frame))\n+\n+# Test the get -> write matches the set delay going backwards.\n+for (frame, c) in ctrl_action['Get'].keys():\n+    get_value = ctrl_action['Get'][(frame, c)][0]\n+    delay_frame = frame - delays[c]\n+    if (delay_frame >= 6):\n+        if (delay_frame, c) in ctrl_action['Write']:\n+            write_value = ctrl_action['Write'][(delay_frame, c)][0]\n+            if get_value != write_value:\n+                print('Info: {} got at frame {} to value {} != {} written at frame {}'\n+                      ' - lagging behind or double queue on a single frame!'\n+                      .format(c, frame, get_value, write_value, delay_frame))\n+        else:\n+            print('Warning: {} got at frame {} to value {} did not get written on frame {}'\n+                  .format(c, frame, get_value, delay_frame))\n",
    "prefixes": [
        "libcamera-devel",
        "v2",
        "2/5"
    ]
}