Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Cc: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] i915/gem_tiled_pread: Skip on unknown swizzling
Date: Mon,  7 Jan 2019 11:28:33 +0000	[thread overview]
Message-ID: <20190107112833.19083-1-chris@chris-wilson.co.uk> (raw)

If we do not know the underlying swizzle on the HW, we do not know the
full tiling pattern and cannot predict the expected results. This is
often because the swizzle varies between pages and is not as constant as
we naively expected.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_tiled_pread_basic.c  | 23 ++++++++++++++++++++++-
 tests/i915/gem_tiled_pread_pwrite.c | 23 ++++++++++++++++++++++-
 2 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/tests/i915/gem_tiled_pread_basic.c b/tests/i915/gem_tiled_pread_basic.c
index 425bb07e7..48b1b37e2 100644
--- a/tests/i915/gem_tiled_pread_basic.c
+++ b/tests/i915/gem_tiled_pread_basic.c
@@ -61,6 +61,27 @@ static int tile_width;
 static int tile_height;
 static int tile_size;
 
+static void
+get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle)
+{
+	struct drm_i915_gem_get_tiling2 {
+		uint32_t handle;
+		uint32_t tiling_mode;
+		uint32_t swizzle_mode;
+		uint32_t phys_swizzle_mode;
+	} arg;
+#define DRM_IOCTL_I915_GEM_GET_TILING2	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling2)
+
+	memset(&arg, 0, sizeof(arg));
+	arg.handle = handle;
+
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_GET_TILING2, &arg);
+	igt_require(arg.phys_swizzle_mode == arg.swizzle_mode);
+
+	*tiling = arg.tiling_mode;
+	*swizzle = arg.swizzle_mode;
+}
+
 static uint32_t
 create_bo(int fd)
 {
@@ -125,7 +146,7 @@ igt_simple_main
 	fd = drm_open_driver(DRIVER_INTEL);
 
 	handle = create_bo(fd);
-	igt_require(gem_get_tiling(fd, handle, &tiling, &swizzle));
+	get_tiling(fd, handle, &tiling, &swizzle);
 
 	devid = intel_get_drm_devid(fd);
 
diff --git a/tests/i915/gem_tiled_pread_pwrite.c b/tests/i915/gem_tiled_pread_pwrite.c
index 313daa388..59afae896 100644
--- a/tests/i915/gem_tiled_pread_pwrite.c
+++ b/tests/i915/gem_tiled_pread_pwrite.c
@@ -69,6 +69,27 @@ static uint32_t current_tiling_mode;
 
 #define PAGE_SIZE 4096
 
+static void
+get_tiling(int fd, uint32_t handle, uint32_t *tiling, uint32_t *swizzle)
+{
+	struct drm_i915_gem_get_tiling2 {
+		uint32_t handle;
+		uint32_t tiling_mode;
+		uint32_t swizzle_mode;
+		uint32_t phys_swizzle_mode;
+	} arg;
+#define DRM_IOCTL_I915_GEM_GET_TILING2	DRM_IOWR (DRM_COMMAND_BASE + DRM_I915_GEM_GET_TILING, struct drm_i915_gem_get_tiling2)
+
+	memset(&arg, 0, sizeof(arg));
+	arg.handle = handle;
+
+	do_ioctl(fd, DRM_IOCTL_I915_GEM_GET_TILING2, &arg);
+	igt_require(arg.phys_swizzle_mode == arg.swizzle_mode);
+
+	*tiling = arg.tiling_mode;
+	*swizzle = arg.swizzle_mode;
+}
+
 static uint32_t
 create_bo_and_fill(int fd)
 {
@@ -122,7 +143,7 @@ igt_simple_main
 		current_tiling_mode = I915_TILING_X;
 
 		handle = create_bo_and_fill(fd);
-		gem_get_tiling(fd, handle, &tiling, &swizzle);
+		get_tiling(fd, handle, &tiling, &swizzle);
 
 		gem_read(fd, handle, 0, linear, sizeof(linear));
 
-- 
2.20.1

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

             reply	other threads:[~2019-01-07 11:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-07 11:28 Chris Wilson [this message]
2019-01-07 12:06 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/gem_tiled_pread: Skip on unknown swizzling Patchwork
2019-01-07 14:49 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-01-11 13:48 ` [igt-dev] [PATCH i-g-t] " Tvrtko Ursulin
2019-01-11 13:54 ` [igt-dev] [PATCH i-g-t v2] " Chris Wilson
2019-01-11 14:00   ` Tvrtko Ursulin
2019-01-11 14:30 ` [igt-dev] ✗ Fi.CI.BAT: failure for i915/gem_tiled_pread: Skip on unknown swizzling (rev2) 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=20190107112833.19083-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --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