All of 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,
	Matthew Auld <matthew.auld@intel.com>,
	Chris Wilson <chris@chris-wilson.co.uk>
Subject: [Intel-gfx] [PATCH i-g-t] i915/gem_softpin: Test total occupancy
Date: Thu, 24 Dec 2020 11:01:58 +0000	[thread overview]
Message-ID: <20201224110158.3560769-1-chris@chris-wilson.co.uk> (raw)

Use pad-to-size to fill the entire GTT. Make sure we own it all!

Suggested-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld@intel.com>
---
 tests/i915/gem_softpin.c | 49 ++++++++++++++++++++++++++++++++++++----
 1 file changed, 45 insertions(+), 4 deletions(-)

diff --git a/tests/i915/gem_softpin.c b/tests/i915/gem_softpin.c
index f761a6839..4a1622e75 100644
--- a/tests/i915/gem_softpin.c
+++ b/tests/i915/gem_softpin.c
@@ -32,6 +32,8 @@
 #define EXEC_OBJECT_PINNED	(1<<4)
 #define EXEC_OBJECT_SUPPORTS_48B_ADDRESS (1<<3)
 
+#define LIMIT_32b ((1ull << 32) - (1ull << 12))
+
 /* gen8_canonical_addr
  * Used to convert any address into canonical form, i.e. [63:48] == [47].
  * Based on kernel's sign_extend64 implementation.
@@ -132,27 +134,27 @@ static void test_zero(int i915)
 
 	object.offset = 0;
 	igt_assert_f(__gem_execbuf(i915, &execbuf) == 0,
-		     "execbuff failed with object.offset=%llx\n",
+		     "execbuf failed with object.offset=%llx\n",
 		     object.offset);
 
 	if (gtt >> 32) {
 		object.offset = (1ull << 32) - sz;
 		igt_assert_f(__gem_execbuf(i915, &execbuf) == 0,
-			     "execbuff failed with object.offset=%llx\n",
+			     "execbuf failed with object.offset=%llx\n",
 			     object.offset);
 	}
 
 	if ((gtt - sz) >> 32) {
 		object.offset = 1ull << 32;
 		igt_assert_f(__gem_execbuf(i915, &execbuf) == 0,
-			     "execbuff failed with object.offset=%llx\n",
+			     "execbuf failed with object.offset=%llx\n",
 			     object.offset);
 	}
 
 	object.offset = gtt - sz;
 	object.offset = gen8_canonical_addr(object.offset);
 	igt_assert_f(__gem_execbuf(i915, &execbuf) == 0,
-		     "execbuff failed with object.offset=%llx\n",
+		     "execbuf failed with object.offset=%llx\n",
 		     object.offset);
 
 	gem_close(i915, object.handle);
@@ -191,6 +193,39 @@ static void test_32b_last_page(int i915)
 	gem_close(i915, object.handle);
 }
 
+static void test_full(int i915)
+{
+	uint64_t sz, gtt = gem_aperture_size(i915);
+	struct drm_i915_gem_exec_object2 object = {
+		.handle = batch_create(i915, &sz),
+		.flags = EXEC_OBJECT_PINNED,
+	};
+	struct drm_i915_gem_execbuffer2 execbuf = {
+		.buffers_ptr = to_user_pointer(&object),
+		.buffer_count = 1,
+	};
+
+	/* Under full-ppgtt, we have complete control of the GTT */
+
+	object.pad_to_size = gtt;
+	if (object.pad_to_size > LIMIT_32b)
+		object.pad_to_size = LIMIT_32b;
+	igt_assert_f(__gem_execbuf(i915, &execbuf) == 0,
+		     "[32b] execbuf failed with offset 0 and object.pad_to_size=%llx\n",
+		     object.pad_to_size);
+
+	if (object.pad_to_size < gtt) {
+		object.flags |= EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
+		object.pad_to_size = gtt;
+
+		igt_assert_f(__gem_execbuf(i915, &execbuf) == 0,
+			     "[48b] execbuf failed with offset 0 and object.pad_to_size=%llx\n",
+			     object.pad_to_size);
+	}
+
+	gem_close(i915, object.handle);
+}
+
 static void test_softpin(int fd)
 {
 	const uint32_t size = 1024 * 1024;
@@ -653,6 +688,7 @@ igt_main
 
 	igt_subtest("invalid")
 		test_invalid(fd);
+
 	igt_subtest("zero") {
 		igt_require(gem_uses_full_ppgtt(fd));
 		test_zero(fd);
@@ -661,6 +697,11 @@ igt_main
 		igt_require(gem_uses_full_ppgtt(fd));
 		test_32b_last_page(fd);
 	}
+	igt_subtest("full") {
+		igt_require(gem_uses_full_ppgtt(fd));
+		test_full(fd);
+	}
+
 	igt_subtest("softpin")
 		test_softpin(fd);
 	igt_subtest("overlap")
-- 
2.30.0.rc1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2020-12-24 11:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-24 11:01 Chris Wilson [this message]
2020-12-24 11:15 ` [Intel-gfx] [PATCH i-g-t v2] i915/gem_softpin: Test total occupancy Chris Wilson
2020-12-24 12:11 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/gem_softpin: Test total occupancy (rev2) Patchwork
2020-12-24 12:27 ` [Intel-gfx] [PATCH i-g-t v3] i915/gem_softpin: Test total occupancy Chris Wilson
2020-12-24 12:27   ` [igt-dev] " Chris Wilson
2020-12-24 12:47 ` [Intel-gfx] [PATCH i-g-t v4] " Chris Wilson
2020-12-24 12:47   ` [igt-dev] " Chris Wilson
2020-12-24 14:38   ` [Intel-gfx] " Matthew Auld
2020-12-24 14:38     ` Matthew Auld
2020-12-24 13:07 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/gem_softpin: Test total occupancy (rev3) Patchwork
2020-12-24 13:39 ` [igt-dev] ✗ Fi.CI.BAT: failure for i915/gem_softpin: Test total occupancy (rev4) Patchwork
2020-12-24 14:36 ` [igt-dev] ✓ Fi.CI.BAT: success for i915/gem_softpin: Test total occupancy (rev5) Patchwork
2020-12-24 14:41 ` [igt-dev] ✓ Fi.CI.IGT: success for i915/gem_softpin: Test total occupancy (rev2) Patchwork
2020-12-24 15:53 ` [igt-dev] ✗ Fi.CI.IGT: failure for i915/gem_softpin: Test total occupancy (rev3) Patchwork
2020-12-24 16:52 ` [igt-dev] ✗ Fi.CI.IGT: failure for i915/gem_softpin: Test total occupancy (rev5) 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=20201224110158.3560769-1-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    /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.