[{"id":15368,"web_url":"https://patchwork.libcamera.org/comment/15368/","msgid":"<20210301231233.GG3084@pyrite.rasen.tech>","date":"2021-03-01T23:12:33","subject":"Re: [libcamera-devel] [PATCH v3 3/5] libcamera: delayed_controls:\n\tRemove unneeded write when starting up","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"Hi Naush,\n\nOn Mon, Mar 01, 2021 at 01:31:57PM +0000, Naushir Patuck wrote:\n> On DelayedControls::reset(), the values retrieved from the sensor device\n> were added to the queues with the updated flag set to true. This would\n> cause the helper to write out the value to the device again on the first\n> DelayedControls::applyControls() call. This is unnecessary, as the\n> controls written are identical to what is stored in the device driver.\n> \n> Fix this by explicitly setting the update flag to false in\n> DelayedControls::reset() when adding the controls to the queue.\n> \n> Additionally, use the Info() constructor when adding items to the queue\n> for consistency.\n> \n> Signed-off-by: Naushir Patuck <naush@raspberrypi.com>\n> Fixes: 3d4b7b005911 (\"libcamera: delayed_controls: Add helper for controls that apply with a delay\")\n> Tested-by: David Plowman <david.plowman@raspberrypi.com>\n\nLooks good!\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\n> ---\n>  include/libcamera/internal/delayed_controls.h | 4 ++--\n>  src/libcamera/delayed_controls.cpp            | 9 ++++++---\n>  2 files changed, 8 insertions(+), 5 deletions(-)\n> \n> diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h\n> index 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>  \n> diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp\n> index 3ed1dfebd035..f6d761d1cc41 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> @@ -150,8 +154,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> -- \n> 2.25.1\n> \n> _______________________________________________\n> libcamera-devel mailing list\n> libcamera-devel@lists.libcamera.org\n> https://lists.libcamera.org/listinfo/libcamera-devel","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 520DABD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  1 Mar 2021 23:12:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C987B68A86;\n\tTue,  2 Mar 2021 00:12:42 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 034B968A45\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  2 Mar 2021 00:12:40 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5CD6C45D;\n\tTue,  2 Mar 2021 00:12:39 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"PYWZU0T4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1614640360;\n\tbh=2Tky0P9B4xUPG6Su0tfWk4ueqh1GIDt9as4qmfA9hyw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=PYWZU0T4/kRjegUTKXj6d75Mh1oR/L4Kt5YCH0t78BLiVeKCXPAsh89FMUrDiFqrq\n\tNC1CPJKdIHhzAgypswNm3msTWtPnlMhIif05JGj7DcEWB74znzdNiZZOtyaFgU8U/9\n\twCWTGJ6Ezw/RRB0RzN/fEgc78pgTqS6nB35k6tqQ=","Date":"Tue, 2 Mar 2021 08:12:33 +0900","From":"paul.elder@ideasonboard.com","To":"Naushir Patuck <naush@raspberrypi.com>","Message-ID":"<20210301231233.GG3084@pyrite.rasen.tech>","References":"<20210301133159.4179129-1-naush@raspberrypi.com>\n\t<20210301133159.4179129-4-naush@raspberrypi.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210301133159.4179129-4-naush@raspberrypi.com>","Subject":"Re: [libcamera-devel] [PATCH v3 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>","Cc":"libcamera-devel@lists.libcamera.org","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>"}}]