From patchwork Mon Mar 1 13:31:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11417 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 9A47EBD1F1 for ; Mon, 1 Mar 2021 13:32:13 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 638A468AA0; Mon, 1 Mar 2021 14:32:13 +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="nEf5DyvX"; dkim-atps=neutral Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0896168A99 for ; Mon, 1 Mar 2021 14:32:12 +0100 (CET) Received: by mail-wm1-x32f.google.com with SMTP id u187so11613937wmg.4 for ; Mon, 01 Mar 2021 05:32:12 -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=Dphl3ZTsb6BZ6uAfpHD339RxAaUTr2aTC087IdEwZ2k=; b=nEf5DyvXtRCSH+CaFrpaZxtRn3jZ45GLXAaOHf8o/TyKWkS6j155Mpk6Tae+0qjBfu N1QM2GOT7nywzcexRwHzmyY9Dp0UNNGNGwNcwHDp7OOzOszAFPxsx1AtVriHdlL1sj5i 6AvjSmbi+gAvPB+U5gPG0kWIKarUcEPASS7/lS/2NV68ANZ1pqP/m8DuqiU1nO7jsr9A WG8qqPwoheMfO/Hu2ybfUrS0+/ZpJBzymPC8titv69M5qzZ1ObylBW1kmtUM1aAuFDxP wrYwVWMTt3A/ymx3b6SRYculJA8Mvp761n3GcDlFyTZ8u15JIljzKmeJTgWPU04Sj+77 OAqQ== 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=Dphl3ZTsb6BZ6uAfpHD339RxAaUTr2aTC087IdEwZ2k=; b=h9A3jMx4uDyrEqer5sSZjoH/1lClHHR52DXtemJf34/EKMnbQZfS0+kg0PQ7Fe5m7w mUvE/C7QQO+wUUWwz5sKiDMJ7SBc5zHcHC15HubZins+zpNpxa8yWjuq3OD4ewcv6cjF 3QV/3Ols0wct7fxrc+mpljTbo7CyuwJSviZo4IWSt/UinXD6OipEnoj1MvnnGqD5ubRV K/NGt1I5vpPFLdjnkCmTLKAh2TbTq+sm5vlgKjgBLsFu6LRahCSbiy6n+NvadY3981n3 DARrKFt/ES036gxdbeaCZ5a+Xe+cQ/nKAWVpKJfg0RPNOwVm6Y1h2YQ9X90F4AznOn6i esyw== X-Gm-Message-State: AOAM530QBn0YsTLxZOf/hMbwgIGzDt7jx/V8osoZRfAlReG6TAkaXSpF ydi4Wu+hBCaN9V2xmW8zIpb5T6Ln3AVQZeXd X-Google-Smtp-Source: ABdhPJzDt83Mjb+7T568NBcrAuKworhKkgqfYsnkZkaYkRL1kYbSf/kg6Ev2q3JZsNITupikbIiIHg== X-Received: by 2002:a1c:7415:: with SMTP id p21mr5718031wmc.187.1614605530819; Mon, 01 Mar 2021 05:32:10 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Mar 2021 05:32:10 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Mon, 1 Mar 2021 13:31:59 +0000 Message-Id: <20210301133159.4179129-6-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 5/5] libcamera: delayed_controls: Fix off-by-one error in get() 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" There was an off-by-one error in DelayedControls::get() when picking controls from the queue to return back to the pipeline handler. This is only noticeable as small oscillations in brightness when closely viewing frame while AGC is running. The old StaggeredCtrl did not show this error as the startup queuing mechanism has changed in DelayedControls. Fix this by indexing to the correct position in the queue. Signed-off-by: Naushir Patuck Reported-by: David Plowman Fixes: 3d4b7b005911 ("libcamera: delayed_controls: Add helper for controls that apply with a delay") Tested-by: David Plowman Reviewed-by: Paul Elder --- src/libcamera/delayed_controls.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/delayed_controls.cpp b/src/libcamera/delayed_controls.cpp index 5a05741c0285..138761c9852e 100644 --- a/src/libcamera/delayed_controls.cpp +++ b/src/libcamera/delayed_controls.cpp @@ -184,7 +184,7 @@ bool DelayedControls::push(const ControlList &controls) */ ControlList DelayedControls::get(uint32_t sequence) { - uint32_t adjustedSeq = sequence - firstSequence_ + 1; + uint32_t adjustedSeq = sequence - firstSequence_; unsigned int index = std::max(0, adjustedSeq - maxDelay_); ControlList out(device_->controls());