All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Peres <martin.peres@mupuf.org>
To: Development mailing list for IGT GPU Tools
	<igt-dev@lists.freedesktop.org>
Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Subject: [igt-dev] [PATCH i-g-t v3 1/2] amdgpu/basic: move amdgpu_query_info_test to its own file
Date: Tue, 16 Feb 2021 22:25:56 +0200	[thread overview]
Message-ID: <20210216202557.878778-1-martin.peres@mupuf.org> (raw)

This will soon be followed by more amd_query_info tests, and the basic
file is already big-enough.

v2:
 - add test and subtest descriptions (Arek)
 - add the new file to autotools (Petri)

Cc: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Martin Peres <martin.peres@mupuf.org>
---
 tests/Makefile.sources   |  1 +
 tests/amdgpu/amd_basic.c | 17 ---------
 tests/amdgpu/amd_info.c  | 74 ++++++++++++++++++++++++++++++++++++++++
 tests/amdgpu/meson.build |  1 +
 4 files changed, 76 insertions(+), 17 deletions(-)
 create mode 100644 tests/amdgpu/amd_info.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 3f663fe7..4f24fb3a 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -9,6 +9,7 @@ AMDGPU_TESTS = \
 	amdgpu/amd_bypass \
 	amdgpu/amd_color \
 	amdgpu/amd_cs_nop \
+	amdgpu/amd_info \
 	amdgpu/amd_prime \
 	amdgpu/amd_abm \
 	$(NULL)
diff --git a/tests/amdgpu/amd_basic.c b/tests/amdgpu/amd_basic.c
index bf626ece..6c9609b9 100644
--- a/tests/amdgpu/amd_basic.c
+++ b/tests/amdgpu/amd_basic.c
@@ -176,20 +176,6 @@ static void amdgpu_command_submission_copy_linear_helper(unsigned ip_type);
 #              define PACKET3_DMA_DATA_CMD_DAIC    (1 << 29)
 #              define PACKET3_DMA_DATA_CMD_RAW_WAIT  (1 << 30)
 
-static void amdgpu_query_info_test(void)
-{
-	struct amdgpu_gpu_info gpu_info = {};
-	uint32_t version, feature;
-	int r;
-
-	r = amdgpu_query_gpu_info(device, &gpu_info);
-	igt_assert_eq(r, 0);
-
-	r = amdgpu_query_firmware_version(device, AMDGPU_INFO_FW_VCE, 0,
-					  0, &version, &feature);
-	igt_assert_eq(r, 0);
-}
-
 static amdgpu_bo_handle gpu_mem_alloc(amdgpu_device_handle device_handle,
 				      uint64_t size,
 				      uint64_t alignment,
@@ -1397,9 +1383,6 @@ igt_main
 			 major, minor);
 	}
 
-	igt_subtest("query-info")
-		amdgpu_query_info_test();
-
 	igt_subtest("memory-alloc")
 		amdgpu_memory_alloc();
 
diff --git a/tests/amdgpu/amd_info.c b/tests/amdgpu/amd_info.c
new file mode 100644
index 00000000..6764e640
--- /dev/null
+++ b/tests/amdgpu/amd_info.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2014 Advanced Micro Devices, Inc.
+ * Copyright 2021 Valve Corporation
+ *
+ * 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 "config.h"
+
+#include "igt.h"
+
+#include <amdgpu.h>
+#include <amdgpu_drm.h>
+
+static amdgpu_device_handle dev;
+
+static void query_firmware_version_test(void)
+{
+	struct amdgpu_gpu_info gpu_info = {};
+	uint32_t version, feature;
+	int r;
+
+	r = amdgpu_query_gpu_info(dev, &gpu_info);
+	igt_assert_eq(r, 0);
+
+	r = amdgpu_query_firmware_version(dev, AMDGPU_INFO_FW_VCE, 0, 0,
+					  &version, &feature);
+	igt_assert_eq(r, 0);
+}
+
+IGT_TEST_DESCRIPTION("Test the consistency of the data provided through the "
+		     "DRM_AMDGPU_INFO IOCTL");
+igt_main
+{
+	int fd = -1;
+
+	igt_fixture {
+		uint32_t major, minor;
+		int err;
+
+		fd = drm_open_driver(DRIVER_AMDGPU);
+
+		err = amdgpu_device_initialize(fd, &major, &minor, &dev);
+		igt_require(err == 0);
+
+		igt_info("Initialized amdgpu, driver version %d.%d\n",
+			 major, minor);
+	}
+
+	igt_describe("Make sure we can retrieve the firmware version");
+	igt_subtest("query-firmware-version")
+		query_firmware_version_test();
+
+	igt_fixture {
+		amdgpu_device_deinitialize(dev);
+		close(fd);
+	}
+}
diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
index b7982291..b92aa22b 100644
--- a/tests/amdgpu/meson.build
+++ b/tests/amdgpu/meson.build
@@ -7,6 +7,7 @@ if libdrm_amdgpu.found()
 			  'amd_bypass',
 			  'amd_color',
 			  'amd_cs_nop',
+			  'amd_info',
 			  'amd_prime',
 			]
 	amdgpu_deps += libdrm_amdgpu
-- 
2.30.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2021-02-16 20:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 20:25 Martin Peres [this message]
2021-02-16 20:25 ` [igt-dev] [PATCH i-g-t v3 2/2] amdgpu/info: add timestamp-related tests Martin Peres
2021-02-17  7:24   ` Petri Latvala
2021-02-17 11:41     ` Martin Peres
2021-02-16 21:17 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,v3,1/2] amdgpu/basic: move amdgpu_query_info_test to its own file Patchwork
2021-02-16 22:21 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2021-02-17  7:37 ` [igt-dev] [PATCH i-g-t v3 1/2] " Petri Latvala
2021-02-17 11:43   ` Martin Peres

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210216202557.878778-1-martin.peres@mupuf.org \
    --to=martin.peres@mupuf.org \
    --cc=bas@basnieuwenhuizen.nl \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.