From patchwork Fri Feb 3 09:44:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18252 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 077B8C329D for ; Fri, 3 Feb 2023 09:44:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C02BA625F5; Fri, 3 Feb 2023 10:44:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1675417475; bh=CR3beotvVv+IR6MJ9i1aC77DfZeOx13xFujkR6NZtX0=; 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=O9QqS1nyPznxlk+ev8K9CIGoQKSVXrr8UQ2uKsXYIdiBP0ooltcrLxcJycXn+BTre i1goqu3KyFittQ8g+uglNNm43V6U/wSIkg+C+xZSpNOzkIMVQLN2yzJFmBaVqeAVh7 uKky+fd7Ma53C2UGVjgu9+hSprV3K6w6OYgVue0mHvyxDwStfe4bosciUxAABLO5b1 cdTihFK8hao+vbkhtccUR5Z8tRMawG7mvuSQBHxbuh6LUlknLKS8HDG/GDLaosXUU/ wwUEBcte2qZguWBUHYQ5YYMb82V8iBBSRof6YFZCAcyNvqQ05EmiFdfDLASiBNEvBr 1zIq7+GKZ6xzQ== Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BF42C625EE for ; Fri, 3 Feb 2023 10:44:31 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="ZURSzyR6"; dkim-atps=neutral Received: by mail-wr1-x434.google.com with SMTP id bt17so1065507wrb.8 for ; Fri, 03 Feb 2023 01:44:31 -0800 (PST) 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 :message-id:reply-to; bh=/hgBGNe9687TY2y9ydcpdr81a5GOgRL+7LnWjqWMLcw=; b=ZURSzyR6AuhgxTHyw+Yv2cAvotH9yofaZEyGsjUgmMtVgNTGtvrgtf57mGj+SJyxCI jplku1R4dYgB2PCK4HSOxOE5hZcjy/xsfCeiEJ4SBTrv06APFYA5AXSC4XrNk92VpP4q vb3kuLjy31//qk+kxMZNBM4TSL240br59jEnS8ZVtlf/gqWI2OR21EjIZT+nfu5SUCoQ agW8ogQAkRf1yyPSSK0emmPjvyKUBe0DS12Eh4pjRS+XHRnUJFIF25kIhY4rEDJERHY8 zRI8VxF7Eg2OW2BPnUgwK9Up1sl9E9c5SDWaV0lPHKzmbO8fKsopaSF0I/ALd/QjA3sC rTFg== 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:message-id:reply-to; bh=/hgBGNe9687TY2y9ydcpdr81a5GOgRL+7LnWjqWMLcw=; b=dhoBTSuNWifxjLRS/GnTo15lPTqgIC0i8xdxjXzFUWMBfyW1hVeExBm1rOHULOhzVf vNgpr+tU294X/cc+7E0XA3KBLGyVeOvNfVZWi2SAwFxURcVEWCnkEPLrNNO53n0kg6rZ nX0uhX9+WgS+4snt5UkjoamjYjBieEzCU/qJpOtv7x1KxiS8PKZpHgklo7iePKrGYYZs Xj16DiJcGYykcHhpEjyzA0D1lRl59CE0Dw0gPyPsi6MSisDTLyUG00UFVuwM1nwa/775 HeT6Annl8SYug8UwW4R4WiSTVlN+hLf2Ty/HTP55PS46sU/GHIxFPUMDWYmp4wdV8AyE 0Dcg== X-Gm-Message-State: AO0yUKUy076c5YoEQN4y8OTeoFu9RbWruhBzlRtGtlTTqjnWSg+VQ3uh keYmIvrySbqQSGeEK4o8n2a6f1kFt/pW9wNJ+i5PTA== X-Google-Smtp-Source: AK7set/9jaD9mTeL8acBBAyrmWk4TWNZBhQzFqYYPiY63DX++QmPTT5I6LjAj6A2CYbPZ1jV65oW/Q== X-Received: by 2002:a5d:4537:0:b0:2bf:adfb:58cd with SMTP id j23-20020a5d4537000000b002bfadfb58cdmr8353690wra.30.1675417471271; Fri, 03 Feb 2023 01:44:31 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id f17-20020a5d50d1000000b002bfe266d710sm1562503wrt.90.2023.02.03.01.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 01:44:30 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 3 Feb 2023 09:44:23 +0000 Message-Id: <20230203094424.25243-8-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230203094424.25243-1-naush@raspberrypi.com> References: <20230203094424.25243-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 7/8] libcamera: apps: lcc: Add optional stream tests 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 new test class, MultiCaptureOptional. This tests operating with multiple streams, where one of the two streams is not provided buffers in certain requests. Signed-off-by: Naushir Patuck --- src/apps/lc-compliance/capture_test.cpp | 20 +++++++++ src/apps/lc-compliance/multi_capture.cpp | 53 ++++++++++++++++++++++++ src/apps/lc-compliance/multi_capture.h | 9 ++++ 3 files changed, 82 insertions(+) diff --git a/src/apps/lc-compliance/capture_test.cpp b/src/apps/lc-compliance/capture_test.cpp index 8d534161e985..c6a09a63248a 100644 --- a/src/apps/lc-compliance/capture_test.cpp +++ b/src/apps/lc-compliance/capture_test.cpp @@ -209,6 +209,26 @@ TEST_P(MultiStream, Capture) capture.capture(numRequests, NumStreams); } +/* + * Test optional stream capture cycles + * + * Do not provide buffers for all streams in all Requests, testing that stream + * output can be optional. + */ +TEST_P(MultiStream, CaptureOptional) +{ + constexpr unsigned int NumStreams = 2; + + auto [roles, numRequests] = GetParam(); + + MultiCaptureOptional capture(camera_); + + capture.configure({ roles.first, roles.second }); + + capture.capture(numRequests, NumStreams, 0); + capture.capture(numRequests, NumStreams, 1); +} + INSTANTIATE_TEST_SUITE_P(MultiCaptureTests, MultiStream, testing::Combine(testing::ValuesIn(MULTIROLES), diff --git a/src/apps/lc-compliance/multi_capture.cpp b/src/apps/lc-compliance/multi_capture.cpp index 23becf964fd7..a011dfb285c8 100644 --- a/src/apps/lc-compliance/multi_capture.cpp +++ b/src/apps/lc-compliance/multi_capture.cpp @@ -185,3 +185,56 @@ void MultiCapture::requestComplete(Request *request) if (queueRequest(request)) loop_->exit(-EINVAL); } + +/* MultiCaptureOptional */ + +MultiCaptureOptional::MultiCaptureOptional(std::shared_ptr camera) + : MultiCapture(camera) +{ +} + +void MultiCaptureOptional::capture(unsigned int numRequests, unsigned int numStreams, + unsigned int optionalStream) +{ + start(); + + queueCount_ = 0; + captureCount_ = 0; + captureLimit_ = numRequests; + + std::vector + buffers = prepareBuffers(numRequests, numStreams); + + if (!buffers.size()) + GTEST_SKIP(); + + /* Queue the recommended number of requests. */ + const unsigned int inFlightRequests = config_->at(0).bufferCount; + for (unsigned int i = 0; i < inFlightRequests; i++) { + std::unique_ptr request = camera_->createRequest(); + ASSERT_TRUE(request) << "Can't create request"; + + for (unsigned int j = 0; j < numStreams; j++) { + const FrameBufferList *bufferList = buffers[j]; + Stream *stream = config_->at(j).stream(); + + if (j == optionalStream && !i) + continue; + + ASSERT_EQ(request->addBuffer(stream, (*bufferList)[i].get()), 0) + << "Can't set buffer for request"; + } + + ASSERT_EQ(queueRequest(request.get()), 0) + << "Failed to queue request"; + requests_.push_back(std::move(request)); + } + + /* Run capture session. */ + loop_ = new EventLoop(); + loop_->exec(); + stop(); + delete loop_; + + ASSERT_EQ(captureCount_, captureLimit_); +} diff --git a/src/apps/lc-compliance/multi_capture.h b/src/apps/lc-compliance/multi_capture.h index 9037099988e5..3d92ba3d4c10 100644 --- a/src/apps/lc-compliance/multi_capture.h +++ b/src/apps/lc-compliance/multi_capture.h @@ -59,3 +59,12 @@ protected: unsigned int captureCount_; unsigned int captureLimit_; }; + +class MultiCaptureOptional : public MultiCapture +{ +public: + MultiCaptureOptional(std::shared_ptr camera); + + void capture(unsigned int numRequests, unsigned int numStreams, + unsigned int optionalStream); +};