summaryrefslogtreecommitdiff
path: root/tests/i915/gem_create.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-05-03 13:29:26 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-05-03 13:35:27 +0100
commit717bc305a46a1d1f9a9e240d1805d47c9d119f07 (patch)
tree3d12f1569037ceb62d0747454a19224aaf3c0e47 /tests/i915/gem_create.c
parentf27fdfff026276ac75c69e487c929a843f66f6ca (diff)
i915/gem_create: Skip random number of pages in checking always-clear
Try to reduce the time spent checking each object (just in case we get trapped reading a huge object back via UC) and at the same time try to catch higher pages unawares and unflushed. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'tests/i915/gem_create.c')
-rw-r--r--tests/i915/gem_create.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
index 0a0c4d58..aba2f852 100644
--- a/tests/i915/gem_create.c
+++ b/tests/i915/gem_create.c
@@ -168,7 +168,7 @@ struct thread_clear {
static void *thread_clear(void *data)
{
struct thread_clear *arg = data;
- unsigned long checked = 0;
+ unsigned long checked = 0, total = 0;
enum { PRW, GTT, WC, WB, __LAST__ } mode = PRW;
int i915 = arg->i915;
@@ -204,7 +204,7 @@ static void *thread_clear(void *data)
}
/* No set-domains as we are being as naughty as possible */
- for (uint64_t page = 0; page < npages; page++) {
+ for (uint64_t page = 0; page < npages; page += 1 + random() % (npages - page)) {
uint64_t x[8] = {
page * 4096 +
sizeof(x) * ((page % (4096 - sizeof(x)) / sizeof(x)))
@@ -219,18 +219,21 @@ static void *thread_clear(void *data)
for (int i = 0; i < ARRAY_SIZE(x); i++)
igt_assert_eq_u64(x[i], 0);
+
+ checked++;
}
if (ptr)
munmap(ptr, create.size);
gem_close(i915, create.handle);
- checked += npages;
+ total += npages;
atomic_fetch_add(&arg->max, npages);
if (++mode == __LAST__)
mode = PRW;
}
+ igt_info("Checked %'lu / %'lu pages\n", checked, total);
return (void *)(uintptr_t)checked;
}