Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Turko <andrzej.turko@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 2/2] tests/i915/gem_softpin: Adjust the addresses of reverved blocks
Date: Thu, 22 Jul 2021 10:24:26 +0200	[thread overview]
Message-ID: <20210722082426.4538-3-andrzej.turko@linux.intel.com> (raw)
In-Reply-To: <20210722082426.4538-1-andrzej.turko@linux.intel.com>

Make sure that the reservations fit in the address space.

Signed-off-by: Andrzej Turko <andrzej.turko@linux.intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
---
 tests/i915/gem_softpin.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/i915/gem_softpin.c b/tests/i915/gem_softpin.c
index bdb04821d..5e47a0ce3 100644
--- a/tests/i915/gem_softpin.c
+++ b/tests/i915/gem_softpin.c
@@ -703,7 +703,7 @@ static void __reserve(uint64_t ahnd, int i915, bool pinned,
 		      struct drm_i915_gem_exec_object2 *objects,
 		      int num_obj, uint64_t size)
 {
-	uint64_t gtt = gem_aperture_size(i915);
+	uint64_t start, end;
 	unsigned int flags;
 	int i;
 
@@ -714,13 +714,14 @@ static void __reserve(uint64_t ahnd, int i915, bool pinned,
 		flags |= EXEC_OBJECT_PINNED;
 
 	memset(objects, 0, sizeof(objects) * num_obj);
+	intel_allocator_get_address_range(ahnd, &start, &end);
 
 	for (i = 0; i < num_obj; i++) {
 		objects[i].handle = gem_create(i915, size);
 		if (i < num_obj/2)
-			objects[i].offset = i * size;
+			objects[i].offset = start + i * size;
 		else
-			objects[i].offset = gtt - (i + 1 - num_obj/2) * size;
+			objects[i].offset = end - (i + 1 - num_obj/2) * size;
 		objects[i].flags = flags;
 
 		intel_allocator_reserve(ahnd, objects[i].handle,
-- 
2.25.1

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

  parent reply	other threads:[~2021-07-22  8:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  8:24 [igt-dev] [PATCH i-g-t 0/2] Check the addresses of blocks being reserved Andrzej Turko
2021-07-22  8:24 ` [igt-dev] [PATCH i-g-t 1/2] lib/intel_allocator_simple: Check boundaries of reserved blocks Andrzej Turko
2021-07-28 16:54   ` Zbigniew Kempczyński
2021-07-22  8:24 ` Andrzej Turko [this message]
2021-07-28 17:14   ` [igt-dev] [PATCH i-g-t 2/2] tests/i915/gem_softpin: Adjust the addresses of reverved blocks Zbigniew Kempczyński
2021-07-22  9:19 ` [igt-dev] ✓ Fi.CI.BAT: success for Check the addresses of blocks being reserved Patchwork
2021-07-22 11:29 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20210722082426.4538-3-andrzej.turko@linux.intel.com \
    --to=andrzej.turko@linux.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