{"id":2210,"url":"https://patchwork.libcamera.org/api/1.1/patches/2210/?format=json","web_url":"https://patchwork.libcamera.org/patch/2210/","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":"<20191023095254.1479-2-show.liu@linaro.org>","date":"2019-10-23T09:52:54","name":"[libcamera-devel,1/1] rkisp1: add pipeline test for rkisp1","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"5b75bc2f02ab97403f069e10177280f98224a3fc","submitter":{"id":24,"url":"https://patchwork.libcamera.org/api/1.1/people/24/?format=json","name":"Show Liu","email":"show.liu@linaro.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2210/mbox/","series":[{"id":542,"url":"https://patchwork.libcamera.org/api/1.1/series/542/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=542","date":"2019-10-23T09:52:53","name":"rkisp1 pipeline test tool","version":1,"mbox":"https://patchwork.libcamera.org/series/542/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2210/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2210/checks/","tags":{},"headers":{"Return-Path":"<show.liu@linaro.org>","Received":["from mail-pf1-x443.google.com (mail-pf1-x443.google.com\n\t[IPv6:2607:f8b0:4864:20::443])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B286060C0F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Oct 2019 11:53:12 +0200 (CEST)","by mail-pf1-x443.google.com with SMTP id y5so12592455pfo.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Oct 2019 02:53:12 -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\tm5sm23154759pgt.15.2019.10.23.02.53.09\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 23 Oct 2019 02:53:10 -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=1yKgIzaSQIdDWzOzWDLimlSo+2ECeuRbrUWxdl9upqA=;\n\tb=xQKfOlZ8E/nNukjC0mVgPcP/4p48WtJikVF+GClPvtoxT6uIIB3iP55o/tkLapwxeh\n\tOp1ipAnz+rdbRgk8DW0mJfnfmwTADTpi+mmFK2+roe3l9VD5vmj/C4XuBVsoESDMfy4n\n\tVjXQ32exjBLm3T13Kk9KwgQUcxYErVeCAKjRxI3RTFxr9YzECr1nDrDGnC/r68BFbm/q\n\txW+shsQwy9RKwhwtD9pOBTizxJfnfAbXGu8K8sXiitAQsXj3nCVWWQx0t90v9u0r1QnQ\n\teuAkB49MGDTpRpVWODe+9xOKovEc/BJR/nYNegBFBHp5AvTPCJy9zmEwncSaSDtiBhF7\n\tEpzQ==","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=1yKgIzaSQIdDWzOzWDLimlSo+2ECeuRbrUWxdl9upqA=;\n\tb=bHRBhS0DqYGUoElMeRwZ45Nq9xJkRr93m6z8AWaQ4f9jGOtC/j2wVh2tnVPkQGND9D\n\tq8johip8n0fovotSda9eyoc2OjEqBYKmKOnPoDZ0TxVlH9GxV90ZhtjQw+0/mzXWcl/o\n\tH4+hKHweWQqInjzxQk3u8BtqkAEg+taOJyUvNI6fe5pcou2kGImGyjiLMvRVX+n8m3Ga\n\t+5wFDOVtkDZQqIXG3J9+iJO3zJz6WQACA2wqeXTzNIodQKeqm7tzZoYexl4QoKC5XvfY\n\tQrXMoiNhAGIiaXSRGI0kHqKhDYA9U2PQYMX2KGSmQPT8BUocg/TN5ft1vdWrLU2gEkXa\n\tUVHA==","X-Gm-Message-State":"APjAAAVhWcOpTUDWPGy2y2NfkrhmlCS7v3LHu4+tCxdyLINpmIt5HbC8\n\tk1zaoXNmm4QucljdNcZY9XcEWagasus=","X-Google-Smtp-Source":"APXvYqyM6DIlyEGGbkmkadgCFWaDKudSzccsyxyXrQ0GqU+ZB1tjWqUFhsQ3tjTj3NsoCSENefiHAg==","X-Received":"by 2002:a63:368c:: with SMTP id\n\td134mr5818461pga.321.1571824391077; \n\tWed, 23 Oct 2019 02:53:11 -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":"Wed, 23 Oct 2019 17:52:54 +0800","Message-Id":"<20191023095254.1479-2-show.liu@linaro.org>","X-Mailer":"git-send-email 2.17.1","In-Reply-To":"<20191023095254.1479-1-show.liu@linaro.org>","References":"<20191023095254.1479-1-show.liu@linaro.org>","Subject":"[libcamera-devel] [PATCH 1/1] rkisp1: add pipeline test for rkisp1","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, 23 Oct 2019 09:53:12 -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 | 109 ++++++++++++++++++\n 3 files changed, 122 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..a463309\n--- /dev/null\n+++ b/test/pipeline/rkisp1/rkisp1_pipeline_test.cpp\n@@ -0,0 +1,109 @@\n+/* SPDX-License-Identifier: GPL-2.0-or-later */\n+/*\n+ * rkisp1_pipeline_test.cpp - Rockchip RK3399 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> dm_rkisp1 =  enumerator->search(dm);\n+\tif (!dm_rkisp1) {\n+\t\tcerr << \"Failed to find rkisp1: test skip\" << endl;\n+\t\treturn TestSkip;\n+\t}\n+\n+\tint ret = dm_rkisp1->populate();\n+\tif (ret) {\n+\t\tcerr << \"Failed to populate media device \" << dm_rkisp1->deviceNode() << endl;\n+\t\treturn TestFail;\n+\t}\n+\n+\tsensors_ = 0;\n+\tconst vector<MediaEntity *> &entities = dm_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","1/1"]}