From patchwork Tue Feb 16 08:53:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11304 X-Patchwork-Delegate: niklas.soderlund@ragnatech.se 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 A9913BD1EF for ; Tue, 16 Feb 2021 08:53:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7BBE7637E4; Tue, 16 Feb 2021 09:53:56 +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="NqUW8gj3"; dkim-atps=neutral Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A7B4A637E1 for ; Tue, 16 Feb 2021 09:53:51 +0100 (CET) Received: by mail-wr1-x42e.google.com with SMTP id n6so11982424wrv.8 for ; Tue, 16 Feb 2021 00:53:51 -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=fyu0xKvfxo3pIJO/KpDt3GBJV8oYCe5aBKHW+vWxN+0=; b=NqUW8gj3o1yG3JdBeRfoXz49gq+oOElIC6F2QuOKP5M7tw7kQb1laMo20HiYeRiFET jk4ZS0YQ9R0zPSFtgXnQurFd28zyMGCaru1PnizfaLaEviCknG7hDhMm/TdcUbD1j5PR MmmUVQCYlrpwzdc24tQoNlLCaIiBqYHSxGJZBPQrv1RAnGMh7L5pj5pjuYMZ1X8fokfL XE+H3+SxLG94Vr+1VV0F/FRCUE0Tk1wkPfOwNwsvjJxmazeD7jboYzGvY2gNaRnRiCJ6 c+adp+wn8qi7McYZ16VJB48B96SJ0zsq62fzFMDyYZX8foD0zUCfRUXU0++9OD83PD4L ZUEg== 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=fyu0xKvfxo3pIJO/KpDt3GBJV8oYCe5aBKHW+vWxN+0=; b=Qli0vS9D8iM1DE/wJGrfAhVyqqUREITsrrgj92pbmjs0Kd1rsq2YSR76bcsRngFSag xMZYOG0tHEM6nlaEARxiRwCTjG8iRGRgNuB2UUDpOErRaaZQdDo6wvQQEkO43eU5HDMj JSuhAo/gVQ2i+Ey54doaCo/v56i8vUtFt1ICc8bQ/iBkPkpfNNLwgKvQWsQUr6xaCTa+ WmwJgAztmNdF0R0FQdp+ax6O+SfKCFdMV2FEsjG9X2pKhIhFLhhnKLSaXjMN/8vkDdLI MBN1m3x/TpcnGr2jVkn/bQBbRdmjbuy0QIZ2g+6h3lQqdSXcGcY+EbqrJBb/xPyF0QXF cE+w== X-Gm-Message-State: AOAM532e52Ovomh+rmPAeWfv2kYADOqrgSj4MQuuPxAHoS1ZcdQeitbU BdWTtpYkcY0CCuIS8s0mBFsKqDHgDYOL7RpA X-Google-Smtp-Source: ABdhPJxrZvd22yS7VmZD9dHGYuxG03iWIlmp0SCffB4N5m2OwjPSUiyoqv+6ZRuSddn1jZRnssybNw== X-Received: by 2002:a5d:4903:: with SMTP id x3mr18244460wrq.95.1613465631132; Tue, 16 Feb 2021 00:53:51 -0800 (PST) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id e1sm9300369wrd.44.2021.02.16.00.53.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 00:53:50 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 16 Feb 2021 08:53:42 +0000 Message-Id: <20210216085342.1012717-6-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210216085342.1012717-1-naush@raspberrypi.com> References: <20210216085342.1012717-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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") 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 d1b79dc3570e..3f829e8c40f2 100644 --- a/src/libcamera/delayed_controls.cpp +++ b/src/libcamera/delayed_controls.cpp @@ -183,7 +183,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());