{"id":11302,"url":"https://patchwork.libcamera.org/api/1.1/patches/11302/?format=json","web_url":"https://patchwork.libcamera.org/patch/11302/","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":"<20210216085342.1012717-4-naush@raspberrypi.com>","date":"2021-02-16T08:53:40","name":"[libcamera-devel,v2,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=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":{"id":16,"url":"https://patchwork.libcamera.org/api/1.1/users/16/?format=json","username":"neg","first_name":"Niklas","last_name":"Söderlund","email":"niklas.soderlund@ragnatech.se"},"mbox":"https://patchwork.libcamera.org/patch/11302/mbox/","series":[{"id":1694,"url":"https://patchwork.libcamera.org/api/1.1/series/1694/?format=json","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/11302/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11302/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 637ECBD1EF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 16 Feb 2021 08:53:53 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8EE0D637E5;\n\tTue, 16 Feb 2021 09:53:52 +0100 (CET)","from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CDD38637C9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 16 Feb 2021 09:53:49 +0100 (CET)","by mail-wm1-x331.google.com with SMTP id l17so8458946wmq.2\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.48\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=\"B/1e6Lvu\"; 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=pE0pD3Pm7d1Q+xfAn0kd1mKoyC0oxhMkAlASrfwQPfc=;\n\tb=B/1e6Lvu616sIYfhsWZWjt/kiSbd/z/Sud8k2zKOQ18AM0uIr2vRCz9ClDpN8NuefG\n\tlvqEl2xFuqoTmTNJVRrYlv5YhqjvgkKCov0lFt2Ogj7PMifgMrgWce7/5c1YkLpOaovK\n\t0Y1CYLUs+OcDG+R/tl+wP4FIGdAD1T8Av/rj5DZEoUYtqijqyjQPNkRrK2Pe7KAC6xAX\n\ttZlP1Pmoz5kmwUwHzCLt/56CzJ4OcBU+KqBnVpQl6uze5d7lIyjfWO4k8gJVgyjvn2lb\n\trvqyQG8IF99n82TxmwUlfA+/3o7JNImtik79I5qGNS7CzixJUQQpDI48CoyvHQj4hsMb\n\tKgqw==","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=pE0pD3Pm7d1Q+xfAn0kd1mKoyC0oxhMkAlASrfwQPfc=;\n\tb=GJNfpiqse/BBXpE2JKP5M32KhbG7EQheGvy1Yxtc4AIWbf/Vy/T5n9M5yhHUhVa5LZ\n\tA8qiSStYljdLYPjZA9BoWaMrWxNaDc4rYcc23mocuViC/sbkroIOny1B3n74PNwKvXuN\n\ts3zth23CIE0fqf/bjb+lCLp1sGOPw8RnHZlW/HcfSjJ6Fj/cry15mx0bbShMJ1/79hrK\n\tXWKPPjME+u+XpW49Iju2BegGmL9rePq4YYmS5vm4GC9Cz2S68est6wQy9ZIymWsjcQjn\n\tXMOw73IUCEzV5flltYZevLLpgDAgojjNq1voFxNxyXfUP8Sw6TDX2HeBSOFgZUcyDJ51\n\tTmJw==","X-Gm-Message-State":"AOAM5301ckPbhnmDJxDfDdYesFZfjInDhBmGBlh+z9ifgmL9WaYRr4dt\n\tHtzKG+Ma7MedWAo4fv4sDObygfpdLz8yJkF8","X-Google-Smtp-Source":"ABdhPJz8qxlmY2Cu9+Vg9cssBPKOkEnwlvgkvN0yVIuvP3ldG8NqhwD5VlhIlvURHEbovldkGNIIEQ==","X-Received":"by 2002:a05:600c:4788:: with SMTP id\n\tk8mr2330641wmo.138.1613465629171; \n\tTue, 16 Feb 2021 00:53:49 -0800 (PST)","From":"Naushir Patuck <naush@raspberrypi.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 16 Feb 2021 08:53:40 +0000","Message-Id":"<20210216085342.1012717-4-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 3/5] libcamera: delayed_controls:\n\tRemove unneeded 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 3ed1dfebd035..21dc3e164fe9 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","v2","3/5"]}