From patchwork Wed Nov 14 22:28:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Anholt X-Patchwork-Id: 10683211 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9E87613B5 for ; Wed, 14 Nov 2018 22:28:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 901EB29D13 for ; Wed, 14 Nov 2018 22:28:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81E5229D2A; Wed, 14 Nov 2018 22:28:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B45FB29D13 for ; Wed, 14 Nov 2018 22:28:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED2646E5C3; Wed, 14 Nov 2018 22:28:49 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id 78A976E5C3 for ; Wed, 14 Nov 2018 22:28:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 2489A10A1311; Wed, 14 Nov 2018 14:28:48 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id dTGHjUfX8WIN; Wed, 14 Nov 2018 14:28:42 -0800 (PST) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 1934310A135E; Wed, 14 Nov 2018 14:28:34 -0800 (PST) Received: by eliezer.anholt.net (Postfix, from userid 1000) id C43362FE3705; Wed, 14 Nov 2018 14:28:32 -0800 (PST) From: Eric Anholt To: intel-gfx@lists.freedesktop.org Date: Wed, 14 Nov 2018 14:28:32 -0800 Message-Id: <20181114222832.22839-4-eric@anholt.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181114222832.22839-1-eric@anholt.net> References: <20181114222832.22839-1-eric@anholt.net> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 4/4] igt/v3d_*: Add new tests for the V3D UABI. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP These are basic non-rendering tests of the UABI. Signed-off-by: Eric Anholt Acked-by: Petri Latvala --- lib/igt_v3d.c | 4 -- tests/Makefile.am | 2 + tests/Makefile.sources | 6 +++ tests/meson.build | 3 ++ tests/v3d_ci/README | 26 +++++++++++++ tests/v3d_ci/v3d.testlist | 6 +++ tests/v3d_get_bo_offset.c | 78 ++++++++++++++++++++++++++++++++++++++ tests/v3d_get_param.c | 80 +++++++++++++++++++++++++++++++++++++++ tests/v3d_mmap.c | 55 +++++++++++++++++++++++++++ 9 files changed, 256 insertions(+), 4 deletions(-) create mode 100644 tests/v3d_ci/README create mode 100644 tests/v3d_ci/v3d.testlist create mode 100644 tests/v3d_get_bo_offset.c create mode 100644 tests/v3d_get_param.c create mode 100644 tests/v3d_mmap.c diff --git a/lib/igt_v3d.c b/lib/igt_v3d.c index 1a5ede1bd5fc..619c072c0e47 100644 --- a/lib/igt_v3d.c +++ b/lib/igt_v3d.c @@ -40,10 +40,6 @@ #include "intel_chipset.h" #include "v3d_drm.h" -#if NEW_CONTEXT_PARAM_NO_ERROR_CAPTURE_API -#define LOCAL_CONTEXT_PARAM_NO_ERROR_CAPTURE 0x4 -#endif - /** * SECTION:igt_v3d * @short_description: V3D support library diff --git a/tests/Makefile.am b/tests/Makefile.am index 3d1ce0bc1af8..a6b2ba51ea4f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -14,6 +14,8 @@ if BUILD_VC4 TESTS_progs += $(VC4_TESTS) endif +TESTS_progs += $(V3D_TESTS) + if HAVE_CHAMELIUM TESTS_progs += \ kms_chamelium \ diff --git a/tests/Makefile.sources b/tests/Makefile.sources index d007ebc74ab9..3ed60e7c30c7 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -15,6 +15,12 @@ VC4_TESTS = \ vc4_wait_seqno \ $(NULL) +V3D_TESTS = \ + v3d_get_bo_offset \ + v3d_get_param \ + v3d_mmap \ + $(NULL) + AMDGPU_TESTS = \ amdgpu/amd_basic \ amdgpu/amd_cs_nop \ diff --git a/tests/meson.build b/tests/meson.build index 3020f7984d7a..4472536aef65 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -85,6 +85,9 @@ test_progs = [ 'syncobj_wait', 'template', 'tools_test', + 'v3d_get_bo_offset', + 'v3d_get_param', + 'v3d_mmap', 'vc4_create_bo', 'vc4_dmabuf_poll', 'vc4_label_bo', diff --git a/tests/v3d_ci/README b/tests/v3d_ci/README new file mode 100644 index 000000000000..e03c552fb972 --- /dev/null +++ b/tests/v3d_ci/README @@ -0,0 +1,26 @@ +This directory contains test lists to be used for v3d's DRM support. The files +are passed to piglit with the --test-list parameter directly. + +The test lists are contained in the IGT repository for several +reasons: + +- The lists stay synchronized with the IGT codebase. +- Public availability. Kernel developers can see what tests are run, + and can see what changes are done to the set, when, and why. +- Explicit test lists in general make it possible to implement a new + test without having it run by everyone else before the tests and / or setup + are ready for it. + +Changing the test lists should only happen with approval from the v3d +maintainer, Eric Anholt (eric@anholt.net). + +============ +v3d.testlist +============ + +This test list is meant as a general test suite without any time +restriction for the v3d DRM driver, combining generic DRM and KMS +tests. As a reminder, you can run this with the meson build using: + +./build/runner/igt_runner --test-list tests/v3d_ci/v3d.testlist \ + build/tests -o results diff --git a/tests/v3d_ci/v3d.testlist b/tests/v3d_ci/v3d.testlist new file mode 100644 index 000000000000..b55e8e571d7d --- /dev/null +++ b/tests/v3d_ci/v3d.testlist @@ -0,0 +1,6 @@ +igt@v3d_get_bo_offset@create-get-offsets +igt@v3d_get_bo_offset@get-bad-handle +igt@v3d_get_param@base-params +igt@v3d_get_param@get-bad-param +igt@v3d_get_param@get-bad-flags +igt@v3d_mmap@mmap-bad-handle diff --git a/tests/v3d_get_bo_offset.c b/tests/v3d_get_bo_offset.c new file mode 100644 index 000000000000..0923dc85f0d0 --- /dev/null +++ b/tests/v3d_get_bo_offset.c @@ -0,0 +1,78 @@ +/* + * Copyright © 2017 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "igt.h" +#include "igt_v3d.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "v3d_drm.h" +#include "igt_v3d.h" + +igt_main +{ + int fd; + + igt_fixture + fd = drm_open_driver(DRIVER_V3D); + + igt_subtest("create-get-offsets") { + struct v3d_bo *bos[2] = { + igt_v3d_create_bo(fd, 4096), + igt_v3d_create_bo(fd, 4096), + }; + uint32_t offsets[2] = { + igt_v3d_get_bo_offset(fd, bos[0]->handle), + igt_v3d_get_bo_offset(fd, bos[1]->handle), + }; + + igt_assert_neq(bos[0]->handle, bos[1]->handle); + igt_assert_neq(bos[0]->offset, bos[1]->offset); + igt_assert_eq(bos[0]->offset, offsets[0]); + igt_assert_eq(bos[1]->offset, offsets[1]); + + /* 0 is an invalid offset for BOs to be placed at. */ + igt_assert_neq(bos[0]->offset, 0); + igt_assert_neq(bos[1]->offset, 0); + + igt_v3d_free_bo(fd, bos[0]); + igt_v3d_free_bo(fd, bos[1]); + } + + igt_subtest("get-bad-handle") { + struct drm_v3d_get_bo_offset get = { + .handle = 0xd0d0d0d0, + }; + do_ioctl_err(fd, DRM_IOCTL_V3D_GET_BO_OFFSET, &get, ENOENT); + } + + igt_fixture + close(fd); +} diff --git a/tests/v3d_get_param.c b/tests/v3d_get_param.c new file mode 100644 index 000000000000..76563406c0a1 --- /dev/null +++ b/tests/v3d_get_param.c @@ -0,0 +1,80 @@ +/* + * Copyright © 2017 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "igt.h" +#include "igt_v3d.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "v3d_drm.h" +#include "igt_v3d.h" + +igt_main +{ + int fd; + + igt_fixture + fd = drm_open_driver(DRIVER_V3D); + + igt_subtest("base-params") { + enum drm_v3d_param last_base_param = + DRM_V3D_PARAM_V3D_CORE0_IDENT2; + + uint32_t results[last_base_param]; + + for (int i = 0; i < ARRAY_SIZE(results); i++) + results[i] = igt_v3d_get_param(fd, i); + + /* HUB TVER field */ + igt_assert_lte(3, results[DRM_V3D_PARAM_V3D_HUB_IDENT1] & 0xf); + + /* CORE's ident, has VER field but also an ID. */ + igt_assert_eq(results[DRM_V3D_PARAM_V3D_CORE0_IDENT0] & 0xffffff, + 0x443356 /* "V3D" */); + } + + igt_subtest("get-bad-param") { + struct drm_v3d_get_param get = { + .param = 0xd0d0d0d0, + }; + do_ioctl_err(fd, DRM_IOCTL_V3D_GET_PARAM, &get, EINVAL); + } + + igt_subtest("get-bad-flags") { + struct drm_v3d_get_param get = { + .param = DRM_V3D_PARAM_V3D_HUB_IDENT1, + .pad = 1, + }; + do_ioctl_err(fd, DRM_IOCTL_V3D_GET_PARAM, &get, EINVAL); + } + + igt_fixture + close(fd); +} diff --git a/tests/v3d_mmap.c b/tests/v3d_mmap.c new file mode 100644 index 000000000000..a6fe7e5a7322 --- /dev/null +++ b/tests/v3d_mmap.c @@ -0,0 +1,55 @@ +/* + * Copyright © 2017 Broadcom + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ + +#include "igt.h" +#include "igt_v3d.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "v3d_drm.h" +#include "igt_v3d.h" + +igt_main +{ + int fd; + + igt_fixture + fd = drm_open_driver(DRIVER_V3D); + + igt_subtest("mmap-bad-handle") { + struct drm_v3d_mmap_bo get = { + .handle = 0xd0d0d0d0, + }; + do_ioctl_err(fd, DRM_IOCTL_V3D_MMAP_BO, &get, ENOENT); + } + + igt_fixture + close(fd); +}