From patchwork Mon Sep 5 07:39:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 17299 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 C9592C3272 for ; Mon, 5 Sep 2022 07:40:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 90B2D62068; Mon, 5 Sep 2022 09:40:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1662363608; 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=ne786i4FaRbhmGmZLrf9FCQiI+TsgR8bu97IW40AUTtC2d2XuGHyJERGNA8jaAGC9 FyKOEcDwGOx7Ltgvu/NF1LSlO/gS2Yn8Jq8LKChhCvlcPte61I4wM22uRto/DVUi/r qZxztC9bRPbF2vgQuE63I1aNW9hq/e17in14SKrbyf3upF4f7yhLNkRDZw8dOSZeKW iROC7Idglz6mu45jg5hqqppizfKu1L2IX/jC/f4W3CwDJHpp6oo+8CcE/FaW96b6bl MJijzWpTkIZjnJsX/w4R5cGXauV/S4QBe2lafJgHm1Ep6BvgIpMBEfr0fZ31KRqWX2 iDCrGM+M87MgQ== Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2137E62058 for ; Mon, 5 Sep 2022 09:40:05 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ZDdzBBHH"; dkim-atps=neutral Received: by mail-wr1-x431.google.com with SMTP id c11so5883643wrp.11 for ; Mon, 05 Sep 2022 00:40:05 -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=ZDdzBBHHT9L4WCTDaUwPi6eHhy8HOv36oIO+Jyk6j5hO2gpHpEY0IUk/0L/4c7aCqw e4rjaEJC+afnbkQjrkhkK9rkIc6w4gl8+QU1iApFV4RSCXlT/sEXhKfztS5wwF1BwbkI n3JY73ASSLPQIPKeUiNoxbaME3mJrdi31ptEJqDf8H2fN1lywAWJ4Ftns97Tiov8Wt5U 02eZA5gu1tu9JpNMgSyo1jQUzACavz1QDG2yrAChgQeIAfeHaS/LxlLc/hZc9mdZgS9/ 0HzJ/cz1TusOGDI3iiYBb8g5fMHayDqYAQVP2bgVwZB8ViMXK59+8grPyZvucBnsF1aI BVGQ== 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=Ji2sa1jlQhIMeJIDbgRDi4/FmgvM0QljgFQssxpn3ElSfz8OU7NHRejGnrrkBHLs92 B2hSvF/5y+0s7KvuP72FMa4p+tW6lbye/5OU/G4h8fM/7VpbDYG5FOmWxQEZml2eS3t/ FOgC6fzGusEFfxFcrMKoRsx8NmtJ2TvFMKNOPFwFcUdMsbzOmTLBAoFIAGATc7N1fI8Q PldFzkL2v3m7MX6UDZdkjYJhwn0lKANpcYm62JtMoX0LknIJlihW2oFHvjG97w/4lCpk xLsiEEC77kR77hcDXyuWltMG5T+2RUSkRSnufQLlrT5F/0d5930poHoSDwuGMZmN/rTU 8Vkw== X-Gm-Message-State: ACgBeo0vE1sr5Dokyv7ag5KANkkOgTEeGR3mtp7sR3X7j76+o802PzXF hRxNlNwhXxeQnrKcL27knqwyMB3Uotz/9Rhi X-Google-Smtp-Source: AA6agR6tRcgLXyKXer3qlusDcX3wZFciJfIgkVyCbVHYULmivuUtg/BdXO1MjtM8W5tbiUNcczYr6A== X-Received: by 2002:a05:6000:1546:b0:226:ee3f:a5d2 with SMTP id 6-20020a056000154600b00226ee3fa5d2mr14130169wry.76.1662363604619; Mon, 05 Sep 2022 00:40:04 -0700 (PDT) Received: from naush-laptop.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id v16-20020a5d5910000000b00228a6ce17b4sm1342841wrd.37.2022.09.05.00.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:40:03 -0700 (PDT) To: libcamera-devel@lists.libcamera.org Date: Mon, 5 Sep 2022 08:39:52 +0100 Message-Id: <20220905073956.7342-4-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220905073956.7342-1-naush@raspberrypi.com> References: <20220905073956.7342-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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; }