{"id":18252,"url":"https://patchwork.libcamera.org/api/1.1/patches/18252/?format=json","web_url":"https://patchwork.libcamera.org/patch/18252/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20230203094424.25243-8-naush@raspberrypi.com>","date":"2023-02-03T09:44:23","name":"[libcamera-devel,v1,7/8] libcamera: apps: lcc: Add optional stream tests","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"ca32f2673af82cb2427215cfa1e8b364e7d567e3","submitter":{"id":34,"url":"https://patchwork.libcamera.org/api/1.1/people/34/?format=json","name":"Naushir Patuck","email":"naush@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18252/mbox/","series":[{"id":3739,"url":"https://patchwork.libcamera.org/api/1.1/series/3739/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3739","date":"2023-02-03T09:44:16","name":"Stream hints","version":1,"mbox":"https://patchwork.libcamera.org/series/3739/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18252/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18252/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 077B8C329D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Feb 2023 09:44:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C02BA625F5;\n\tFri,  3 Feb 2023 10:44:35 +0100 (CET)","from mail-wr1-x434.google.com (mail-wr1-x434.google.com\n\t[IPv6:2a00:1450:4864:20::434])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BF42C625EE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Feb 2023 10:44:31 +0100 (CET)","by mail-wr1-x434.google.com with SMTP id bt17so1065507wrb.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 03 Feb 2023 01:44:31 -0800 (PST)","from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tf17-20020a5d50d1000000b002bfe266d710sm1562503wrt.90.2023.02.03.01.44.30\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 03 Feb 2023 01:44:30 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1675417475;\n\tbh=CR3beotvVv+IR6MJ9i1aC77DfZeOx13xFujkR6NZtX0=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=O9QqS1nyPznxlk+ev8K9CIGoQKSVXrr8UQ2uKsXYIdiBP0ooltcrLxcJycXn+BTre\n\ti1goqu3KyFittQ8g+uglNNm43V6U/wSIkg+C+xZSpNOzkIMVQLN2yzJFmBaVqeAVh7\n\tuKky+fd7Ma53C2UGVjgu9+hSprV3K6w6OYgVue0mHvyxDwStfe4bosciUxAABLO5b1\n\tcdTihFK8hao+vbkhtccUR5Z8tRMawG7mvuSQBHxbuh6LUlknLKS8HDG/GDLaosXUU/\n\twwUEBcte2qZguWBUHYQ5YYMb82V8iBBSRof6YFZCAcyNvqQ05EmiFdfDLASiBNEvBr\n\t1zIq7+GKZ6xzQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=/hgBGNe9687TY2y9ydcpdr81a5GOgRL+7LnWjqWMLcw=;\n\tb=ZURSzyR6AuhgxTHyw+Yv2cAvotH9yofaZEyGsjUgmMtVgNTGtvrgtf57mGj+SJyxCI\n\tjplku1R4dYgB2PCK4HSOxOE5hZcjy/xsfCeiEJ4SBTrv06APFYA5AXSC4XrNk92VpP4q\n\tvb3kuLjy31//qk+kxMZNBM4TSL240br59jEnS8ZVtlf/gqWI2OR21EjIZT+nfu5SUCoQ\n\tagW8ogQAkRf1yyPSSK0emmPjvyKUBe0DS12Eh4pjRS+XHRnUJFIF25kIhY4rEDJERHY8\n\tzRI8VxF7Eg2OW2BPnUgwK9Up1sl9E9c5SDWaV0lPHKzmbO8fKsopaSF0I/ALd/QjA3sC\n\trTFg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"ZURSzyR6\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=/hgBGNe9687TY2y9ydcpdr81a5GOgRL+7LnWjqWMLcw=;\n\tb=dhoBTSuNWifxjLRS/GnTo15lPTqgIC0i8xdxjXzFUWMBfyW1hVeExBm1rOHULOhzVf\n\tvNgpr+tU294X/cc+7E0XA3KBLGyVeOvNfVZWi2SAwFxURcVEWCnkEPLrNNO53n0kg6rZ\n\tnX0uhX9+WgS+4snt5UkjoamjYjBieEzCU/qJpOtv7x1KxiS8PKZpHgklo7iePKrGYYZs\n\tXj16DiJcGYykcHhpEjyzA0D1lRl59CE0Dw0gPyPsi6MSisDTLyUG00UFVuwM1nwa/775\n\tHeT6Annl8SYug8UwW4R4WiSTVlN+hLf2Ty/HTP55PS46sU/GHIxFPUMDWYmp4wdV8AyE\n\t0Dcg==","X-Gm-Message-State":"AO0yUKUy076c5YoEQN4y8OTeoFu9RbWruhBzlRtGtlTTqjnWSg+VQ3uh\n\tkeYmIvrySbqQSGeEK4o8n2a6f1kFt/pW9wNJ+i5PTA==","X-Google-Smtp-Source":"AK7set/9jaD9mTeL8acBBAyrmWk4TWNZBhQzFqYYPiY63DX++QmPTT5I6LjAj6A2CYbPZ1jV65oW/Q==","X-Received":"by 2002:a5d:4537:0:b0:2bf:adfb:58cd with SMTP id\n\tj23-20020a5d4537000000b002bfadfb58cdmr8353690wra.30.1675417471271; \n\tFri, 03 Feb 2023 01:44:31 -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","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1 7/8] libcamera: apps: lcc: Add optional\n\tstream tests","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>","From":"Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Naushir Patuck <naush@raspberrypi.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add a new test class, MultiCaptureOptional. This tests operating with\nmultiple streams, where one of the two streams is not provided buffers\nin certain requests.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/apps/lc-compliance/capture_test.cpp  | 20 +++++++++\n src/apps/lc-compliance/multi_capture.cpp | 53 ++++++++++++++++++++++++\n src/apps/lc-compliance/multi_capture.h   |  9 ++++\n 3 files changed, 82 insertions(+)","diff":"diff --git a/src/apps/lc-compliance/capture_test.cpp b/src/apps/lc-compliance/capture_test.cpp\nindex 8d534161e985..c6a09a63248a 100644\n--- a/src/apps/lc-compliance/capture_test.cpp\n+++ b/src/apps/lc-compliance/capture_test.cpp\n@@ -209,6 +209,26 @@ TEST_P(MultiStream, Capture)\n \tcapture.capture(numRequests, NumStreams);\n }\n \n+/*\n+ * Test optional stream capture cycles\n+ *\n+ * Do not provide buffers for all streams in all Requests, testing that stream\n+ * output can be optional.\n+ */\n+TEST_P(MultiStream, CaptureOptional)\n+{\n+\tconstexpr unsigned int NumStreams = 2;\n+\n+\tauto [roles, numRequests] = GetParam();\n+\n+\tMultiCaptureOptional capture(camera_);\n+\n+\tcapture.configure({ roles.first, roles.second });\n+\n+\tcapture.capture(numRequests, NumStreams, 0);\n+\tcapture.capture(numRequests, NumStreams, 1);\n+}\n+\n INSTANTIATE_TEST_SUITE_P(MultiCaptureTests,\n \t\t\t MultiStream,\n \t\t\t testing::Combine(testing::ValuesIn(MULTIROLES),\ndiff --git a/src/apps/lc-compliance/multi_capture.cpp b/src/apps/lc-compliance/multi_capture.cpp\nindex 23becf964fd7..a011dfb285c8 100644\n--- a/src/apps/lc-compliance/multi_capture.cpp\n+++ b/src/apps/lc-compliance/multi_capture.cpp\n@@ -185,3 +185,56 @@ void MultiCapture::requestComplete(Request *request)\n \tif (queueRequest(request))\n \t\tloop_->exit(-EINVAL);\n }\n+\n+/* MultiCaptureOptional */\n+\n+MultiCaptureOptional::MultiCaptureOptional(std::shared_ptr<Camera> camera)\n+\t: MultiCapture(camera)\n+{\n+}\n+\n+void MultiCaptureOptional::capture(unsigned int numRequests, unsigned int numStreams,\n+\t\t\t\t   unsigned int optionalStream)\n+{\n+\tstart();\n+\n+\tqueueCount_ = 0;\n+\tcaptureCount_ = 0;\n+\tcaptureLimit_ = numRequests;\n+\n+\tstd::vector<const FrameBufferList *>\n+\t\tbuffers = prepareBuffers(numRequests, numStreams);\n+\n+\tif (!buffers.size())\n+\t\tGTEST_SKIP();\n+\n+\t/* Queue the recommended number of requests. */\n+\tconst unsigned int inFlightRequests = config_->at(0).bufferCount;\n+\tfor (unsigned int i = 0; i < inFlightRequests; i++) {\n+\t\tstd::unique_ptr<Request> request = camera_->createRequest();\n+\t\tASSERT_TRUE(request) << \"Can't create request\";\n+\n+\t\tfor (unsigned int j = 0; j < numStreams; j++) {\n+\t\t\tconst FrameBufferList *bufferList = buffers[j];\n+\t\t\tStream *stream = config_->at(j).stream();\n+\n+\t\t\tif (j == optionalStream && !i)\n+\t\t\t\tcontinue;\n+\n+\t\t\tASSERT_EQ(request->addBuffer(stream, (*bufferList)[i].get()), 0)\n+\t\t\t\t<< \"Can't set buffer for request\";\n+\t\t}\n+\n+\t\tASSERT_EQ(queueRequest(request.get()), 0)\n+\t\t\t<< \"Failed to queue request\";\n+\t\trequests_.push_back(std::move(request));\n+\t}\n+\n+\t/* Run capture session. */\n+\tloop_ = new EventLoop();\n+\tloop_->exec();\n+\tstop();\n+\tdelete loop_;\n+\n+\tASSERT_EQ(captureCount_, captureLimit_);\n+}\ndiff --git a/src/apps/lc-compliance/multi_capture.h b/src/apps/lc-compliance/multi_capture.h\nindex 9037099988e5..3d92ba3d4c10 100644\n--- a/src/apps/lc-compliance/multi_capture.h\n+++ b/src/apps/lc-compliance/multi_capture.h\n@@ -59,3 +59,12 @@ protected:\n \tunsigned int captureCount_;\n \tunsigned int captureLimit_;\n };\n+\n+class MultiCaptureOptional : public MultiCapture\n+{\n+public:\n+\tMultiCaptureOptional(std::shared_ptr<libcamera::Camera> camera);\n+\n+\tvoid capture(unsigned int numRequests, unsigned int numStreams,\n+\t\t     unsigned int optionalStream);\n+};\n","prefixes":["libcamera-devel","v1","7/8"]}