From patchwork Mon Mar 1 13:31:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11415 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id A9E1EBD1F1 for ; Mon, 1 Mar 2021 13:32:10 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 618EB68A95; Mon, 1 Mar 2021 14:32:10 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="IPK14sub"; dkim-atps=neutral Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4833668A92 for ; Mon, 1 Mar 2021 14:32:08 +0100 (CET) Received: by mail-wr1-x431.google.com with SMTP id w11so16149468wrr.10 for ; Mon, 01 Mar 2021 05:32:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CW26mmwvmqIlsGYx03OeK2ZIP1RApVX0DdJdSra6nT4=; b=IPK14subrRRqg76NFUz92YkOuNE9Oxohvdu7zA1lucQhroD6eX7WI8J1Fi7HP1frLV QXg58K4yjZvzNRnKwxdTOGTTf8D2qoEN930C0ZMonG/8+mDVdmuZPptd9IFaffbNEBdk Nej0ZbV6kOnqLYkcYXLTezkGpTILTeecBsv2vZ5b8cHkik5v7hriqf6F+YEowj9NtqL7 tfu0zUeHdBWl3wirERcdDTVjOiC+jSUpN6dCiu/rsLBsU4tgbI7Y26E1da+jJu1hKc2h 99PIPLY6K1+Z1NLm2/GE7BnwsEpUHtKfMVbXEAvhHZgKQdT61AJNKyoX+zPZxZr6CU5r bUOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CW26mmwvmqIlsGYx03OeK2ZIP1RApVX0DdJdSra6nT4=; b=f6m2Jbts2+W8Ygt1Fm6Y+hdcfvpx4pZfiZCxOAmvFU0lljcLFtTErufXdEPCvNDp1b pr3ORuL565zFy/amJdw2Yd/N36QY8wVtp5dupluznTdnF0ZqpGG0cOz05L4OJZSia71V 95SfHzEdpns17QhBl4OY/RVgjWvcADd8vUfPltqUyGqflJ6P/z3YFRG1b1TGq3ScTP2w 60FLkfZOIhqfaq/cTSFXF3BQPf6nIh3vexCYzFzZtlyaLc4pwFmw97U39DCQT8A5LhZX bcnYufv/zsRMjw7V++QvwIA8sjGO/dzYtZ0tNjnJ8FytJovVYN2w0qoBGRyr2u/f62lk KGgw== X-Gm-Message-State: AOAM533qgDKSDPxIS4GF8hpBniLRykNx6meu37/i2V9/Fla8zNVOWega yNBlTYro6DW9qKapXMPw0GlCh+InnZqmsg1X X-Google-Smtp-Source: ABdhPJx2640/lEdYQKrGUc6SMnFOlByfut98S52qzR14mjEqie1MBkCvAZOZlxFY5VEdWwkqsYb30w== X-Received: by 2002:a5d:6411:: with SMTP id z17mr14998483wru.119.1614605527407; Mon, 01 Mar 2021 05:32:07 -0800 (PST) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id a75sm11263630wme.10.2021.03.01.05.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Mar 2021 05:32:06 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Mar 2021 13:31:57 +0000 Message-Id: <20210301133159.4179129-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210301133159.4179129-1-naush@raspberrypi.com> References: <20210301133159.4179129-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/5] libcamera: delayed_controls: Remove unneeded write when starting up X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" On DelayedControls::reset(), the values retrieved from the sensor device were added to the queues with the updated flag set to true. This would cause the helper to write out the value to the device again on the first DelayedControls::applyControls() call. This is unnecessary, as the controls written are identical to what is stored in the device driver. Fix this by explicitly setting the update flag to false in DelayedControls::reset() when adding the controls to the queue. Additionally, use the Info() constructor when adding items to the queue for consistency. Signed-off-by: Naushir Patuck Fixes: 3d4b7b005911 ("libcamera: delayed_controls: Add helper for controls that apply with a delay") Tested-by: David Plowman Reviewed-by: Paul Elder --- include/libcamera/internal/delayed_controls.h | 4 ++-- src/libcamera/delayed_controls.cpp | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h index 564d9f2e2440..2a6a912bde10 100644 --- a/include/libcamera/internal/delayed_controls.h +++ b/include/libcamera/internal/delayed_controls.h @@ -43,8 +43,8 @@ private: { } - Info(const ControlValue &v) - : ControlValue(v), updated(true) + Info(const ControlValue &v, bool updated_ = true) + : ControlValue(v), updated(updated_) { } diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp index 3ed1dfebd035..f6d761d1cc41 100644 --- a/src/libcamera/delayed_controls.cpp +++ b/src/libcamera/delayed_controls.cpp @@ -111,7 +111,11 @@ void DelayedControls::reset() values_.clear(); for (const auto &ctrl : controls) { const ControlId *id = device_->controls().idmap().at(ctrl.first); - values_[id][0] = Info(ctrl.second); + /* + * Do not mark this control value as updated, it does not need + * to be written to to device on startup. + */ + values_[id][0] = Info(ctrl.second, false); } } @@ -150,8 +154,7 @@ bool DelayedControls::push(const ControlList &controls) Info &info = values_[id][queueCount_]; - info = control.second; - info.updated = true; + info = Info(control.second); LOG(DelayedControls, Debug) << "Queuing " << id->name()