From patchwork Fri Jan 27 15:43:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 18214 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 62B07C3299 for ; Fri, 27 Jan 2023 15:43:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0E0BB6260E; Fri, 27 Jan 2023 16:43:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1674834233; 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=qNvptr7aMm7njT9sis0aTqnwq4xLcwn1XOseMehFq7n34LWffiF45EOsYHjGM4SYp 7RpFg0f7mznj4V469cgcAG+hHos83NPp27RQEHi1G8DUM0GZcI72yclAKCkAPl9F2T y1VeAKfyyPTXMW/lWC1WdJqMXJ8wy+W6gHXW+r7OhnszBG141oN0g2HCRdcMq7XYhL MBTVDCeY/8TyfCSw5yZvU8G7+vgqVGfU0OKAQc3IhZmGZ60PM6IbXSgooQ7lrr0/s7 wlRtC2GtnBV5VTQOYoSFaYZUxy7+S5CsnE6Cm4JqY3kGNDK24D7GTMWyju6+3GuR7A 764Ext8fxj/1A== Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6071062605 for ; Fri, 27 Jan 2023 16:43:45 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="p2zS6brG"; dkim-atps=neutral Received: by mail-wm1-x336.google.com with SMTP id m15so3740760wms.4 for ; Fri, 27 Jan 2023 07:43:45 -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=p2zS6brGgO0J/UmSHc2dR+MNF+GeU9QdHCaTDmS5Mn9kaBiXnwch2+Vck13Rv6c8zq tCrPD5585wXllHLOPfDU47DefGwRGKJr6fJMTXuEOGkV6WFXxUsyiJSqWACZ28ZEEneM 4TDDx0Y+UbXhD/8ODkTCNja+oyw/+5KtF3vWEFeakQqbdR0yC/lAu8fPgTqe0A3L9qmW Hl0o90FSe7ZW/Dg5DR0PIk0I/+z3zgSQ8zv1Qd3bCQ3/OsYk+bWzxUbok5ShsuqEIzIF 0SLxcuIdHhPRRqTObzBO8nyaiRah1bHFgMX7OElHfLFy/uPOWf7pAp1g/OaAXHYOrvKn tfDQ== 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=QSXz9uVirnveus/vO0y7AXI6FkRU1/VDbvyRpfU9MIi+l6a/rgMsykzLfNdnv6rPu/ kAWIbgq99GTt9uzi0boEf70Tht2t/9RaUdn7pBCw//nh0gAzwcVYjegZm5is4Vf6fUyY WjGLffER3M/n6eczLP3NcvwD0ug5YPhPBzv59M0masGIx2GD7/T2ahAEceWuxCZxrzxf gFGgC/bfRHjnvucQSwb5P/C9KswZSidxTv14W/AFSEK7iYFn9sIYqFgLvLXykmzo2k7Z Q6rO1djoe/UgCIK8idV9yv6G1N3v+cprncSke+Rc4m8OyvofIAPGCaWJ44WpMrsBMjji pVZA== X-Gm-Message-State: AFqh2kqxDTZX/Ne0S3AzOy+2CM0pbK/2Ex10RIY9+q/k2OMvVUIgND6O OIPgaW3sQLIf7xUb3olBzWdqL5pd8FLxVyG6ECY= X-Google-Smtp-Source: AMrXdXugLXhZa8lRtuRFIQsMOfkqyI1NSAsFoemJrSXhUzwQd6L8VH4a4iece2Ym0ajxguUIC9llfg== X-Received: by 2002:a05:600c:1e08:b0:3da:f443:9f0f with SMTP id ay8-20020a05600c1e0800b003daf4439f0fmr41127887wmb.18.1674834224149; Fri, 27 Jan 2023 07:43:44 -0800 (PST) Received: from localhost.localdomain ([93.93.133.154]) by smtp.gmail.com with ESMTPSA id h18-20020a05600c30d200b003c21ba7d7d6sm4549566wmn.44.2023.01.27.07.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 07:43:43 -0800 (PST) To: libcamera-devel@lists.libcamera.org Date: Fri, 27 Jan 2023 15:43:21 +0000 Message-Id: <20230127154322.29019-15-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127154322.29019-1-naush@raspberrypi.com> References: <20230127154322.29019-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v6 14/15] 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); +};