From patchwork Fri Feb 12 11:33:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11256 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 52655BD160 for ; Fri, 12 Feb 2021 11:37:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1ABFA6377C; Fri, 12 Feb 2021 12:37:38 +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="iPjibrta"; dkim-atps=neutral Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 8F6FB63772 for ; Fri, 12 Feb 2021 12:37:34 +0100 (CET) Received: by mail-wm1-x332.google.com with SMTP id y134so653614wmd.3 for ; Fri, 12 Feb 2021 03:37:34 -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=V+P/b1PkJT480Ym7y0eioeLJj2MS8+A7MRwdCmqsWe0=; b=iPjibrta/LS1jKDF4EHW3KqtJNwbP9LGIoxQrArv4m28EhHKlaWdH1EVD2bdnNSzQr T+7u3wXZt+GsWAZrfZ5JADroTS07oMeoBjsdBrhM9y9XIkue8618yMLtYs/Zqf8RQKpc uem7t0zA3ScbzWEFXM+2hJ4hKNc0QbCvD7e/w8ReK2ZpxX6KJqAf/RYVVqHH03Xsw+Bf eeWwOSJJHxWAzmaOJIMlIa8zbnTplJbluYtCdnYtGiDKJ+HogILdT1FLMtHj9uvGTUiw pwbeK/NYTUOZO00Fbhv+MSEe8Yz5Nu9jjsvlg2JYkdxDV4jyW+U+A8mEwJvUwZHLEc8Z JphA== 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=V+P/b1PkJT480Ym7y0eioeLJj2MS8+A7MRwdCmqsWe0=; b=YTsE2D37jolVlLpq2HqOUZ0WF97F2PghsW2Syw9V2Po1YNL+SdtlZNFhruDl9o3XB/ mY7r9qCj9V1zDq/V7Ub+rLpAcOEsGN2zxCJvL5MYo7zqWIU50APJnCJirWMzdKN9rvpb CmNqZYllmQxtB817spPn2Zy5ggomyGEFPV5aPU0+9GId3aNE1mreUgCu10xUT1+goROW fDevULwNAU8LmhG+ITy8r9wc5Coe3qWP4d1p1Cj35uG3ektRV5Ir2qdzKk2qY+mj6ahm SSpMvAAJqD/itBoty8S9dn3fcI/7j/RZ8n3P7TuxYcSHsngLaT5mEvdAE5Mj4TQbSGqj zRGw== X-Gm-Message-State: AOAM531axW+oDa3N52qYQNpG+qRpCu5ngyEAvJ+clhHkh+yDKG+L1PJO twVFr5uzIDdzld6RZpvqBG96WNwazamH9v9W X-Google-Smtp-Source: ABdhPJzMntizgzKfyFPeB9/V33A4QHSD2O4xg3Y+Cs9NXxB9XdW5a9iydVHTCHJvSFlMPgB8fOn4Dg== X-Received: by 2002:a05:600c:20f:: with SMTP id 15mr2315319wmi.148.1613129854008; Fri, 12 Feb 2021 03:37:34 -0800 (PST) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id v5sm10005020wro.71.2021.02.12.03.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 03:37:33 -0800 (PST) From: Naushir Patuck 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 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") --- include/libcamera/internal/delayed_controls.h | 4 ++-- src/libcamera/delayed_controls.cpp | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 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 5317f820b6bd..fe2606a0d9aa 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); } } @@ -126,11 +130,10 @@ void DelayedControls::reset() */ bool DelayedControls::push(const ControlList &controls) { - /* Copy state from previous frame. */ + /* Copy state from previous frame and clear the updated flag */ for (auto &ctrl : values_) { Info &info = ctrl.second[queueCount_]; - info = values_[ctrl.first][queueCount_ - 1]; - info.updated = false; + info = Info(values_[ctrl.first][queueCount_ - 1], false); } /* Update with new controls. */ @@ -150,8 +153,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()