public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org
Subject: [igt-dev] [RESUBMIT PATCH 1/2] tests/gem_userptr_blits: Refresh readonly-mmap-unsync exercise
Date: Mon, 16 Mar 2020 09:45:42 +0100	[thread overview]
Message-ID: <20200316084543.15421-2-janusz.krzysztofik@linux.intel.com> (raw)
In-Reply-To: <20200316084543.15421-1-janusz.krzysztofik@linux.intel.com>

Upgrade the subtest to use MMAP_GTT API v4 (aka MMAP_OFFSET),
dynamically examine each mapping type supported by i915 driver.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
---
 tests/i915/gem_userptr_blits.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/tests/i915/gem_userptr_blits.c b/tests/i915/gem_userptr_blits.c
index beced298a..975cd9dab 100644
--- a/tests/i915/gem_userptr_blits.c
+++ b/tests/i915/gem_userptr_blits.c
@@ -1277,7 +1277,7 @@ static void sigjmp_handler(int sig)
 	siglongjmp(sigjmp, sig);
 }
 
-static void test_readonly_mmap(int i915)
+static void test_readonly_mmap(int i915, const struct mmap_offset *t)
 {
 	char *original, *result;
 	uint32_t handle;
@@ -1294,6 +1294,14 @@ static void test_readonly_mmap(int i915)
 	 * on the GPU as well.
 	 */
 
+	handle = gem_create(i915, PAGE_SIZE);
+	ptr = __gem_mmap_offset(i915, handle, 0, PAGE_SIZE,
+				PROT_READ | PROT_WRITE, t->type);
+	gem_close(i915, handle);
+	igt_require_f(ptr, "HW & kernel support for mmap-offset(%s)\n",
+		      t->name);
+	munmap(ptr, PAGE_SIZE);
+
 	igt_require(igt_setup_clflush());
 
 	sz = 16 << 12;
@@ -1307,11 +1315,11 @@ static void test_readonly_mmap(int i915)
 	igt_clflush_range(pages, sz);
 	original = g_compute_checksum_for_data(G_CHECKSUM_SHA1, pages, sz);
 
-	ptr = __gem_mmap__gtt(i915, handle, sz, PROT_WRITE);
+	ptr = __gem_mmap_offset(i915, handle, 0, sz, PROT_WRITE, t->type);
 	igt_assert(ptr == NULL);
 
 	/* Optional kernel support for GTT mmaps of userptr */
-	ptr = __gem_mmap__gtt(i915, handle, sz, PROT_READ);
+	ptr = __gem_mmap_offset(i915, handle, 0, sz, PROT_READ, t->type);
 	gem_close(i915, handle);
 
 	if (ptr) { /* Check that a write into the GTT readonly map fails */
@@ -2110,8 +2118,11 @@ igt_main_args("c:", NULL, help_str, opt_handler, NULL)
 		igt_subtest("readonly-unsync")
 			test_readonly(fd);
 
-		igt_subtest("readonly-mmap-unsync")
-			test_readonly_mmap(fd);
+		igt_describe("Examine mmap-offset mapping to read-only userptr");
+		igt_subtest_with_dynamic("readonly-mmap-unsync")
+			for_each_mmap_offset_type(fd, t)
+				igt_dynamic(t->name)
+					test_readonly_mmap(fd, t);
 
 		igt_subtest("readonly-pwrite-unsync")
 			test_readonly_pwrite(fd);
-- 
2.21.1

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

  reply	other threads:[~2020-03-16  8:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-16  8:45 [Intel-gfx] [RESUBMIT PATCH 0/2] tests/gem_userptr_blits: Refresh other now MMAP_GTT dependent subtests Janusz Krzysztofik
2020-03-16  8:45 ` Janusz Krzysztofik [this message]
2020-03-16  8:45 ` [igt-dev] [RESUBMIT PATCH 2/2] " Janusz Krzysztofik
2020-03-16 13:31 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/gem_userptr_blits: Refresh other now MMAP_GTT dependent subtests (rev2) Patchwork
2020-03-16 19:25 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-03-17  8:53   ` Janusz Krzysztofik
2020-03-17 10:40     ` [igt-dev] [Intel-gfx] " Petri Latvala
2020-03-17 13:59       ` Vudum, Lakshminarayana
2020-03-17 16:32         ` Janusz Krzysztofik
2020-03-17 10:50 ` [igt-dev] " Patchwork
2020-03-17 11:33 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2020-03-17 13:01 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-03-17 13:54 ` [igt-dev] ✓ Fi.CI.IGT: success " Patchwork
2020-03-17 17:18 ` 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=20200316084543.15421-2-janusz.krzysztofik@linux.intel.com \
    --to=janusz.krzysztofik@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@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