From patchwork Thu Mar 4 08:17:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11491 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 AE309BD1F1 for ; Thu, 4 Mar 2021 08:17:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 69C9E60522; Thu, 4 Mar 2021 09:17:45 +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="ReJBY6TU"; 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 4372468A98 for ; Thu, 4 Mar 2021 09:17:41 +0100 (CET) Received: by mail-wm1-x332.google.com with SMTP id o2so8200304wme.5 for ; Thu, 04 Mar 2021 00:17:41 -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=ReJBY6TU+83bOKNy+De0vStD/SSEQ31E0EnarAMkyW3hhjnCIr28shDH49vQno1cER 8JgCbtVC1Gwr+C3uPgjvU99uPK51ZNxLe22xbM7mgU9U1bkHX5MqAL541nIf5IatlEox ef4NEsjX/69ZAXKchMOC5FBLk8ocQweAstDQ0JFLy89F91RmFj1sRm2bEDLugRPi6bBA QL6zoS9r6NXsqmGe+/69pd88dOKWRaPnVQ0ehyf4s1s2JZKInkfe/iOK55HtZoSwv9UH /K7zJhLda0wGcJbk2rxt3B2DoslB6BtHoSFSgLkHD6p/inJZewZlzBswBIpMVH8oVRqn Cb/w== 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=PiFWgkBwV0MneyqnirsMUWnSgB2mzrBP3/61e2/q8X80eKjclkfb+SQOobryNnDJAl 7UTFSjyKqcdYlIlxduMzup5zY86LSoJvSxKDYoEVzm+NEdQ7VPtiHtPC99E9ijo6193Z n8SwUzRhT4thtRkpBT/VxjupYWMHVnEr+Na79uAbBQubFYqSiHNjIQQFa9/wIUI8yiV5 j0lpuVeNPXbvym62Zsg+aGCx5+kCMlTWqvxIWYYi61Wupp7YcPsnu1aTXZsNs/2Dv8oM XMNbW95u5ByVUdqHGiAEWVLSQSoEMFwfhmHvwSw1SMhIRvRchCtcruy1ihZ+OTXAidye kuyQ== X-Gm-Message-State: AOAM532pIcsgEPSqInSpxrl7sclkpYZhq6iY4Y+x7Syup6QHEed1GloZ e4+TCnFPjYAqWmRfR/FG5sbxQGaV4xGHqF15 X-Google-Smtp-Source: ABdhPJwjd9c6bEBspbWYbvFTHhISJsK+BkQbY1TvlHSKfoqa+LjG9JHB95pDOwkva+Li9De3aIcRiQ== X-Received: by 2002:a1c:730a:: with SMTP id d10mr2609391wmb.53.1614845860814; Thu, 04 Mar 2021 00:17:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 00:17:40 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Thu, 4 Mar 2021 08:17:26 +0000 Message-Id: <20210304081728.1058394-6-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 5/7] 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 Tested-by: Jean-Michel Hautbois Reviewed-by: Kieran Bingham --- 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());