From patchwork Fri Feb 12 11:33:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11258 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 50C14BD160 for ; Fri, 12 Feb 2021 11:37:40 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 1DB8363784; Fri, 12 Feb 2021 12:37:40 +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="BQl8dwfD"; dkim-atps=neutral Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CD0666376F for ; Fri, 12 Feb 2021 12:37:36 +0100 (CET) Received: by mail-wm1-x330.google.com with SMTP id n10so663744wmq.0 for ; Fri, 12 Feb 2021 03:37:36 -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=Ly/7+R5SplSQlPy0AIFb6Vzt1EE1ot3TspwZ1TuICqY=; b=BQl8dwfDmq2qyTo5td5uEqE94qn4p/CcXVKw0TvXZL+wDMllvwGYrTcnsNUOfCy8kc weacSp1Z8yQMts3t4p6aDtQUbS4DwNOvhD87EldGE/1c33sM4SzLpS6Sy5fjMULGgazJ SKOSfC2smocsnPkfycAmfbdqrlBg2jir841YR0tYHhEYAZOr6ZhogsQSb9KH4PDn5Ljd BRilGZGWm8bIRMB31J9QQzDJLKcgdzYVOCJTJYgINIC8tQPrlvyGgMj+FaWuWdoJYGl1 3NF/AoQwYdNKZHp1JxOUnbCkWkh9TWjf3jWDpE6Ckso7Pqd6V1prih9uFGeO7faWQouP B2Rw== 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=Ly/7+R5SplSQlPy0AIFb6Vzt1EE1ot3TspwZ1TuICqY=; b=tuvTRDYasMHaB6SpV4xMBp/CiNNqTcycRIcsQZnJLl1W//FVi+4snmyMvyvby/TxnK xJtwhESNk/ZvAOqZ+TJU8U6ICGO4WMCiofg9staZX3dmrbqkHomd95lhmESrKoCkdLKq PD4J1ib/Ektjwe/b+yGM60twf7ztrQs1LhSIOEeuGpsFcaQMRbCXVXVc9bkB44XfCY9J n9Ewx8VY6FaqwODmBiFEkV9DhL5Ewfh9m2a8Uw/T2GMGVo7/lS6qZXdaq0L8ZnWxU/nu jzzpsjpOuPLeklHDsbyyu63UmTtf5gPzQtIO8KGb5vYEjI0FT0nvQmirR3G1M5QizN74 oxxw== X-Gm-Message-State: AOAM532gFGZPwVQSRZ03wRE51T0y3wQUElydRZF9LjwW/ztPsvKsL/+X kKnRoOTMEMJTFRgKo0Idrxj+wejaT3z1yQSw X-Google-Smtp-Source: ABdhPJy1ouv9hv+WL+pmdfFV6/EPul2ehMB19K1PkDKJHaedAtBgdOMP1shfHvHDpp+i8HH3SzvZRg== X-Received: by 2002:a7b:cf19:: with SMTP id l25mr2173517wmg.85.1613129856272; Fri, 12 Feb 2021 03:37:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 03:37:35 -0800 (PST) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Feb 2021 11:33:12 +0000 Message-Id: <20210212113312.239076-6-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 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") --- 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 f140b4b562e7..9d0d17372546 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());