{"id":12389,"url":"https://patchwork.libcamera.org/api/patches/12389/?format=json","web_url":"https://patchwork.libcamera.org/patch/12389/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210524170055.74178-1-nfraprado@collabora.com>","date":"2021-05-24T17:00:55","name":"[libcamera-devel,v3] lc-compliance: Add test to call multiple configure()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"71e1de6a17a363b1856b333efe1fa8b91b96c66b","submitter":{"id":84,"url":"https://patchwork.libcamera.org/api/people/84/?format=json","name":"Nícolas F. R. A. Prado","email":"nfraprado@collabora.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12389/mbox/","series":[{"id":2056,"url":"https://patchwork.libcamera.org/api/series/2056/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2056","date":"2021-05-24T17:00:55","name":"[libcamera-devel,v3] lc-compliance: Add test to call multiple configure()","version":3,"mbox":"https://patchwork.libcamera.org/series/2056/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12389/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12389/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 6F1EAC3201\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 May 2021 17:01:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0E26F68919;\n\tMon, 24 May 2021 19:01:51 +0200 (CEST)","from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A2F6B601AA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 May 2021 19:01:49 +0200 (CEST)","from [127.0.0.1] (localhost [127.0.0.1])\n\t(Authenticated sender: nfraprado) with ESMTPSA id 9307E1F420EA"],"From":"=?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= <nfraprado@collabora.com>","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","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v3] lc-compliance: Add test to call\n\tmultiple configure()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"kernel@collabora.com, =?utf-8?q?Andr=C3=A9_Almeida?=\n\t<andrealmeid@collabora.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add a test to lc-compliance that calls configure() multiple times on the\ncamera before starting to capture. This isn't a common pattern for\napplications but is allowed and so should be tested by lc-compliance.\n\nSigned-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n---\nChanges in v3:\n- Thanks to Niklas:\n  - Add missing blank line\n\nChanges in v2:\n- Thanks to Niklas:\n  - Move roles vector inside the configure test\n\n src/lc-compliance/single_stream.cpp | 33 ++++++++++++++++++++++++++++-\n 1 file changed, 32 insertions(+), 1 deletion(-)","diff":"diff --git a/src/lc-compliance/single_stream.cpp b/src/lc-compliance/single_stream.cpp\nindex 8318b42f42d6..cdc13461c7de 100644\n--- a/src/lc-compliance/single_stream.cpp\n+++ b/src/lc-compliance/single_stream.cpp\n@@ -33,6 +33,27 @@ Results::Result testRequestBalance(std::shared_ptr<Camera> camera,\n \t\tstd::to_string(startCycles) + \" start cycles\" };\n }\n \n+Results::Result testMultipleConfigures(std::shared_ptr<Camera> camera,\n+\t\t\t\t       StreamRole role, unsigned int numRequests)\n+{\n+\tconst std::vector<StreamRole> roles = { Raw, StillCapture, VideoRecording, Viewfinder };\n+\tResults::Result ret;\n+\n+\tSimpleCaptureBalanced capture(camera);\n+\n+\tfor (auto r: roles) {\n+\t\tret = capture.configure(r);\n+\t\tif (ret.first == Results::Fail)\n+\t\t\treturn ret;\n+\t}\n+\n+\tret = capture.configure(role);\n+\tif (ret.first != Results::Pass)\n+\t\treturn ret;\n+\n+\treturn capture.capture(numRequests);\n+}\n+\n Results::Result testRequestUnbalance(std::shared_ptr<Camera> camera,\n \t\t\t\t     StreamRole role, unsigned int numRequests)\n {\n@@ -55,7 +76,7 @@ Results testSingleStream(std::shared_ptr<Camera> camera)\n \t};\n \tstatic const std::vector<unsigned int> numRequests = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 };\n \n-\tResults results(numRequests.size() * roles.size() * 3);\n+\tResults results(numRequests.size() * roles.size() * 3 + roles.size());\n \n \tfor (const auto &role : roles) {\n \t\tstd::cout << \"= Test role \" << role.first << std::endl;\n@@ -91,6 +112,16 @@ Results testSingleStream(std::shared_ptr<Camera> camera)\n \t\tstd::cout << \"* Test unbalanced stop\" << std::endl;\n \t\tfor (unsigned int num : numRequests)\n \t\t\tresults.add(testRequestUnbalance(camera, role.second, num));\n+\n+\t\t/*\n+\t\t * Test multiple configure()\n+\t\t *\n+\t\t * Makes sure that the camera supports being configured multiple\n+\t\t * times, with only the last one taking effect, before starting\n+\t\t * to capture.\n+\t\t */\n+\t\tstd::cout << \"* Test multiple configure()\" << std::endl;\n+\t\tresults.add(testMultipleConfigures(camera, role.second, numRequests.back()));\n \t}\n \n \treturn results;\n","prefixes":["libcamera-devel","v3"]}