Patch Detail
Show a patch.
GET /api/patches/255/?format=api
{ "id": 255, "url": "https://patchwork.libcamera.org/api/patches/255/?format=api", "web_url": "https://patchwork.libcamera.org/patch/255/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20190117150534.14424-1-jacopo@jmondi.org>", "date": "2019-01-17T15:05:34", "name": "[libcamera-devel] test: pipeline: IPU3: Add IPU3 pipeline test", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "930981fc98ecb5c3a55a1c414acb4f6455266e02", "submitter": { "id": 3, "url": "https://patchwork.libcamera.org/api/people/3/?format=api", "name": "Jacopo Mondi", "email": "jacopo@jmondi.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/255/mbox/", "series": [ { "id": 86, "url": "https://patchwork.libcamera.org/api/series/86/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=86", "date": "2019-01-17T15:05:34", "name": "[libcamera-devel] test: pipeline: IPU3: Add IPU3 pipeline test", "version": 1, "mbox": "https://patchwork.libcamera.org/series/86/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/255/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/255/checks/", "tags": {}, "headers": { "Return-Path": "<jacopo@jmondi.org>", "Received": [ "from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net\n\t[217.70.183.197])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E84C60B1D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Jan 2019 16:05:36 +0100 (CET)", "from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay5-d.mail.gandi.net (Postfix) with ESMTPSA id A107A1C0013;\n\tThu, 17 Jan 2019 15:05:35 +0000 (UTC)" ], "X-Originating-IP": "2.224.242.101", "From": "Jacopo Mondi <jacopo@jmondi.org>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 17 Jan 2019 16:05:34 +0100", "Message-Id": "<20190117150534.14424-1-jacopo@jmondi.org>", "X-Mailer": "git-send-email 2.20.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH] test: pipeline: IPU3: Add IPU3 pipeline\n\ttest", "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": "Thu, 17 Jan 2019 15:05:36 -0000" }, "content": "Add test for the Intel IPU3 pipeline that lists all the cameras\nregistered in the system and verifies the result matches the expected.\n\nThis test is meant to be run on IPU3 platforms, it gets skipped\notherwise.\n\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\nThis test will be the first pipeline specific one that makes possible to\nmake a utility out of test/list-cameras.\n\nTested on Soraka\n\n# ./test/pipeline/ipu3/ipu3_pipeline_test\n[6:45:07.633868891] DBG pipeline_handler.cpp:119 Registered pipeline handler \"VIMC virtual driver pipeline handler\"\n[6:45:07.634117644] DBG pipeline_handler.cpp:119 Registered pipeline handler \"Intel IPU3 pipeline handler\"\n[6:45:07.635352959] DBG device_enumerator.cpp:214 New media device \"ipu3-imgu\" created from /dev/media1\n[6:45:07.635902044] DBG device_enumerator.cpp:214 New media device \"ipu3-cio2\" created from /dev/media0\n[6:45:07.636375573] DBG device_enumerator.cpp:255 Successful match for media device \"ipu3-cio2\"\n[6:45:07.636391321] DBG device_enumerator.cpp:255 Successful match for media device \"ipu3-imgu\"\n[6:45:07.636416091] DBG media_device.cpp:672 ov13858 2-0010[0] -> ipu3-csi2 0[0]: 0\n[6:45:07.636424396] DBG media_device.cpp:672 ov5670 4-0036[0] -> ipu3-csi2 1[0]: 0\n[6:45:07.636457246] DBG media_device.cpp:672 ov13858 2-0010[0] -> ipu3-csi2 0[0]: 1\n[6:45:07.636489583] INFO ipu3.cpp:249 Registered Camera[0] \"ov13858 0\" connected to CSI-2 receiver 0\n[6:45:07.636500653] DBG media_device.cpp:672 ov5670 4-0036[0] -> ipu3-csi2 1[0]: 1\n[6:45:07.636513116] INFO ipu3.cpp:249 Registered Camera[1] \"ov5670 1\" connected to CSI-2 receiver 1\n[6:45:07.636522281] DBG ipu3.cpp:147 \"Intel IPU3\" pipeline handler initialized with 2 cameras registered\n[6:45:07.636540024] DBG pipeline_handler.cpp:150 Pipeline handler \"Intel IPU3 pipeline handler\" matched\nFound camera 'ov13858 0'\nFound camera 'ov5670 1'\n\n---\n test/meson.build | 1 +\n test/pipeline/ipu3/ipu3_pipeline_test.cpp | 147 ++++++++++++++++++++++\n test/pipeline/ipu3/meson.build | 11 ++\n test/pipeline/meson.build | 1 +\n 4 files changed, 160 insertions(+)\n create mode 100644 test/pipeline/ipu3/ipu3_pipeline_test.cpp\n create mode 100644 test/pipeline/ipu3/meson.build\n create mode 100644 test/pipeline/meson.build\n\n--\n2.20.1", "diff": "diff --git a/test/meson.build b/test/meson.build\nindex 3215288..e168991 100644\n--- a/test/meson.build\n+++ b/test/meson.build\n@@ -1,6 +1,7 @@\n subdir('libtest')\n\n subdir('media_device')\n+subdir('pipeline')\n\n public_tests = [\n ['event', 'event.cpp'],\ndiff --git a/test/pipeline/ipu3/ipu3_pipeline_test.cpp b/test/pipeline/ipu3/ipu3_pipeline_test.cpp\nnew file mode 100644\nindex 0000000..fc4c2a2\n--- /dev/null\n+++ b/test/pipeline/ipu3/ipu3_pipeline_test.cpp\n@@ -0,0 +1,147 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2018, Google Inc.\n+ *\n+ * ipu3_pipeline_test.cpp - Intel IPU3 pipeline test\n+ */\n+\n+#include <iostream>\n+\n+#include <sys/types.h>\n+#include <sys/stat.h>\n+#include <unistd.h>\n+\n+#include <libcamera/camera.h>\n+#include <libcamera/camera_manager.h>\n+\n+#include \"media_device.h\"\n+#include \"media_object.h\"\n+#include \"test.h\"\n+\n+using namespace std;\n+using namespace libcamera;\n+\n+/*\n+ * Verify that the Intel IPU3 pipeline handler gets matched and cameras\n+ * are enumerated correctly.\n+ *\n+ * The test is supposed to be run on an IPU3 platform, otherwise it gets\n+ * skipped.\n+ *\n+ * The test lists all cameras registered in the system, if any camera is\n+ * available at all.\n+ */\n+class IPU3PipelineTest : public Test\n+{\n+protected:\n+\tint init();\n+\tint run();\n+\tvoid cleanup();\n+\n+private:\n+\tCameraManager *cameraManager_;\n+\tunsigned int sensors_;\n+};\n+\n+int IPU3PipelineTest::init()\n+{\n+\tconst string devnode(\"/dev/media\");\n+\tbool cio2 = false;\n+\tbool imgu = false;\n+\tunsigned int i;\n+\tint ret;\n+\n+\tsensors_ = 0;\n+\n+\t/*\n+\t * Test all media devices from /dev/media0 to /dev/media256.\n+\t * Media device numbering might not be continue, and we cannot stop\n+\t * as soon as we hit a non accessible media device.\n+\t */\n+\tfor (i = 0; i < 256; i++) {\n+\t\tstring mediadev = devnode + to_string(i);\n+\t\tstruct stat pstat = { };\n+\n+\t\tif (stat(mediadev.c_str(), &pstat))\n+\t\t\tcontinue;\n+\n+\t\tMediaDevice dev(mediadev);\n+\t\tif (dev.open()) {\n+\t\t\tcerr << \"Failed to open media device \" << mediadev << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tif (dev.driver() == \"ipu3-imgu\") {\n+\t\t\timgu = true;\n+\t\t} else if (dev.driver() == \"ipu3-cio2\") {\n+\t\t\t/*\n+\t\t\t * Camera sensor are connected to the CIO2 unit.\n+\t\t\t * Count how many sensors are connected in the system\n+\t\t\t * and later verify this matches the number of registered\n+\t\t\t * cameras.\n+\t\t\t */\n+\t\t\tret = dev.populate();\n+\t\t\tif (ret) {\n+\t\t\t\tcerr << \"Failed to populate media device \" << dev.devnode() << endl;\n+\t\t\t\treturn TestFail;\n+\t\t\t}\n+\n+\t\t\tvector<MediaEntity *> entities = dev.entities();\n+\t\t\tfor (MediaEntity *entity : entities) {\n+\t\t\t\tif (entity->function() == MEDIA_ENT_F_CAM_SENSOR)\n+\t\t\t\t\tsensors_++;\n+\t\t\t}\n+\n+\t\t\tcio2 = true;\n+\t\t}\n+\n+\t\tdev.close();\n+\n+\t\tif (imgu && cio2)\n+\t\t\tbreak;\n+\t}\n+\n+\t/* Not running on an IPU3 system: skip test. */\n+\tif (!(imgu && cio2))\n+\t\treturn TestSkip;\n+\n+\tcameraManager_ = CameraManager::instance();\n+\tret = cameraManager_->start();\n+\tif (ret) {\n+\t\tcerr << \"Failed to start the CameraManager\" << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int IPU3PipelineTest::run()\n+{\n+\tunsigned int cameras = 0;\n+\tvector<string> cameraList = cameraManager_->list();\n+\tfor (auto name : cameraList) {\n+\t\tCamera *cam = cameraManager_->get(name);\n+\t\tif (!cam) {\n+\t\t\tcerr << \"Failed to get camera '\" << name << \"' by name\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n+\t\tcout << \"Found camera '\" << cam->name() << \"'\" << endl;\n+\t\tcameras++;\n+\t}\n+\n+\tif (cameras != sensors_) {\n+\t\tcerr << cameras << \" cameras registered, but \" << sensors_\n+\t\t << \" were expected\" << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\treturn TestPass;\n+}\n+\n+void IPU3PipelineTest::cleanup()\n+{\n+\tcameraManager_->stop();\n+}\n+\n+TEST_REGISTER(IPU3PipelineTest)\ndiff --git a/test/pipeline/ipu3/meson.build b/test/pipeline/ipu3/meson.build\nnew file mode 100644\nindex 0000000..caba5c7\n--- /dev/null\n+++ b/test/pipeline/ipu3/meson.build\n@@ -0,0 +1,11 @@\n+ipu3_test = [\n+ ['ipu3_pipeline_test',\t 'ipu3_pipeline_test.cpp'],\n+]\n+\n+foreach t : ipu3_test\n+ exe = executable(t[0], t[1],\n+ link_with : test_libraries,\n+ include_directories : test_includes_internal)\n+\n+ test(t[0], exe, suite: 'ipu3', is_parallel: false)\n+endforeach\ndiff --git a/test/pipeline/meson.build b/test/pipeline/meson.build\nnew file mode 100644\nindex 0000000..f434c79\n--- /dev/null\n+++ b/test/pipeline/meson.build\n@@ -0,0 +1 @@\n+subdir('ipu3')\n", "prefixes": [ "libcamera-devel" ] }