{"id":18253,"url":"https://patchwork.libcamera.org/api/1.1/patches/18253/?format=json","web_url":"https://patchwork.libcamera.org/patch/18253/","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-9-naush@raspberrypi.com>","date":"2023-02-03T09:44:24","name":"[libcamera-devel,v1,8/8] libcamera: apps: lcc: Add stream hints test","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2a5641b7ccfa8b9fd74a6dc3d939e6cfd49eda82","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/18253/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/18253/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18253/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 80EFAC329E\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 4C21E625E7;\n\tFri,  3 Feb 2023 10:44:36 +0100 (CET)","from mail-wr1-x436.google.com (mail-wr1-x436.google.com\n\t[IPv6:2a00:1450:4864:20::436])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 8878E625E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Feb 2023 10:44:32 +0100 (CET)","by mail-wr1-x436.google.com with SMTP id h12so4087732wrv.10\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 03 Feb 2023 01:44:32 -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.31\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 03 Feb 2023 01:44:31 -0800 (PST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1675417476;\n\tbh=LUAtUnrEzmwGTWKwtNC+GNZf02WnRv8bO7rk/b6Yt0Y=;\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=YX0wsH50eSYajFSMDeVPNpptcJ/hDT8Inc8RHe50iuKle7wERddBctm3DNT+drVsr\n\tqZBnGRDV7QlkZO9RKtpTOETfQ2VWwAaLfQvq94OHWVQ/gDepCHg/Mfp2axS5Cj3+pw\n\tFTO0dsR9XghRbFxGmB01CqZV6DModCQgdxB2KJ8urFZwBjCVHA2B4Rrm3RefdKZ4is\n\tdQ/woWwBc30VfBYraJzvo+HQ4T/+czOUQMF6KpVGedSRUyP57jYYoJ1qAwmAweWTlc\n\tOwI1gkG3t+TqCFaJMgaZmxVtxZiR4DeCHZlvrc1MtR0Y+LUS4gBxbq7diU0n/BxGk1\n\t/iEP7BOTE6dTA==","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=2scObb81b/oIwD4q0wu6Jc8r9Izoe6TDhaQrbOzkfu8=;\n\tb=IhBsMNSBmLOOMY83FeBaj89LiAj3w36TPSpEPEOevAtDUi94ZmZ2sCXhfg6AXfx5f2\n\tD6AMCSGKz7H8Og3wl3rMWi8TnNKyHJl0y2aUngjV3dnjX2VzK9hPIHxy6Pje/uZury+0\n\t/dQYkRyBbINv/L++V0cnxGBjdRfmP1WN/fh6QFFDGH637JtBqa8JMWWz4FJFjAkqp5GA\n\tEeGp9obqhcTD/mWYVK6qaNEyf6fxh3EKTVggaNE++iAPHs8+5gz8VMcvvtuzkBhG1n3g\n\to5KHS+tiSadTK+RFQhqMzWFZEaECX7sCsziuNRfxMEkkY5CM4ob4j6nOfe6Ru4/c06U5\n\tly6g=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"IhBsMNSB\"; 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=2scObb81b/oIwD4q0wu6Jc8r9Izoe6TDhaQrbOzkfu8=;\n\tb=qAvHwzQ/t2ynhfUpn+DEjXQRHTs5t9hi81j3Z1qikExDy9sLGBWXdGXe/hQY/Z6vSs\n\t5uL7rhnt0XkfgRafJ1jBZn66jh3vhgzJxiY328wo8RZ3RrHrAw3U8+CpvudOEqzjVHfc\n\tc5t3jdbMka+l1qCZxn2If5LgU4x6hCpQrCX5aEOMtMGOF5zppFvDXAelGxYYTpVbzG3P\n\t3VR/Lt+RjyVoG+bpmqgruL7HacKbjL453tsqK11uzKl/beP1X2gm2D8dBXQwZ7VR7s7i\n\tHfYwgX51zbOPzxr4t1fKcm0Fycp3A9W1fcIkEx9b+BnSscOhx9ijIkXbEPZ/v87iz+mf\n\tlr6g==","X-Gm-Message-State":"AO0yUKXaMrfn5bwR2FSWKcmbwIaimWpyeuCSxFcxifkkwusme71xmvVo\n\tgtlEiwf+sbd4hnEy6sighflEcp6CG7rFWPAum6ZXvw==","X-Google-Smtp-Source":"AK7set8olCrDn/zhPCQqPR2VQRy1Q981eRT292dxOoeL3SxnTkWaLU4gvLcmyfuVnRzGuV6HKN89xg==","X-Received":"by 2002:a05:6000:2ce:b0:2bf:f805:5220 with SMTP id\n\to14-20020a05600002ce00b002bff8055220mr11171656wry.43.1675417471860; \n\tFri, 03 Feb 2023 01:44:31 -0800 (PST)","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  3 Feb 2023 09:44:24 +0000","Message-Id":"<20230203094424.25243-9-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 8/8] libcamera: apps: lcc: Add stream\n\thints test","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, MultiCaptureHints. This tests the MandatoryStream\nhint flag and ensures that requests are cancelled correctly if the flag\nis set and no buffer is provided.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/apps/lc-compliance/capture_test.cpp  | 21 +++++++++++\n src/apps/lc-compliance/multi_capture.cpp | 48 ++++++++++++++++++++++++\n src/apps/lc-compliance/multi_capture.h   | 17 +++++++++\n 3 files changed, 86 insertions(+)","diff":"diff --git a/src/apps/lc-compliance/capture_test.cpp b/src/apps/lc-compliance/capture_test.cpp\nindex c6a09a63248a..9239e8b5fc8a 100644\n--- a/src/apps/lc-compliance/capture_test.cpp\n+++ b/src/apps/lc-compliance/capture_test.cpp\n@@ -229,6 +229,27 @@ TEST_P(MultiStream, CaptureOptional)\n \tcapture.capture(numRequests, NumStreams, 1);\n }\n \n+/*\n+ * Test mandatory stream hints\n+ *\n+ * Mark a single stream as mandatory, and don't provide a buffer for it in the\n+ * request. This should case the queueRequest call to fail.\n+ */\n+TEST_P(MultiStream, CaptureHints)\n+{\n+\tconstexpr unsigned int NumStreams = 2;\n+\n+\tauto [roles, numRequests] = GetParam();\n+\n+\tMultiCaptureHints capture0(camera_, 0);\n+\tcapture0.configure({ roles.first, roles.second });\n+\tcapture0.capture(NumStreams);\n+\n+\tMultiCaptureHints capture1(camera_, 1);\n+\tcapture1.configure({ roles.first, roles.second });\n+\tcapture1.capture(NumStreams);\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 a011dfb285c8..6aa39b7e281f 100644\n--- a/src/apps/lc-compliance/multi_capture.cpp\n+++ b/src/apps/lc-compliance/multi_capture.cpp\n@@ -238,3 +238,51 @@ void MultiCaptureOptional::capture(unsigned int numRequests, unsigned int numStr\n \n \tASSERT_EQ(captureCount_, captureLimit_);\n }\n+\n+/* MultiCaptureHints */\n+\n+MultiCaptureHints::MultiCaptureHints(std::shared_ptr<Camera> camera,\n+\t\t\t\t     unsigned int mandatoryStream)\n+\t: MultiCaptureBase(camera), mandatoryStream_(mandatoryStream)\n+{\n+}\n+\n+void MultiCaptureHints::capture(unsigned int numStreams)\n+{\n+\tstart();\n+\n+\tstd::vector<const FrameBufferList *>\n+\t\tbuffers = prepareBuffers(config_->at(0).bufferCount, numStreams);\n+\n+\tif (!buffers.size())\n+\t\tGTEST_SKIP();\n+\n+\t/* Queue a single request */\n+\tstd::unique_ptr<Request> request = camera_->createRequest();\n+\tASSERT_TRUE(request) << \"Can't create request\";\n+\n+\tfor (unsigned int j = 0; j < numStreams; j++) {\n+\t\tconst FrameBufferList *bufferList = buffers[j];\n+\t\tStream *stream = config_->at(j).stream();\n+\n+\t\t/*\n+\t\t * Do not add a buffer for the mandatory stream to cause a\n+\t\t * deliberate failure.\n+\t\t */\n+\t\tif (j == mandatoryStream_)\n+\t\t\tcontinue;\n+\n+\t\tASSERT_EQ(request->addBuffer(stream, (*bufferList)[0].get()), 0)\n+\t\t\t<< \"Can't set buffer for request\";\n+\t}\n+\n+\tASSERT_EQ(camera_->queueRequest(request.get()), -ENOMEM)\n+\t\t<< \"queueRequest did not fail!\";\n+\n+\tstop();\n+}\n+\n+void MultiCaptureHints::updateConfig()\n+{\n+\tconfig_.get()->at(mandatoryStream_).hints = StreamConfiguration::Hint::MandatoryStream;\n+}\ndiff --git a/src/apps/lc-compliance/multi_capture.h b/src/apps/lc-compliance/multi_capture.h\nindex 3d92ba3d4c10..c48c16e7565d 100644\n--- a/src/apps/lc-compliance/multi_capture.h\n+++ b/src/apps/lc-compliance/multi_capture.h\n@@ -68,3 +68,20 @@ public:\n \tvoid capture(unsigned int numRequests, unsigned int numStreams,\n \t\t     unsigned int optionalStream);\n };\n+\n+class MultiCaptureHints : public MultiCaptureBase\n+{\n+public:\n+\tMultiCaptureHints(std::shared_ptr<libcamera::Camera> camera,\n+\t\t\t  unsigned int mandatoryStream);\n+\n+\tvoid capture(unsigned int numStreams);\n+\n+private:\n+\tvoid updateConfig() override;\n+\tvoid requestComplete([[maybe_unused]] libcamera::Request *request) override\n+\t{\n+\t}\n+\n+\tunsigned int mandatoryStream_;\n+};\n","prefixes":["libcamera-devel","v1","8/8"]}