Show a patch.

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

{
    "id": 11492,
    "url": "https://patchwork.libcamera.org/api/patches/11492/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11492/",
    "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": "<20210304081728.1058394-7-naush@raspberrypi.com>",
    "date": "2021-03-04T08:17:27",
    "name": "[libcamera-devel,v4,6/7] test: delayed_controls: Fixup tests after recent DelayedControls changes",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "f940639da2d45a6ba05f702903c34952e94a4078",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/11492/mbox/",
    "series": [
        {
            "id": 1757,
            "url": "https://patchwork.libcamera.org/api/series/1757/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1757",
            "date": "2021-03-04T08:17:21",
            "name": "DelayedControls updates and fixes",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/1757/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11492/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11492/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 14CAFBD80E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Mar 2021 08:17:46 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C50C368AB0;\n\tThu,  4 Mar 2021 09:17:45 +0100 (CET)",
            "from mail-wm1-x335.google.com (mail-wm1-x335.google.com\n\t[IPv6:2a00:1450:4864:20::335])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D40968A98\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Mar 2021 09:17:42 +0100 (CET)",
            "by mail-wm1-x335.google.com with SMTP id\n\to7-20020a05600c4fc7b029010a0247d5f0so4061193wmq.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 04 Mar 2021 00:17:42 -0800 (PST)",
            "from naush-laptop.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tb186sm6997926wmc.44.2021.03.04.00.17.40\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 04 Mar 2021 00:17:41 -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=\"fXEkafgf\"; 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=/2nAUCPXEZmL+MFvY43byb0UcTthYl9RlzZxWH65CNw=;\n\tb=fXEkafgf/sApgd4P6bQA+PGQSV7kmIh93LbsoArrtvXFPduweAs4qfoKsUdfw1XW34\n\tv6DF5bf7brB/LJRYgXiTmwonozwrGygMCATyC1VQwt4TT0qEb43xBAcKWDb2LO+FRTQ9\n\tjGtXMz9FuJXjThWQ3ETLpDC6RZnJJngOdknmrpU0T5ET91eT+ZG77MB+a9KLN1/Qe9Hh\n\tmR4TFCP9Mebw67WZfLKotCRudfUAF+6mV3edMde2B+wgxaxyml1F47YzjnYlIdREYN0w\n\tlDNH1bYXJuVFhgDs8GwyE5lgtVid5dI6/b/zqLnNcXWYI3fcib7sMCDDK2zuOK3tx6KU\n\tQXYQ==",
        "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=/2nAUCPXEZmL+MFvY43byb0UcTthYl9RlzZxWH65CNw=;\n\tb=G9IQZT13VCcaen9W4XxQ6NnOh+jMS0EagKS32vMT81LrpDPX9cj5J9VvFEnjYEWfME\n\tBIhi9NOe5XHu4tnOGfqiZsGbyL7qd7g66/6zvLu2zvVeMJFz+nl1M1uR2rHw12FwnSrk\n\tO0+JKYEYaV/xf8dJs6ersg0WuZCl3zsemHjO4DZ9u/viAA+NMBge5svUVP8iCWXGlimR\n\tW6KZYbFAYPpWxro+BNp+EkGltIWLuNPOHEw6aEfqc8M0wt2/ib1ckvxOHdOmeJ4rKlPc\n\t8LhVjwUJ3VU8z+vHXla3q34ucORH/oZVeIu9pyAudFUeFxJaGLNhQHp0QaA9JIsd4q2A\n\tTrQw==",
        "X-Gm-Message-State": "AOAM533i1Um4AmDhaCa4HJalmjE8INQpixUSjE27a/3MhrEbOIXwI01a\n\trw2DsytbMfmE0pL4Kr2ImoWV4vpIaL4j+tQB",
        "X-Google-Smtp-Source": "ABdhPJzHOM9x7QaLGh5J8vM0/S8GrB41VafjORgnpHRBUVoolhwTSuInwPC9KiifpBwoHqNXWiDuYg==",
        "X-Received": "by 2002:a7b:ce16:: with SMTP id m22mr2676697wmc.65.1614845861571;\n\tThu, 04 Mar 2021 00:17:41 -0800 (PST)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Thu,  4 Mar 2021 08:17:27 +0000",
        "Message-Id": "<20210304081728.1058394-7-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210304081728.1058394-1-naush@raspberrypi.com>",
        "References": "<20210304081728.1058394-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH v4 6/7] test: delayed_controls: Fixup\n\ttests after recent DelayedControls changes",
        "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": "The recent fixes applied to DelayedControls change the behavior of the\nlibrary. As such, the tests ended up failing as they relied on the old\nbehavior of the helper. Update the tests to account for the new behavior\nand get the tests passing again.\n\nSpecifically, the following changes have been made for each test:\n\nsingleControlNoDelay():\n- Add a call to reset() to initialise internal DelayedControls state\nonly after setting the control on the device.\n- Trigger a first frame start by calling applyControls() as a pipeline\nhandler would.\n- Test frames from 1 onwards, as we will never have a queue item at\nframe 0, since the reset() handles that.\n\nsingleControlWithDelay():\n- Trigger a first frame start by calling applyControls() as a pipeline\nhandler would.\n- Test frames from 1 onwards, as we will never have a queue item at\nframe 0, since the reset() handles that.\n\ndualControlsWithDelay() and dualControlsMultiQueue():\n- Trigger a first frame start by calling applyControls() as a pipeline\nhandler would.\n- Test frames from (startOffset + 1) onwards, as we will never have a\nqueue item at frame startOffset.\n- Use the max delay (2 in this case) to determine the expected result\nvalue.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n test/delayed_contols.cpp | 35 ++++++++++++++++++++++++++---------\n 1 file changed, 26 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/test/delayed_contols.cpp b/test/delayed_contols.cpp\nindex 3855eb18ecd4..c6f195b7bc7f 100644\n--- a/test/delayed_contols.cpp\n+++ b/test/delayed_contols.cpp\n@@ -82,9 +82,13 @@ protected:\n \t\t/* Reset control to value not used in test. */\n \t\tctrls.set(V4L2_CID_BRIGHTNESS, 1);\n \t\tdev_->setControls(&ctrls);\n+\t\tdelayed->reset();\n+\n+\t\t/* Trigger the first frame start event */\n+\t\tdelayed->applyControls(0);\n \n \t\t/* Test control without delay are set at once. */\n-\t\tfor (unsigned int i = 0; i < 100; i++) {\n+\t\tfor (unsigned int i = 1; i < 100; i++) {\n \t\t\tint32_t value = 100 + i;\n \n \t\t\tctrls.set(V4L2_CID_BRIGHTNESS, value);\n@@ -122,8 +126,11 @@ protected:\n \t\tdev_->setControls(&ctrls);\n \t\tdelayed->reset();\n \n+\t\t/* Trigger the first frame start event */\n+\t\tdelayed->applyControls(0);\n+\n \t\t/* Test single control with delay. */\n-\t\tfor (unsigned int i = 0; i < 100; i++) {\n+\t\tfor (unsigned int i = 1; i < 100; i++) {\n \t\t\tint32_t value = 10 + i;\n \n \t\t\tctrls.set(V4L2_CID_BRIGHTNESS, value);\n@@ -150,9 +157,11 @@ protected:\n \n \tint dualControlsWithDelay(uint32_t startOffset)\n \t{\n+\t\tstatic const unsigned int maxDelay = 2;\n+\n \t\tstd::unordered_map<uint32_t, DelayedControls::ControlParams> delays = {\n \t\t\t{ V4L2_CID_BRIGHTNESS, { 1, false } },\n-\t\t\t{ V4L2_CID_CONTRAST, { 2, false } },\n+\t\t\t{ V4L2_CID_CONTRAST, { maxDelay, false } },\n \t\t};\n \t\tstd::unique_ptr<DelayedControls> delayed =\n \t\t\tstd::make_unique<DelayedControls>(dev_.get(), delays);\n@@ -165,8 +174,11 @@ protected:\n \t\tdev_->setControls(&ctrls);\n \t\tdelayed->reset();\n \n+\t\t/* Trigger the first frame start event */\n+\t\tdelayed->applyControls(startOffset);\n+\n \t\t/* Test dual control with delay. */\n-\t\tfor (unsigned int i = 0; i < 100; i++) {\n+\t\tfor (unsigned int i = 1; i < 100; i++) {\n \t\t\tuint32_t frame = startOffset + i;\n \t\t\tint32_t value = 10 + i;\n \n@@ -189,7 +201,7 @@ protected:\n \t\t\t\treturn TestFail;\n \t\t\t}\n \n-\t\t\texpected = i < 1 ? expected : value - 1;\n+\t\t\texpected = i < maxDelay ? expected : value - 1;\n \t\t}\n \n \t\treturn TestPass;\n@@ -197,9 +209,11 @@ protected:\n \n \tint dualControlsMultiQueue()\n \t{\n+\t\tstatic const unsigned int maxDelay = 2;\n+\n \t\tstd::unordered_map<uint32_t, DelayedControls::ControlParams> delays = {\n \t\t\t{ V4L2_CID_BRIGHTNESS, { 1, false } },\n-\t\t\t{ V4L2_CID_CONTRAST, { 2, false } }\n+\t\t\t{ V4L2_CID_CONTRAST, { maxDelay, false } }\n \t\t};\n \t\tstd::unique_ptr<DelayedControls> delayed =\n \t\t\tstd::make_unique<DelayedControls>(dev_.get(), delays);\n@@ -212,6 +226,9 @@ protected:\n \t\tdev_->setControls(&ctrls);\n \t\tdelayed->reset();\n \n+\t\t/* Trigger the first frame start event */\n+\t\tdelayed->applyControls(0);\n+\n \t\t/*\n \t\t * Queue all controls before any fake frame start. Note we\n \t\t * can't queue up more then the delayed controls history size\n@@ -226,8 +243,8 @@ protected:\n \t\t}\n \n \t\t/* Process all queued controls. */\n-\t\tfor (unsigned int i = 0; i < 16; i++) {\n-\t\t\tint32_t value = 10 + i;\n+\t\tfor (unsigned int i = 1; i < 16; i++) {\n+\t\t\tint32_t value = 10 + i - 1;\n \n \t\t\tdelayed->applyControls(i);\n \n@@ -245,7 +262,7 @@ protected:\n \t\t\t\treturn TestFail;\n \t\t\t}\n \n-\t\t\texpected = i < 1 ? expected : value - 1;\n+\t\t\texpected = i < maxDelay ? expected : value - 1;\n \t\t}\n \n \t\treturn TestPass;\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "6/7"
    ]
}