From patchwork Mon Sep 26 09:57:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17400 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 D0D01BD16B for ; Mon, 26 Sep 2022 09:58:07 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8BF2F62253; Mon, 26 Sep 2022 11:58:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1664186287; bh=uLP2iD4+d5hVVPRB9S50teMWW/Bbnhk3D9hEpEiufrw=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=gZoPdW1Uj/N+lWBjZnIuadezR5Ee+mhINOpg0cEHEOZturP3jd2DktL/5VQHADniE vQvgzqbikQjsPlRCP08Hmgi87CEhcWKeSKu/exQn4Z6bvpuwgaqVdyUYSOKrFjlt7d DsBoZ34BJkbNoRI13TvRU0OR0XE7NsTr1h509aHdMFiE8TdPio8xp4WxIlLwi0xoWg HbeHcgzuMRusBJNLaUXPvOZGh6795zFC6kBQpeQsevAJwcnUQf3FXcrgWd+ZxJZUym w3NWCGUI7BA2P56PBo5nQndMA9IkTb8ru0NBproro2clcxkyxGRM2se6yfQjoENyWf V0Kxo6g2d8DEA== Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 839C76224C for ; Mon, 26 Sep 2022 11:58:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="Y/1mNWKX"; dkim-atps=neutral Received: by mail-wm1-x32d.google.com with SMTP id t4so4096237wmj.5 for ; Mon, 26 Sep 2022 02:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=+T3xcs+sb+8OgweMkuTstG9ZLZCS0dNJ3UIDGexYQRk=; b=Y/1mNWKXlqbDzZ+r3C97EjXz+av7TmfW9xc7mTPLvP3CvKKbptZPIJtkN3t/78TIuo mRIW8mk+eIdHHlx9nk0H14jMYZ3WehA1dKs3bkHz3+eSxcIQapAnf/6Wci0+anmq07d5 hCi69CR/L9ldwMa3duEat/89gUjc3CPLLXcUKNXgoXFKop7Ys+GjqVQSNPUaW0gORJW4 VRutzjr0m+Sh7wUaozXzF/Sw/Y1DpjEbfDr09coqmUKeKGdgIb+Seq5AK34+1U95EwBZ z1kgV5patB3xMW6Xj27PHJFDyu/vvU2m8cI/kFnbX87cZIe7lMt+ij3hfSkEtB+0iW4C PgYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=+T3xcs+sb+8OgweMkuTstG9ZLZCS0dNJ3UIDGexYQRk=; b=8CW4KgXYOKL2Adk3ZNxoA3gSn2298i8IJr+Q7e6vYPTGDE6hDyibVVAcHikpHLMJp7 45jA6pWDg2lyAHf0hXPjJPMk2nll1GceBqwVsV98vS7FbacCpIbL6I077WJSW/12OT7c fEbHJUtS1MNg6lWxpZeoYaeb0fYaT/Y1yrUPStlf36AwiLToU/8J/DfgVP2/iYFRy3Vg zBd8r2u3aXSvqeRcM1U/Kh/KGz98vTUb7pWWHpQxMbVw7B0tvH4LD2by1+2VkWKVcBJR 5KtXLWEkGYfOMzBmEXtGgYIppr0Tdb88z4cVt/eDKsvH/4qoPqHNyU+FwIaZcz50gCAq abEQ== X-Gm-Message-State: ACrzQf25dObgqO8HACFyq0+47q7xqJwQSJYNsCPyWQKVAvWntpzn76MU DYSsfLw4X8/lex9mTvGV3uTsd49XMtvOXkt1 X-Google-Smtp-Source: AMsMyM6J+xTVibGdxWlfRSHWo70B/LmQpTY2zHVD5m68Wabl14HaQachvd+hHll/dUkWeY7/WR8D1A== X-Received: by 2002:a05:600c:5486:b0:3b4:7e47:e19 with SMTP id iv6-20020a05600c548600b003b47e470e19mr14308168wmb.12.1664186286129; Mon, 26 Sep 2022 02:58:06 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id p22-20020a05600c419600b003a4efb794d7sm10160671wmh.36.2022.09.26.02.57.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 02:57:58 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 26 Sep 2022 10:57:33 +0100 Message-Id: <20220926095737.30506-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220926095737.30506-1-naush@raspberrypi.com> References: <20220926095737.30506-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 3/7] tests: delayed_controls: Add cookie value test 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: , X-Patchwork-Original-From: Naushir Patuck via libcamera-devel From: Naushir Patuck Reply-To: Naushir Patuck Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a test for passing and returning cookie values in DelayedControls. Signed-off-by: Naushir Patuck Reviewed-by: David Plowman --- test/delayed_controls.cpp | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/test/delayed_controls.cpp b/test/delayed_controls.cpp index 322c545998b2..5cc7d3aed4fd 100644 --- a/test/delayed_controls.cpp +++ b/test/delayed_controls.cpp @@ -267,6 +267,45 @@ protected: return TestPass; } + int cookieValue() + { + std::unordered_map delays = { + { V4L2_CID_BRIGHTNESS, { 1, false } }, + }; + std::unique_ptr delayed = + std::make_unique(dev_.get(), delays); + ControlList ctrls; + + /* Set a cookie to the reset value. */ + const unsigned int startCookie = 0x1234; + ctrls.set(V4L2_CID_BRIGHTNESS, 1); + dev_->setControls(&ctrls); + delayed->reset(startCookie); + + /* Trigger the first frame start event */ + delayed->applyControls(0); + + for (unsigned int i = 1; i < 100; i++) { + ctrls.set(V4L2_CID_BRIGHTNESS, 1); + delayed->push(ctrls, startCookie + i); + + delayed->applyControls(i); + + auto [result, cookie] = delayed->get(i); + unsigned int expected = startCookie + i - 1; + if (cookie != expected) { + cerr << "Failed cookie value" + << " frame " << i + << " expected cookie " << expected + << " got cookie " << cookie + << endl; + return TestFail; + } + } + + return TestPass; + } + int run() override { int ret; @@ -291,6 +330,11 @@ protected: if (ret) return ret; + /* Test cookie values. */ + ret = cookieValue(); + if (ret) + return ret; + return TestPass; }