Show a patch.

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

{
    "id": 11256,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/11256/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/11256/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/1.1/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": "<20210212113312.239076-4-naush@raspberrypi.com>",
    "date": "2021-02-12T11:33:10",
    "name": "[libcamera-devel,3/5] libcamera: delayed_controls: Remove unneeded write when starting up",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "53e503f06bc10b0b56526a16be77741cd546afac",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/11256/mbox/",
    "series": [
        {
            "id": 1683,
            "url": "https://patchwork.libcamera.org/api/1.1/series/1683/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1683",
            "date": "2021-02-12T11:33:07",
            "name": "DelayedControls updates and fixes",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/1683/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/11256/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/11256/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 52655BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 12 Feb 2021 11:37:38 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1ABFA6377C;\n\tFri, 12 Feb 2021 12:37:38 +0100 (CET)",
            "from mail-wm1-x332.google.com (mail-wm1-x332.google.com\n\t[IPv6:2a00:1450:4864:20::332])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8F6FB63772\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Feb 2021 12:37:34 +0100 (CET)",
            "by mail-wm1-x332.google.com with SMTP id y134so653614wmd.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 12 Feb 2021 03:37:34 -0800 (PST)",
            "from naush-laptop.patuck.local ([88.97.76.4])\n\tby smtp.gmail.com with ESMTPSA id\n\tv5sm10005020wro.71.2021.02.12.03.37.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 12 Feb 2021 03:37:33 -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=\"iPjibrta\"; 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=V+P/b1PkJT480Ym7y0eioeLJj2MS8+A7MRwdCmqsWe0=;\n\tb=iPjibrta/LS1jKDF4EHW3KqtJNwbP9LGIoxQrArv4m28EhHKlaWdH1EVD2bdnNSzQr\n\tT+7u3wXZt+GsWAZrfZ5JADroTS07oMeoBjsdBrhM9y9XIkue8618yMLtYs/Zqf8RQKpc\n\tuem7t0zA3ScbzWEFXM+2hJ4hKNc0QbCvD7e/w8ReK2ZpxX6KJqAf/RYVVqHH03Xsw+Bf\n\teeWwOSJJHxWAzmaOJIMlIa8zbnTplJbluYtCdnYtGiDKJ+HogILdT1FLMtHj9uvGTUiw\n\tpwbeK/NYTUOZO00Fbhv+MSEe8Yz5Nu9jjsvlg2JYkdxDV4jyW+U+A8mEwJvUwZHLEc8Z\n\tJphA==",
        "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=V+P/b1PkJT480Ym7y0eioeLJj2MS8+A7MRwdCmqsWe0=;\n\tb=YTsE2D37jolVlLpq2HqOUZ0WF97F2PghsW2Syw9V2Po1YNL+SdtlZNFhruDl9o3XB/\n\tmY7r9qCj9V1zDq/V7Ub+rLpAcOEsGN2zxCJvL5MYo7zqWIU50APJnCJirWMzdKN9rvpb\n\tCmNqZYllmQxtB817spPn2Zy5ggomyGEFPV5aPU0+9GId3aNE1mreUgCu10xUT1+goROW\n\tfDevULwNAU8LmhG+ITy8r9wc5Coe3qWP4d1p1Cj35uG3ektRV5Ir2qdzKk2qY+mj6ahm\n\tSSpMvAAJqD/itBoty8S9dn3fcI/7j/RZ8n3P7TuxYcSHsngLaT5mEvdAE5Mj4TQbSGqj\n\tzRGw==",
        "X-Gm-Message-State": "AOAM531axW+oDa3N52qYQNpG+qRpCu5ngyEAvJ+clhHkh+yDKG+L1PJO\n\ttwVFr5uzIDdzld6RZpvqBG96WNwazamH9v9W",
        "X-Google-Smtp-Source": "ABdhPJzMntizgzKfyFPeB9/V33A4QHSD2O4xg3Y+Cs9NXxB9XdW5a9iydVHTCHJvSFlMPgB8fOn4Dg==",
        "X-Received": "by 2002:a05:600c:20f:: with SMTP id\n\t15mr2315319wmi.148.1613129854008; \n\tFri, 12 Feb 2021 03:37:34 -0800 (PST)",
        "From": "Naushir Patuck <naush@raspberrypi.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 12 Feb 2021 11:33:10 +0000",
        "Message-Id": "<20210212113312.239076-4-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20210212113312.239076-1-naush@raspberrypi.com>",
        "References": "<20210212113312.239076-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Subject": "[libcamera-devel] [PATCH 3/5] libcamera: delayed_controls: Remove\n\tunneeded write when starting up",
        "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": "On DelayedControls::reset(), the values retrieved from the sensor device\nwere added to the queues with the updated flag set to true. This would\ncause the helper to write out the value to the device again on the first\nDelayedControls::applyControls() call. This is unnecessary, as the\ncontrols written are identical to what is stored in the device driver.\n\nFix this by explicitly setting the update flag to false in\nDelayedControls::reset() when adding the controls to the queue.\n\nAdditionally, use the Info() constructor when adding items to the queue\nfor consistency.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nFixes: 3d4b7b005911 (\"libcamera: delayed_controls: Add helper for controls that apply with a delay\")\n---\n include/libcamera/internal/delayed_controls.h |  4 ++--\n src/libcamera/delayed_controls.cpp            | 14 ++++++++------\n 2 files changed, 10 insertions(+), 8 deletions(-)",
    "diff": "diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h\nindex 564d9f2e2440..2a6a912bde10 100644\n--- a/include/libcamera/internal/delayed_controls.h\n+++ b/include/libcamera/internal/delayed_controls.h\n@@ -43,8 +43,8 @@ private:\n \t\t{\n \t\t}\n \n-\t\tInfo(const ControlValue &v)\n-\t\t\t: ControlValue(v), updated(true)\n+\t\tInfo(const ControlValue &v, bool updated_ = true)\n+\t\t\t: ControlValue(v), updated(updated_)\n \t\t{\n \t\t}\n \ndiff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\nindex 5317f820b6bd..fe2606a0d9aa 100644\n--- a/src/libcamera/delayed_controls.cpp\n+++ b/src/libcamera/delayed_controls.cpp\n@@ -111,7 +111,11 @@ void DelayedControls::reset()\n \tvalues_.clear();\n \tfor (const auto &ctrl : controls) {\n \t\tconst ControlId *id = device_->controls().idmap().at(ctrl.first);\n-\t\tvalues_[id][0] = Info(ctrl.second);\n+\t\t/*\n+\t\t * Do not mark this control value as updated, it does not need\n+\t\t * to be written to to device on startup.\n+\t\t */\n+\t\tvalues_[id][0] = Info(ctrl.second, false);\n \t}\n }\n \n@@ -126,11 +130,10 @@ void DelayedControls::reset()\n  */\n bool DelayedControls::push(const ControlList &controls)\n {\n-\t/* Copy state from previous frame. */\n+\t/* Copy state from previous frame and clear the updated flag */\n \tfor (auto &ctrl : values_) {\n \t\tInfo &info = ctrl.second[queueCount_];\n-\t\tinfo = values_[ctrl.first][queueCount_ - 1];\n-\t\tinfo.updated = false;\n+\t\tinfo = Info(values_[ctrl.first][queueCount_ - 1], false);\n \t}\n \n \t/* Update with new controls. */\n@@ -150,8 +153,7 @@ bool DelayedControls::push(const ControlList &controls)\n \n \t\tInfo &info = values_[id][queueCount_];\n \n-\t\tinfo = control.second;\n-\t\tinfo.updated = true;\n+\t\tinfo = Info(control.second);\n \n \t\tLOG(DelayedControls, Debug)\n \t\t\t<< \"Queuing \" << id->name()\n",
    "prefixes": [
        "libcamera-devel",
        "3/5"
    ]
}