From: Kamil Konieczny <kamil.konieczny@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: "Kamil Konieczny" <kamil.konieczny@linux.intel.com>,
"Dominik Karol Piątkowski" <dominik.karol.piatkowski@intel.com>
Subject: [PATCH i-g-t v6 8/8] tests/intel/gem_mmap: add basic multi-GPU subtest
Date: Thu, 1 Feb 2024 16:50:47 +0100 [thread overview]
Message-ID: <20240201155047.48608-9-kamil.konieczny@linux.intel.com> (raw)
In-Reply-To: <20240201155047.48608-1-kamil.konieczny@linux.intel.com>
Test basic mmap for two or more GPU cards.
v2: renamed subtest to multigpu-basic (Kamil)
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Reviewed-by: Dominik Karol Piątkowski <dominik.karol.piatkowski@intel.com>
---
tests/intel/gem_mmap.c | 77 +++++++++++++++++++++++++++---------------
1 file changed, 50 insertions(+), 27 deletions(-)
diff --git a/tests/intel/gem_mmap.c b/tests/intel/gem_mmap.c
index d4ca1eda7..64ec25e87 100644
--- a/tests/intel/gem_mmap.c
+++ b/tests/intel/gem_mmap.c
@@ -38,6 +38,8 @@
#include "drm.h"
#include "i915/gem_create.h"
+#include "intel_multigpu.h"
+
/**
* TEST: gem mmap
* Description: Basic MMAP IOCTL tests for memory regions.
@@ -79,6 +81,11 @@
* object.
* Run type: FULL
*
+ * SUBTEST: multigpu-basic
+ * Description:
+ * Test basics of mmap on two or more GPUs.
+ * Run type: BAT
+ *
* SUBTEST: pf-nonblock
* Description:
* Verify that GTT page faults are asynchronous to GPU rendering and completes within a
@@ -209,12 +216,40 @@ static int mmap_ioctl(int i915, struct drm_i915_gem_mmap *arg)
return err;
}
-igt_main
+static void test_basic(int i915, int pat)
{
+ struct drm_i915_gem_mmap arg = {
+ .handle = gem_create(fd, OBJECT_SIZE),
+ .size = OBJECT_SIZE,
+ };
uint8_t expected[OBJECT_SIZE];
uint8_t buf[OBJECT_SIZE];
uint8_t *addr;
+ igt_assert_eq(mmap_ioctl(fd, &arg), 0);
+ addr = from_user_pointer(arg.addr_ptr);
+
+ igt_info("Testing contents of newly created object.\n");
+ memset(expected, 0, sizeof(expected));
+ igt_assert(memcmp(addr, expected, sizeof(expected)) == 0);
+
+ igt_info("Testing coherency of writes and mmap reads.\n");
+ memset(buf, 0, sizeof(buf));
+ memset(buf + 1024, pat, 1024);
+ memset(expected + 1024, pat, 1024);
+ gem_write(fd, arg.handle, 0, buf, OBJECT_SIZE);
+ igt_assert(memcmp(buf, addr, sizeof(buf)) == 0);
+
+ igt_info("Testing that mapping stays after close\n");
+ gem_close(fd, arg.handle);
+ igt_assert(memcmp(buf, addr, sizeof(buf)) == 0);
+
+ igt_info("Testing unmapping\n");
+ munmap(addr, OBJECT_SIZE);
+}
+
+igt_main
+{
igt_fixture {
fd = drm_open_driver(DRIVER_INTEL);
igt_require(gem_has_legacy_mmap(fd));
@@ -306,36 +341,13 @@ igt_main
igt_describe("Test basics of newly mapped gem object like default content, write and read "
"coherency, mapping existence after gem_close and unmapping.");
- igt_subtest("basic") {
- struct drm_i915_gem_mmap arg = {
- .handle = gem_create(fd, OBJECT_SIZE),
- .size = OBJECT_SIZE,
- };
- igt_assert_eq(mmap_ioctl(fd, &arg), 0);
- addr = from_user_pointer(arg.addr_ptr);
-
- igt_info("Testing contents of newly created object.\n");
- memset(expected, 0, sizeof(expected));
- igt_assert(memcmp(addr, expected, sizeof(expected)) == 0);
-
- igt_info("Testing coherency of writes and mmap reads.\n");
- memset(buf, 0, sizeof(buf));
- memset(buf + 1024, 0x01, 1024);
- memset(expected + 1024, 0x01, 1024);
- gem_write(fd, arg.handle, 0, buf, OBJECT_SIZE);
- igt_assert(memcmp(buf, addr, sizeof(buf)) == 0);
-
- igt_info("Testing that mapping stays after close\n");
- gem_close(fd, arg.handle);
- igt_assert(memcmp(buf, addr, sizeof(buf)) == 0);
-
- igt_info("Testing unmapping\n");
- munmap(addr, OBJECT_SIZE);
- }
+ igt_subtest("basic")
+ test_basic(fd, 1);
igt_describe("Map small buffer object though direct CPU access, bypassing GPU.");
igt_subtest("short-mmap") {
uint32_t handle = gem_create(fd, OBJECT_SIZE);
+ uint8_t *addr;
igt_assert(OBJECT_SIZE > 4096);
@@ -373,4 +385,15 @@ igt_main
igt_fixture
drm_close_driver(fd);
+
+ igt_describe("Test basics of mapped on two or more GPUs.");
+ igt_subtest("multigpu-basic") {
+ igt_multi_fork_foreach_gpu(gpu, DRIVER_INTEL) {
+ int pat = 1 + rand() % 128;
+
+ igt_info("Basic mmap test with pattern x%x\n", pat);
+ test_basic(gpu, pat);
+ }
+ igt_waitchildren();
+ }
}
--
2.42.0
next prev parent reply other threads:[~2024-02-01 15:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 15:50 [PATCH i-g-t v6 0/8] introduce Xe multigpu and other multi-GPU helpers Kamil Konieczny
2024-02-01 15:50 ` [PATCH i-g-t v6 1/8] lib/igt_device_scan: Introduce filtering out non-PCI devices Kamil Konieczny
2024-02-01 15:50 ` [PATCH i-g-t v6 2/8] lib/drmtest: Introduced drm_open_driver_another Kamil Konieczny
2024-02-01 15:50 ` [PATCH i-g-t v6 3/8] lib/drmtest: allow opening cards out of order Kamil Konieczny
2024-02-02 11:38 ` Janusz Krzysztofik
2024-02-02 15:32 ` Kamil Konieczny
2024-02-01 15:50 ` [PATCH i-g-t v6 4/8] lib/intel_multigpu: Introduce library for multi-GPU scenarios Kamil Konieczny
2024-02-01 15:50 ` [PATCH i-g-t v6 5/8] lib/intel_multigpu: Introduced gem_multigpu_count_class and igt_multi_fork_foreach_gpu Kamil Konieczny
2024-02-01 15:50 ` [PATCH i-g-t v6 6/8] lib/intel_multigpu: Add xe_multi_fork_foreach_gpu Kamil Konieczny
2024-02-01 15:50 ` [PATCH i-g-t v6 7/8] tests/intel/xe_exec_basic: add multigpu subtests Kamil Konieczny
2024-02-01 15:50 ` Kamil Konieczny [this message]
2024-02-01 17:03 ` ✓ CI.xeBAT: success for introduce Xe multigpu and other multi-GPU helpers (rev6) Patchwork
2024-02-01 17:21 ` ✓ Fi.CI.BAT: " Patchwork
2024-02-01 19:14 ` ✓ Fi.CI.IGT: " Patchwork
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=20240201155047.48608-9-kamil.konieczny@linux.intel.com \
--to=kamil.konieczny@linux.intel.com \
--cc=dominik.karol.piatkowski@intel.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox