From patchwork Fri Sep 2 12:08:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17276 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 625CDC327D for ; Fri, 2 Sep 2022 12:08:21 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 728E361FE9; Fri, 2 Sep 2022 14:08:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662120500; bh=YG8zKuN4cx17jT26zExVUEUn1t8fvoswfulGuF4ti20=; 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=ONDYJhGWfspdS61ki9ykU/bF7LNFXokF7bWrHSoL14a8IBBDZJ77sHOxMCknseqKc 6g9ET/ckSa2W1bDMz6C5pPGDXM68bUeeNPlUrFJA1K4R28yVCp/1OOKgL7EE6g7ZK2 JySDXeWX5O+qs/Re5JdeuoKF8BrUbXOdlMTEChF9Fjp4uJG2rH2VmWD62U8jQzAp/a vIdn11Ivmr5K9+bycAOXfhkwHsTeaTaDH1VO4oZLMVrHzW4aOONMmp7wTs9Op8sKsN Hpn0V1hiHvrkYti1BP51FL5DWSmD0XbeJrFOKYddzgZsBsiLkcYPykPUNGahoeZIpb xGYTe4PLIQfbw== Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D53C761FE3 for ; Fri, 2 Sep 2022 14:08:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="kmyfU4tl"; dkim-atps=neutral Received: by mail-wm1-x333.google.com with SMTP id c131-20020a1c3589000000b003a84b160addso2517911wma.2 for ; Fri, 02 Sep 2022 05:08:18 -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=CiHEOsMF91m92inxh4BZs7UxuXbwFOzk4SqKgH3uS1Q=; b=kmyfU4tl7LjBkEWM06Khb3KtGaZYzmfL1xsmuMikFpkffKdbPH1LA9LNiS0Ypaabri sYsIWfMZ2kDKoQPZA1on0txgyHXeLmg6KpePkUtptmOI+C0hrL3uJhspcYEMBqLTuswh Zhlc6dV1rx4wV8TV6gHOzMRneMUzX/3z209Uozuy2cdFT/tDHRFfwG2hdX59kDWTZJNN iX+f89QZ4qpxcnr+fERtgddA5iE40MGkiJzLRBziNywcPXxFkxxABEjX3q4prZxgEBVs 7td3OR5stvkYrFeYlyh5j9DfDv/ujiAQd46iYjXjTAMBU/rL1CGnZyBgCwiot99U3Orm oonQ== 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=CiHEOsMF91m92inxh4BZs7UxuXbwFOzk4SqKgH3uS1Q=; b=2gNB1GmABskDMMf/XKwbWoJDvqdLkl3vthwfz2cOAG2Jue/v1JKiOpW/3KUgn/hpjX wPAGMSO6PHU9wBJbqJEiUlKILKTPX9h9J4S18qCF9lnpDHrl9WpQVXpPin/Tayzvd5Dm aEaulDqRiIOoUaPa8d50xMVIo7+iajGRtowPpSHzCcUUptr/9HkS3fTGkP94vIj36Teq SEYcyMo3zbhohdXFN6nPCrL6g85uZp6/cVL+F56K1F9H31VVy5He0xGOkEMXUCNshgj9 0VQY3k4wwx3s7gpOsW7wy6CmvxNJveaqG7h+mHgGgpOxaybmnFgoQYRGWbmS7FILV/c+ /cNA== X-Gm-Message-State: ACgBeo0PnYuMvuc3gvLkliWkf/gI8eeAfddwTs057a1GUekFMKs0zeyq eDWOKyfuuwfAL40L2z4DRwVr82VlBpALf5Ex X-Google-Smtp-Source: AA6agR7QvNgUJEqlZNjoocw1nXVcHBeYu75N0XE8tcf/wpDpQcX0/WTuNj/bzpesuMYi9a9Xo8IYgQ== X-Received: by 2002:a05:600c:22c8:b0:3a5:c134:1f50 with SMTP id 8-20020a05600c22c800b003a5c1341f50mr2693161wmg.55.1662120498006; Fri, 02 Sep 2022 05:08:18 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id h2-20020a5d4302000000b0021e51c039c5sm1397809wrq.80.2022.09.02.05.08.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 05:08:17 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Fri, 2 Sep 2022 13:08:05 +0100 Message-Id: <20220902120808.842-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220902120808.842-1-naush@raspberrypi.com> References: <20220902120808.842-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 3/6] 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 --- 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; }