summaryrefslogtreecommitdiff
path: root/tests/gem_exec_fence.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-06-09 14:45:53 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2017-06-09 14:56:26 +0100
commit22e162f1e6e31afe765b25fa94931a002e055273 (patch)
tree4f99b428b54411971aeb66e544407158ffa449a5 /tests/gem_exec_fence.c
parent43baec15f4d2a97fc55ca4aeb70d20ce4b292c9a (diff)
igt/gem_exec_fence: Limit history size for !execlists
Only with execlists, is each context using a separate ring buffer and we can accumulate as many fences as contexts we can allocate. On the hand, systems with just a single ring buffer for all contexts, we can only allocate enough contexts/fences as to fill the ring. If we try to add to many we end up stuck waiting for space. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_exec_fence.c')
-rw-r--r--tests/gem_exec_fence.c51
1 files changed, 48 insertions, 3 deletions
diff --git a/tests/gem_exec_fence.c b/tests/gem_exec_fence.c
index 82b0c89a..5230e693 100644
--- a/tests/gem_exec_fence.c
+++ b/tests/gem_exec_fence.c
@@ -22,6 +22,7 @@
*/
#include "igt.h"
+#include "igt_sysfs.h"
#include "igt_vgem.h"
#include "sw_sync.h"
@@ -387,7 +388,7 @@ static unsigned int measure_ring_size(int fd)
return count;
}
-#define EXPIRED 0x1
+#define EXPIRED 0x10000
static void test_long_history(int fd, long ring_size, unsigned flags)
{
const uint32_t sz = 1 << 20;
@@ -396,9 +397,14 @@ static void test_long_history(int fd, long ring_size, unsigned flags)
struct drm_i915_gem_execbuffer2 execbuf;
unsigned int engines[16], engine;
unsigned int nengine, n, s;
+ unsigned long limit;
int all_fences;
struct cork c;
+ limit = -1;
+ if (!gem_uses_full_ppgtt(fd))
+ limit = ring_size / 3;
+
nengine = 0;
for_each_engine(fd, engine) {
if (engine == 0)
@@ -454,6 +460,8 @@ static void test_long_history(int fd, long ring_size, unsigned flags)
}
gem_context_destroy(fd, execbuf.rsvd1);
+ if (!--limit)
+ break;
}
unplug(&c);
@@ -486,9 +494,44 @@ static void test_fence_flip(int i915)
igt_skip_on_f(1, "no fence-in for atomic flips\n");
}
+#define HAVE_EXECLISTS 0x1
+static unsigned int print_welcome(int fd)
+{
+ unsigned int result = 0;
+ bool active;
+ int dir;
+
+ dir = igt_sysfs_open_parameters(fd);
+ if (dir < 0)
+ return 0;
+
+ active = igt_sysfs_get_boolean(dir, "enable_guc_submission");
+ if (active) {
+ igt_info("Using GuC submission\n");
+ result |= HAVE_EXECLISTS;
+ goto out;
+ }
+
+ active = igt_sysfs_get_boolean(dir, "enable_execlists");
+ if (active) {
+ igt_info("Using Execlists submission\n");
+ result |= HAVE_EXECLISTS;
+ goto out;
+ }
+
+ active = igt_sysfs_get_boolean(dir, "semaphores");
+ igt_info("Using Legacy submission%s\n",
+ active ? ", with semaphores" : "");
+
+out:
+ close(dir);
+ return result;
+}
+
igt_main
{
const struct intel_execution_engine *e;
+ unsigned int caps = 0;
int i915 = -1;
igt_skip_on_simulation();
@@ -498,6 +541,8 @@ igt_main
igt_require_gem(i915);
igt_require(gem_has_exec_fence(i915));
gem_require_mmap_wc(i915);
+
+ caps = print_welcome(i915);
}
for (e = intel_execution_engines; e->name; e++) {
@@ -560,7 +605,7 @@ igt_main
igt_info("Ring size: %ld batches\n", ring_size);
igt_require(ring_size);
- test_long_history(i915, ring_size, 0);
+ test_long_history(i915, ring_size, caps);
}
igt_subtest("expired-history") {
@@ -569,7 +614,7 @@ igt_main
igt_info("Ring size: %ld batches\n", ring_size);
igt_require(ring_size);
- test_long_history(i915, ring_size, EXPIRED);
+ test_long_history(i915, ring_size, caps | EXPIRED);
}
igt_subtest("flip") {