{"id":2216,"url":"https://patchwork.libcamera.org/api/patches/2216/?format=json","web_url":"https://patchwork.libcamera.org/patch/2216/","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":"<20191024064008.25077-2-show.liu@linaro.org>","date":"2019-10-24T06:40:08","name":"[libcamera-devel,v2,1/1] rkisp1: add pipeline test for rkisp1","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"fe68acd8b955610a72825f860c40d80efaff92b2","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/2216/mbox/","series":[{"id":544,"url":"https://patchwork.libcamera.org/api/series/544/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=544","date":"2019-10-24T06:40:07","name":"rkisp1 pipeline test tool","version":2,"mbox":"https://patchwork.libcamera.org/series/544/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2216/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2216/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 738C861376\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Oct 2019 08:40:27 +0200 (CEST)","by mail-pf1-x441.google.com with SMTP id c13so3281642pfp.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Oct 2019 23:40:27 -0700 (PDT)","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\tx190sm5571696pfc.89.2019.10.23.23.40.23\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 23 Oct 2019 23:40:24 -0700 (PDT)"],"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=FE69LTTytZSkOA2byUYOeEH1L/XXPhuNHMguBRSbUoc=;\n\tb=S7aLdaCEvPuNgrcbxcoUcX0qoEu2mw+xS6smW1l8C01DvvXw6icTRqfSCzht7AXndT\n\tb4rOW5VcI0BzC62o8Wm4ddV39Pior4daCvkFZP88amFIGPDR0w0wQ3C9z+XHFg2UKRLY\n\t+1eCmOXhspJl1ZIkWEIwvvoyq3vUbGQ7uN4CXDb1xDnAyhQXE3IV4zY+7j+szxd2q+Pz\n\t5YknFrQpqgS3UOXMna45l3H1yoxNYlq6bbB456O83CEgkvizpL0KFdpODrUZBO/3eQ5U\n\t6ozYc6u1wQRdwji5uV07uqtb+wxE9x/oN9XsjbLhJahnZMmB+25td61RvCwPWceI5ypI\n\ttQFA==","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=FE69LTTytZSkOA2byUYOeEH1L/XXPhuNHMguBRSbUoc=;\n\tb=pIiDTSih3WYA/YnmO2vWJE2jT8zrUkDOMIMqvUD6G+wlWWOp8+SiCcNE5l9WP7nM9z\n\tXXQYgkbFt4nE/Pd0xtanIjC2SlekgERPdxQmpY/Si07Q7LLA9pOjbk/xaygD8YLobMlm\n\trRbLuVt45vCxEWgf1LJDoQfGii69VhsWEGSxDDZ2yqWGF/9Z8UU2hxkTex30wtoJUVBR\n\tmnefOMJxLvmb7Ff1EjNpiI9Ux0eZUwRI/pMO5lLnBeH5SHsU9J1DDDor8A8mwNG46eKk\n\t4V9A1ExnCaxZnjmcevbBOZ6zIgVMog9GaAkBDp2y8pH58hlfvBNKaxFtdvNQCbiYedGR\n\tBIYg==","X-Gm-Message-State":"APjAAAWEmRmD1spl9hnpL5BO1i1uz/AY+IqgvVfOno4/6W6C2Xui78rP\n\tJ3fOar1t0YRjoY3BeMwcsL+650OX/FE=","X-Google-Smtp-Source":"APXvYqxR/Jl0aRuwlauZP2CTVheDWnFFQzH+BX/rtrEI5v6bEQpQaGU7WbasfZwzZBJMdSy7l74PxA==","X-Received":"by 2002:a17:90a:a417:: with SMTP id\n\ty23mr4900827pjp.126.1571899225205; \n\tWed, 23 Oct 2019 23:40:25 -0700 (PDT)","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":"Thu, 24 Oct 2019 14:40:08 +0800","Message-Id":"<20191024064008.25077-2-show.liu@linaro.org>","X-Mailer":"git-send-email 2.17.1","In-Reply-To":"<20191024064008.25077-1-show.liu@linaro.org>","References":"<20191024064008.25077-1-show.liu@linaro.org>","Subject":"[libcamera-devel] [PATCH v2 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":"Thu, 24 Oct 2019 06:40:27 -0000"},"content":"This is a simple test tool for rkisp1 pipeline refer from IPU3 pipeline test.\n\nSigned-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 | 112 ++++++++++++++++++\n 3 files changed, 125 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..274955e\n--- /dev/null\n+++ b/test/pipeline/rkisp1/rkisp1_pipeline_test.cpp\n@@ -0,0 +1,112 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * Copyright (C) 2019, Google Inc.\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","v2","1/1"]}