From patchwork Mon Apr 28 09:02:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Sven_P=C3=BCschel?= X-Patchwork-Id: 23286 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 1171BC327D for ; Mon, 28 Apr 2025 09:05:35 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 73CB868ADE; Mon, 28 Apr 2025 11:05:35 +0200 (CEST) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9EDBE68B29 for ; Mon, 28 Apr 2025 11:05:08 +0200 (CEST) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=peter.guest.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1u9KQG-0001au-4A; Mon, 28 Apr 2025 11:05:08 +0200 From: =?utf-8?q?Sven_P=C3=BCschel?= To: libcamera-devel@lists.libcamera.org Cc: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Paul Elder Subject: [PATCH v11 14/19] lc-compliance: Add test to queue more requests than hardware depth Date: Mon, 28 Apr 2025 11:02:39 +0200 Message-ID: <20250428090413.38234-15-s.pueschel@pengutronix.de> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250428090413.38234-1-s.pueschel@pengutronix.de> References: <20250428090413.38234-1-s.pueschel@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: s.pueschel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: libcamera-devel@lists.libcamera.org 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: NĂ­colas F. R. A. Prado A pipeline handler should be able to handle an arbitrary number of simultaneous requests by submitting what it can to the video device and queuing the rest internally until resources are available. This isn't currently done by some pipeline handlers however [1]. Add a new test to lc-compliance that submits a lot of requests at once to check if the pipeline handler is behaving well in this situation. [1] https://bugs.libcamera.org/show_bug.cgi?id=24 Signed-off-by: NĂ­colas F. R. A. Prado Reviewed-by: Paul Elder Signed-off-by: Paul Elder --- Changes in v11: - Removed Capture class overloading - Adapted to also handle multiple roles Changes in v9: - rebased (no changes since v6) Changes in v6: - Made MAX_SIMULTANEOUS_REQUESTS a constexpr Changes in v5: - Updated to use googletest, and CameraHolder and roleToString from previous patches --- src/apps/lc-compliance/tests/capture_test.cpp | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/apps/lc-compliance/tests/capture_test.cpp b/src/apps/lc-compliance/tests/capture_test.cpp index 24081fef..3aa82858 100644 --- a/src/apps/lc-compliance/tests/capture_test.cpp +++ b/src/apps/lc-compliance/tests/capture_test.cpp @@ -21,6 +21,8 @@ namespace { using namespace libcamera; +static constexpr unsigned int MAX_SIMULTANEOUS_REQUESTS = 8; + class SimpleCapture : public testing::TestWithParam, int>>, public CameraHolder { public: @@ -58,6 +60,36 @@ std::string SimpleCapture::nameParameters(const testing::TestParamInfo>, public CameraHolder +{ +public: + static std::string nameParameters(const testing::TestParamInfo &info); + +protected: + void SetUp() override; + void TearDown() override; +}; + +void RoleParametrizedTest::SetUp() +{ + acquireCamera(); +} + +void RoleParametrizedTest::TearDown() +{ + releaseCamera(); +} + +std::string RoleParametrizedTest::nameParameters(const testing::TestParamInfo &info) +{ + std::ostringstream ss; + + for (StreamRole r : info.param) + ss << r << '_'; + + return ss.str(); +} + /* * Test single capture cycles * @@ -120,6 +152,19 @@ TEST_P(SimpleCapture, UnbalancedStop) capture.run(numRequests); } +TEST_P(RoleParametrizedTest, Overflow) +{ + auto roles = GetParam(); + + Capture capture(camera_); + + capture.configure(roles); + + capture.allocateBuffers(MAX_SIMULTANEOUS_REQUESTS); + + capture.run(MAX_SIMULTANEOUS_REQUESTS, MAX_SIMULTANEOUS_REQUESTS); +} + const int NUMREQUESTS[] = { 1, 2, 3, 5, 8, 13, 21, 34, 55, 89 }; const std::vector SINGLEROLES[] = { @@ -148,4 +193,14 @@ INSTANTIATE_TEST_SUITE_P(MultiStream, testing::ValuesIn(NUMREQUESTS)), SimpleCapture::nameParameters); +INSTANTIATE_TEST_SUITE_P(SingleStream, + RoleParametrizedTest, + testing::ValuesIn(SINGLEROLES), + RoleParametrizedTest::nameParameters); + +INSTANTIATE_TEST_SUITE_P(MultiStream, + RoleParametrizedTest, + testing::ValuesIn(MULTIROLES), + RoleParametrizedTest::nameParameters); + } /* namespace */