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
Cc: "Andrzej Turko" <andrzej.turko@linux.intel.com>,
	"Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
Subject: [igt-dev] [PATCH i-g-t 1/2] tests/i915/gem_exec_big: Add a path without relocations
Date: Wed, 11 Aug 2021 22:28:10 +0200	[thread overview]
Message-ID: <20210811202811.2162-2-andrzej.turko@linux.intel.com> (raw)
In-Reply-To: <20210811202811.2162-1-andrzej.turko@linux.intel.com>

When running on platforms without relocation support,
verification of their correctness should be skipped.
What remains is exercising submission of large batches.

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

diff --git a/tests/i915/gem_exec_big.c b/tests/i915/gem_exec_big.c
index 1f8c720b6..a10b7dc6a 100644
--- a/tests/i915/gem_exec_big.c
+++ b/tests/i915/gem_exec_big.c
@@ -55,6 +55,35 @@ IGT_TEST_DESCRIPTION("Run a large nop batch to stress test the error capture"
 #define FORCE_PREAD_PWRITE 0
 
 static int use_64bit_relocs;
+static bool do_relocs;
+
+static void exec_noreloc(int fd, uint64_t handle, unsigned flags)
+{
+	struct drm_i915_gem_execbuffer2 execbuf;
+	struct drm_i915_gem_exec_object2 gem_exec[1];
+
+	gem_exec[0].handle = handle;
+	gem_exec[0].relocation_count = 0;
+	gem_exec[0].alignment = 0;
+	gem_exec[0].offset = 0;
+	gem_exec[0].flags = EXEC_OBJECT_SUPPORTS_48B_ADDRESS;
+	gem_exec[0].rsvd1 = 0;
+	gem_exec[0].rsvd2 = 0;
+
+	execbuf.buffers_ptr = to_user_pointer(gem_exec);
+	execbuf.buffer_count = 1;
+	execbuf.batch_start_offset = 0;
+	execbuf.batch_len = 8;
+	execbuf.cliprects_ptr = 0;
+	execbuf.num_cliprects = 0;
+	execbuf.DR1 = 0;
+	execbuf.DR4 = 0;
+	execbuf.flags = flags;
+	i915_execbuffer2_set_context_id(execbuf, 0);
+	execbuf.rsvd2 = 0;
+
+	gem_execbuf(fd, &execbuf);
+}
 
 static void exec1(int fd, uint32_t handle, uint64_t reloc_ofs, unsigned flags, char *ptr)
 {
@@ -62,6 +91,11 @@ static void exec1(int fd, uint32_t handle, uint64_t reloc_ofs, unsigned flags, c
 	struct drm_i915_gem_exec_object2 gem_exec[1];
 	struct drm_i915_gem_relocation_entry gem_reloc[1];
 
+	if (!do_relocs) {
+		exec_noreloc(fd, handle, flags);
+		return;
+	}
+
 	gem_reloc[0].offset = reloc_ofs;
 	gem_reloc[0].delta = 0;
 	gem_reloc[0].target_handle = handle;
@@ -137,6 +171,11 @@ static void execN(int fd, uint32_t handle, uint64_t batch_size, unsigned flags,
 	struct drm_i915_gem_relocation_entry *gem_reloc;
 	uint64_t n, nreloc = batch_size >> 12;
 
+	if (!do_relocs) {
+		exec_noreloc(fd, handle, flags);
+		return;
+	}
+
 	gem_reloc = calloc(nreloc, sizeof(*gem_reloc));
 	igt_assert(gem_reloc);
 
@@ -305,6 +344,7 @@ igt_main
 		igt_require_gem(i915);
 
 		use_64bit_relocs = intel_gen(intel_get_drm_devid(i915)) >= 8;
+		do_relocs = gem_has_relocations(i915);
 	}
 
 	igt_subtest("single")
-- 
2.25.1

  reply	other threads:[~2021-08-11 20:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-11 20:28 [igt-dev] [PATCH i-g-t 0/2] gem_exec_big -- noreloc support Andrzej Turko
2021-08-11 20:28 ` Andrzej Turko [this message]
2021-08-12  3:37   ` [igt-dev] [PATCH i-g-t 1/2] tests/i915/gem_exec_big: Add a path without relocations Zbigniew Kempczyński
2021-08-11 20:28 ` [igt-dev] [PATCH i-g-t 2/2] HAX: Run gem_exec_big Andrzej Turko
2021-08-11 22:51 ` [igt-dev] ✗ Fi.CI.BAT: failure for gem_exec_big -- noreloc support 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=20210811202811.2162-2-andrzej.turko@linux.intel.com \
    --to=andrzej.turko@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=zbigniew.kempczynski@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox