From patchwork Mon May 24 17:00:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 12389 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 6F1EAC3201 for ; Mon, 24 May 2021 17:01:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0E26F68919; Mon, 24 May 2021 19:01:51 +0200 (CEST) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A2F6B601AA for ; Mon, 24 May 2021 19:01:49 +0200 (CEST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: nfraprado) with ESMTPSA id 9307E1F420EA From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: libcamera-devel@lists.libcamera.org Date: Mon, 24 May 2021 14:00:55 -0300 Message-Id: <20210524170055.74178-1-nfraprado@collabora.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3] lc-compliance: Add test to call multiple configure() 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: , Cc: kernel@collabora.com, =?utf-8?q?Andr=C3=A9_Almeida?= Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a test to lc-compliance that calls configure() multiple times on the camera before starting to capture. This isn't a common pattern for applications but is allowed and so should be tested by lc-compliance. Signed-off-by: Nícolas F. R. A. Prado Reviewed-by: Niklas Söderlund --- Changes in v3: - Thanks to Niklas: - Add missing blank line Changes in v2: - Thanks to Niklas: - Move roles vector inside the configure test src/lc-compliance/single_stream.cpp | 33 ++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/lc-compliance/single_stream.cpp b/src/lc-compliance/single_stream.cpp index 8318b42f42d6..cdc13461c7de 100644 --- a/src/lc-compliance/single_stream.cpp +++ b/src/lc-compliance/single_stream.cpp @@ -33,6 +33,27 @@ Results::Result testRequestBalance(std::shared_ptr camera, std::to_string(startCycles) + " start cycles" }; } +Results::Result testMultipleConfigures(std::shared_ptr camera, + StreamRole role, unsigned int numRequests) +{ + const std::vector roles = { Raw, StillCapture, VideoRecording, Viewfinder }; + Results::Result ret; + + SimpleCaptureBalanced capture(camera); + + for (auto r: roles) { + ret = capture.configure(r); + if (ret.first == Results::Fail) + return ret; + } + + ret = capture.configure(role); + if (ret.first != Results::Pass) + return ret; + + return capture.capture(numRequests); +} + Results::Result testRequestUnbalance(std::shared_ptr camera, StreamRole role, unsigned int numRequests) { @@ -55,7 +76,7 @@ Results testSingleStream(std::shared_ptr camera) }; static const std::vector numRequests = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 }; - Results results(numRequests.size() * roles.size() * 3); + Results results(numRequests.size() * roles.size() * 3 + roles.size()); for (const auto &role : roles) { std::cout << "= Test role " << role.first << std::endl; @@ -91,6 +112,16 @@ Results testSingleStream(std::shared_ptr camera) std::cout << "* Test unbalanced stop" << std::endl; for (unsigned int num : numRequests) results.add(testRequestUnbalance(camera, role.second, num)); + + /* + * Test multiple configure() + * + * Makes sure that the camera supports being configured multiple + * times, with only the last one taking effect, before starting + * to capture. + */ + std::cout << "* Test multiple configure()" << std::endl; + results.add(testMultipleConfigures(camera, role.second, numRequests.back())); } return results;