{"id":2527,"url":"https://patchwork.libcamera.org/api/patches/2527/?format=json","web_url":"https://patchwork.libcamera.org/patch/2527/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/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":"<20200108083003.16428-2-show.liu@linaro.org>","date":"2020-01-08T08:30:03","name":"[libcamera-devel,v3,1/1] rkisp1: add pipeline test for rkisp1","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"9065ca398e9990661eafd22d062aceb3f353578e","submitter":{"id":24,"url":"https://patchwork.libcamera.org/api/people/24/?format=json","name":"Show Liu","email":"show.liu@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2527/mbox/","series":[{"id":608,"url":"https://patchwork.libcamera.org/api/series/608/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=608","date":"2020-01-08T08:30:02","name":"rkisp1 pipeline test tool","version":3,"mbox":"https://patchwork.libcamera.org/series/608/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2527/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2527/checks/","tags":{},"headers":{"Return-Path":"<show.liu@linaro.org>","Received":["from mail-pf1-x441.google.com (mail-pf1-x441.google.com\n\t[IPv6:2607:f8b0:4864:20::441])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 93FDB6045F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Jan 2020 09:30:19 +0100 (CET)","by mail-pf1-x441.google.com with SMTP id i6so1261740pfc.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 08 Jan 2020 00:30:19 -0800 (PST)","from localhost.localdomain (211-20-20-223.HINET-IP.hinet.net.\n\t[211.20.20.223]) by smtp.gmail.com with ESMTPSA id\n\tr14sm2440781pfh.10.2020.01.08.00.30.16\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 08 Jan 2020 00:30:17 -0800 (PST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=5ETf0lop4gmj3B/JpBtP3zJmLxk+MqjsqGhTmotieOo=;\n\tb=HWWrnJA5DH0U1NFa6fiCGSq0c1b6h7uuyIqptC5gWIdBP8T9/qrZD/JtJRWzSq5nc9\n\tjiff3zY2/0WiUQmDQsHlay4S0X7AFdkZZxJsuWgSBvK1MJXqvC/roeJBwZkIQmbg/ccd\n\t/wCtyCOSCAl37ZRqAdZ0cw6qQwqJ/ad/4OoWLDCrmx9cCx5gr44r0YhGwXRtRadVMGls\n\t3jMWCOqOj8G4dhpVZJkO993yDAEEKoP8BP/UXFllVgcqdXHNJLJ622lqxZJKpavrTPru\n\tkA+P5cSF2+CZN+juDrcAiVDQQJotGwHJq+ymHWmPoAGZSZLYlCsh5fpIB316v6NJfvsx\n\t3QmA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=5ETf0lop4gmj3B/JpBtP3zJmLxk+MqjsqGhTmotieOo=;\n\tb=bUdPhYxxmIyttHR+qCd27xwZ9XMBoh3Bd5lw+srNoWZfJnyWfVBETX3KJbphVKx8s/\n\tejkk1sIUaLtpT5hJPRzGuLIJ9WxjgSzmeXZV0dOuT1AujrJ11bC+hTCBg27coqWsNVCW\n\tpNOEbLOX7OLIB8p4tZKjn7Xe68ucJHIzn1kwzdLjYggMdZxdEbN0TLZJtn3abdSyUonv\n\t+Gx+cmA/gqEBRJXeYznBWzgeHR0GcOr/mFG06GZrRKGh60z9hNXffSR+F/+zEVnQTH/w\n\tFdDwO5WyJFRpjm9fWbX0nb4KLECYVZhEzDbkVUTrase36fGRFNx8OQNfNys2YvOHtbIF\n\tXEzw==","X-Gm-Message-State":"APjAAAVxzfFyhcM3YTCIe5OuIg/g9y9ytKE6rgT3IBQRYEGUROPCUl/K\n\tWtz+JwPl5Spuwj8/dkJBhEzuewj6jXw=","X-Google-Smtp-Source":"APXvYqyJiIkGP/hAO8pJ/b4cec4r/cUepSzuV+vYtYA/cWHO+IZXVXWnsUtHBl0FwqGpLXt1R5OHAg==","X-Received":"by 2002:aa7:8687:: with SMTP id d7mr3830311pfo.164.1578472217844;\n\tWed, 08 Jan 2020 00:30:17 -0800 (PST)","From":"Show Liu <show.liu@linaro.org>","To":"libcamera-devel@lists.libcamera.org","Cc":"peter.griffin@linaro.org, andrey.konovalov@linaro.org,\n\tshow.liu@linaro.org","Date":"Wed,  8 Jan 2020 16:30:03 +0800","Message-Id":"<20200108083003.16428-2-show.liu@linaro.org>","X-Mailer":"git-send-email 2.17.1","In-Reply-To":"<20200108083003.16428-1-show.liu@linaro.org>","References":"<20200108083003.16428-1-show.liu@linaro.org>","Subject":"[libcamera-devel] [PATCH v3 1/1] rkisp1: add pipeline test for\n\trkisp1","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>","X-List-Received-Date":"Wed, 08 Jan 2020 08:30:19 -0000"},"content":"Signed-off-by: Show Liu <show.liu@linaro.org>\n---\n test/pipeline/meson.build                     |   1 +\n test/pipeline/rkisp1/meson.build              |  12 ++\n test/pipeline/rkisp1/rkisp1_pipeline_test.cpp | 114 ++++++++++++++++++\n 3 files changed, 127 insertions(+)\n create mode 100644 test/pipeline/rkisp1/meson.build\n create mode 100644 test/pipeline/rkisp1/rkisp1_pipeline_test.cpp","diff":"diff --git a/test/pipeline/meson.build b/test/pipeline/meson.build\nindex f434c79..157f789 100644\n--- a/test/pipeline/meson.build\n+++ b/test/pipeline/meson.build\n@@ -1 +1,2 @@\n subdir('ipu3')\n+subdir('rkisp1')\ndiff --git a/test/pipeline/rkisp1/meson.build b/test/pipeline/rkisp1/meson.build\nnew file mode 100644\nindex 0000000..d3f9749\n--- /dev/null\n+++ b/test/pipeline/rkisp1/meson.build\n@@ -0,0 +1,12 @@\n+rkisp1_test = [\n+    ['rkisp1_pipeline_test',            'rkisp1_pipeline_test.cpp'],\n+]\n+\n+foreach t : rkisp1_test\n+    exe = executable(t[0], t[1],\n+                     dependencies : libcamera_dep,\n+                     link_with : test_libraries,\n+                     include_directories : test_includes_internal)\n+\n+    test(t[0], exe, suite : 'rkisp1', is_parallel : false)\n+endforeach\ndiff --git a/test/pipeline/rkisp1/rkisp1_pipeline_test.cpp b/test/pipeline/rkisp1/rkisp1_pipeline_test.cpp\nnew file mode 100644\nindex 0000000..91a4772\n--- /dev/null\n+++ b/test/pipeline/rkisp1/rkisp1_pipeline_test.cpp\n@@ -0,0 +1,114 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2020, Linaro\n+ *\n+ * Based on test/pipeline/ipu3/ipu3_pipeline_test.cpp\n+ *\n+ * rkisp1_pipeline_test.cpp - Rockchip RK3399 rkisp1 pipeline test\n+ */\n+\n+#include <iostream>\n+\n+#include <sys/stat.h>\n+#include <sys/types.h>\n+#include <unistd.h>\n+\n+#include <libcamera/camera.h>\n+#include <libcamera/camera_manager.h>\n+\n+#include \"device_enumerator.h\"\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 RK3399 pipeline handler gets matched and cameras\n+ * are enumerated correctly.\n+ *\n+ * The test is supposed to be run on rockchip platform.\n+ *\n+ * The test lists all cameras registered in the system, if any camera is\n+ * available at all.\n+ */\n+class RKISP1PipelineTest : 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 RKISP1PipelineTest::init()\n+{\n+\tunique_ptr<DeviceEnumerator> enumerator = DeviceEnumerator::create();\n+\tif (!enumerator) {\n+\t\tcerr << \"Failed to create device enumerator\" << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\tif (enumerator->enumerate()) {\n+\t\tcerr << \"Failed to enumerate media devices\" << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\tDeviceMatch dm(\"rkisp1\");\n+\n+\tstd::shared_ptr<MediaDevice> rkisp1 = enumerator->search(dm);\n+\tif (!rkisp1) {\n+\t\tcerr << \"Failed to find rkisp1: test skip\" << endl;\n+\t\treturn TestSkip;\n+\t}\n+\n+\tint ret = rkisp1->populate();\n+\tif (ret) {\n+\t\tcerr << \"Failed to populate media device \"\n+\t\t\t<< rkisp1->deviceNode() << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\tsensors_ = 0;\n+\tconst vector<MediaEntity *> &entities = rkisp1->entities();\n+\tfor (MediaEntity *entity : entities) {\n+\t\tif (entity->function() == MEDIA_ENT_F_CAM_SENSOR)\n+\t\t\tsensors_++;\n+\t}\n+\n+\tcameraManager_ = new CameraManager();\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 RKISP1PipelineTest::run()\n+{\n+\tauto cameras = cameraManager_->cameras();\n+\tfor (const std::shared_ptr<Camera> &cam : cameras)\n+\t\tcout << \"Found camera '\" << cam->name() << \"'\" << endl;\n+\n+\tif (cameras.size() != sensors_) {\n+\t\tcerr << cameras.size() << \" cameras registered, but \" << sensors_\n+\t\t     << \" were expected\" << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\treturn TestPass;\n+}\n+\n+void RKISP1PipelineTest::cleanup()\n+{\n+\tcameraManager_->stop();\n+\tdelete cameraManager_;\n+}\n+\n+TEST_REGISTER(RKISP1PipelineTest)\n","prefixes":["libcamera-devel","v3","1/1"]}