{"id":495,"url":"https://patchwork.libcamera.org/api/1.1/patches/495/?format=json","web_url":"https://patchwork.libcamera.org/patch/495/","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":"<20190203110102.5663-9-kieran.bingham@ideasonboard.com>","date":"2019-02-03T11:00:59","name":"[libcamera-devel,08/11] test: v4l2_device: Add a functional capture test","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"e9d1bb9fc55547d6a227a0d7b20ec5e5e3dc241e","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/1.1/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/495/mbox/","series":[{"id":165,"url":"https://patchwork.libcamera.org/api/1.1/series/165/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=165","date":"2019-02-03T11:00:51","name":"libcamera: V4L2 Streams","version":1,"mbox":"https://patchwork.libcamera.org/series/165/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/495/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/495/checks/","tags":{},"headers":{"Return-Path":"<kieran.bingham@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 98FB760DD1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSun,  3 Feb 2019 12:01:08 +0100 (CET)","from localhost.localdomain\n\t(218.182-78-194.adsl-static.isp.belgacom.be [194.78.182.218])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 460815AA;\n\tSun,  3 Feb 2019 12:01:08 +0100 (CET)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1549191668;\n\tbh=n2JjINr+mWY49vb4kt1nljqEvmVsceUWHcYrY14V15k=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=HuINa73w0toz9UoZDJu6gbuOd4ECfunrgTTN6H1d/TT6wtmzP9utmSeCMnPLC/0+6\n\tCNKtyoEqawTpiQE0APOYQEFnAQn4Pxu67Ym6xr0FWVxYja82TtxS/zhWHOyqXAT54/\n\t3kJUhHHvUQA392nSBV/E3vHY7KxdG8fgHxuWnM/k=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Date":"Sun,  3 Feb 2019 12:00:59 +0100","Message-Id":"<20190203110102.5663-9-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.19.1","In-Reply-To":"<20190203110102.5663-1-kieran.bingham@ideasonboard.com>","References":"<20190203110102.5663-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 08/11] test: v4l2_device: Add a functional\n\tcapture test","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","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>","X-List-Received-Date":"Sun, 03 Feb 2019 11:01:10 -0000"},"content":"We now have enough infrastructure to be able to capture frames from a\nbasic UVC device. Provide a test loop which captures frames, and returns\nthem back to the kernel.\n\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n test/v4l2_device/capture_frames.cpp | 51 +++++++++++++++++++++++++++++\n test/v4l2_device/meson.build        |  1 +\n 2 files changed, 52 insertions(+)\n create mode 100644 test/v4l2_device/capture_frames.cpp","diff":"diff --git a/test/v4l2_device/capture_frames.cpp b/test/v4l2_device/capture_frames.cpp\nnew file mode 100644\nindex 000000000000..276be91a9a82\n--- /dev/null\n+++ b/test/v4l2_device/capture_frames.cpp\n@@ -0,0 +1,51 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\n+ *\n+ * libcamera V4L2 API tests\n+ */\n+\n+#include \"v4l2_device_test.h\"\n+\n+class CaptureFrames : public V4L2DeviceTest\n+{\n+protected:\n+\tint run()\n+\t{\n+\t\tint ret;\n+\n+\t\tBufferPool *pool = dev_->requestBuffers(8);\n+\t\tif (!pool)\n+\t\t\treturn TestFail;\n+\n+\t\tret = dev_->streamOn();\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\n+\t\t/*\n+\t\t * With no dispatcher loop, the internal asynchronous buffer\n+\t\t * retrieval will not operate.\n+\t\t *\n+\t\t * We can manually validate the dequeueBuffer() and\n+\t\t * queueBuffer() calls directly here.\n+\t\t *\n+\t\t * The application should not use these calls directly if it\n+\t\t * makes any calls to:\n+\t\t * \tdispatcher->processEvents();\n+\t\t */\n+\t\tfor (unsigned int i; i < 30; ++i) {\n+\t\t\tauto buffer = dev_->dequeueBuffer();\n+\n+\t\t\t/* Check buffer */\n+\t\t\tif (!buffer)\n+\t\t\t\treturn TestFail;\n+\n+\t\t\tif (dev_->queueBuffer(buffer))\n+\t\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\treturn dev_->streamOff();\n+\t}\n+};\n+\n+TEST_REGISTER(CaptureFrames);\ndiff --git a/test/v4l2_device/meson.build b/test/v4l2_device/meson.build\nindex cbaa79da9b81..f04c7ded009c 100644\n--- a/test/v4l2_device/meson.build\n+++ b/test/v4l2_device/meson.build\n@@ -4,6 +4,7 @@ v4l2_device_tests = [\n   [ 'double_open',        'double_open.cpp' ],\n   [ 'request_buffers',    'request_buffers.cpp' ],\n   [ 'stream_on_off',      'stream_on_off.cpp' ],\n+  [ 'capture_frames',     'capture_frames.cpp' ],\n ]\n \n foreach t : v4l2_device_tests\n","prefixes":["libcamera-devel","08/11"]}