From patchwork Thu Mar 4 08:17:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11489 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 00A37BD1F1 for ; Thu, 4 Mar 2021 08:17:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 979DD68A92; Thu, 4 Mar 2021 09:17:42 +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="k/V98RtV"; dkim-atps=neutral Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3B4E0602EC for ; Thu, 4 Mar 2021 09:17:39 +0100 (CET) Received: by mail-wm1-x32e.google.com with SMTP id l22so7217524wme.1 for ; Thu, 04 Mar 2021 00:17:39 -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=k/V98RtVfG2FbdtNxrUhzMl0pC2GmzQ0ouj2hpi0GL+Aw6UMwnx/Zif/SD3z2zX16Z R9Z/OsF9qgO7zZdr4P8hCDrwIrdSYY8ksWxNQ7gVIx9i/E0agxu8naeIjQPWeEaQLUxi lo+cdnLhO0M8JqfoPz6gP8F6VQa77/SP3sGNhQ7BbqhvF394hZ7228RD2Y30X7urIPmu lw6gUh/G8XZ6MdR80vuDszTCuXe30Gg3FpoSeL7UP6+BvrhtLGO0eIjHyRFzYmYVGnfG WQNZP6Bwiiyzge0tWrvx9M8nwov4/gF+tp6cYhWVaoiwoFTAatRGq5evn1Ur8nEvQqdd HvQg== 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=CCtmpUfsS6lELkhtWuW3N95C4QcXO3PsDwkXnTJcVOu80InAFp2DtX8drly1chGEwB c8PchAD3tfSJXZ5y8QeavNa9wpDei6egKXQlJUouJcO3rxB0f2JBd6wFy36a5UWV7j22 8V3K1JbkzCnF8qiiP0UzMaZdAFzHp3sAceDuy7MkhPr/C98ZxYuF/yJcKZGXWHHZzeF9 jH6c4J/zK8Y7tkLAEMIjQOazwgARk2dfsAAQaJvW2BpwlArnMi65j+pSqARhusGRjG3X h+N+j45lTBewePYAjBI6/5jyvHWzegK/z2HIkUm5bCgtC22gaQUlPWtNyusqUu4Yh7ay hMTQ== X-Gm-Message-State: AOAM533pNhsDy8xhnl6t/DBBSs7NrzFvTCGYD6rLNO4wLD36nkMpoCte B0SYl918faEPqGwG6DZylmWX53A+ZjERMAfF X-Google-Smtp-Source: ABdhPJwF2QuEycY4RrJYWO+lU0CmaaD8OTchlaHn87jyJ98fHs3Pjq3WWHcl3W6oXV/lzO+lCIqJXg== X-Received: by 2002:a1c:9849:: with SMTP id a70mr2797713wme.48.1614845858776; Thu, 04 Mar 2021 00:17:38 -0800 (PST) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id b186sm6997926wmc.44.2021.03.04.00.17.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 00:17:38 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 4 Mar 2021 08:17:24 +0000 Message-Id: <20210304081728.1058394-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210304081728.1058394-1-naush@raspberrypi.com> References: <20210304081728.1058394-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 3/7] 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 Tested-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham --- 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()