[Intel-gfx] [PATCH] drm/i915/selftests: Trim blitter block size
Chris Wilson
chris at chris-wilson.co.uk
Thu Feb 6 09:20:43 UTC 2020
Reduce the amount of work we do to verify client blt correctness as
currently our 0.5s subtests takes about 15s on slower devices!
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
.../i915/gem/selftests/i915_gem_object_blt.c | 40 ++++++++++++-------
1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
index 62077fe46715..674f4298f9a6 100644
--- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
+++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_object_blt.c
@@ -226,7 +226,9 @@ static int igt_fill_blt_thread(void *arg)
GEM_BUG_ON(IS_ERR(ce));
do {
- const u32 max_block_size = S16_MAX * PAGE_SIZE;
+ /* Aim to keep the runtime under reasonable bounds! */
+ const u32 max_block_size = SZ_64M; /* max S16_MAX * PAGE_SIZE */
+ const u32 max_phys_size = SZ_64K;
u32 val = prandom_u32_state(prng);
u64 total = ce->vm->total;
u32 phys_sz;
@@ -240,9 +242,10 @@ static int igt_fill_blt_thread(void *arg)
*/
if (i915_is_ggtt(ce->vm))
total = div64_u64(total, thread->n_cpus);
+ total = min_t(u64, total, max_block_size);
- sz = min_t(u64, total >> 4, prandom_u32_state(prng));
- phys_sz = sz % (max_block_size + 1);
+ sz = i915_prandom_u32_max_state(total, prng);
+ phys_sz = sz % max_phys_size;
sz = round_up(sz, PAGE_SIZE);
phys_sz = round_up(phys_sz, PAGE_SIZE);
@@ -276,13 +279,16 @@ static int igt_fill_blt_thread(void *arg)
if (err)
goto err_unpin;
- i915_gem_object_lock(obj);
- err = i915_gem_object_set_to_cpu_domain(obj, false);
- i915_gem_object_unlock(obj);
+ err = i915_gem_object_wait(obj, I915_WAIT_ALL, HZ / 2);
if (err)
goto err_unpin;
- for (i = 0; i < huge_gem_object_phys_size(obj) / sizeof(u32); ++i) {
+ for (i = 0; i < huge_gem_object_phys_size(obj) / sizeof(u32); i += 17) {
+ if (!(obj->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ)) {
+ clflush(&vaddr[i]);
+ mb();
+ }
+
if (vaddr[i] != val) {
pr_err("vaddr[%u]=%x, expected=%x\n", i,
vaddr[i], val);
@@ -335,7 +341,9 @@ static int igt_copy_blt_thread(void *arg)
GEM_BUG_ON(IS_ERR(ce));
do {
- const u32 max_block_size = S16_MAX * PAGE_SIZE;
+ /* Aim to keep the runtime under reasonable bounds! */
+ const u32 max_block_size = SZ_64M; /* max S16_MAX * PAGE_SIZE */
+ const u32 max_phys_size = SZ_64K;
u32 val = prandom_u32_state(prng);
u64 total = ce->vm->total;
u32 phys_sz;
@@ -345,9 +353,10 @@ static int igt_copy_blt_thread(void *arg)
if (i915_is_ggtt(ce->vm))
total = div64_u64(total, thread->n_cpus);
+ total = min_t(u64, total, max_block_size);
- sz = min_t(u64, total >> 4, prandom_u32_state(prng));
- phys_sz = sz % (max_block_size + 1);
+ sz = i915_prandom_u32_max_state(total, prng);
+ phys_sz = sz % max_phys_size;
sz = round_up(sz, PAGE_SIZE);
phys_sz = round_up(phys_sz, PAGE_SIZE);
@@ -397,13 +406,16 @@ static int igt_copy_blt_thread(void *arg)
if (err)
goto err_unpin;
- i915_gem_object_lock(dst);
- err = i915_gem_object_set_to_cpu_domain(dst, false);
- i915_gem_object_unlock(dst);
+ err = i915_gem_object_wait(dst, I915_WAIT_ALL, HZ / 2);
if (err)
goto err_unpin;
- for (i = 0; i < huge_gem_object_phys_size(dst) / sizeof(u32); ++i) {
+ for (i = 0; i < huge_gem_object_phys_size(dst) / sizeof(u32); i += 17) {
+ if (!(dst->cache_coherent & I915_BO_CACHE_COHERENT_FOR_READ)) {
+ clflush(&vaddr[i]);
+ mb();
+ }
+
if (vaddr[i] != val) {
pr_err("vaddr[%u]=%x, expected=%x\n", i,
vaddr[i], val);
--
2.25.0
More information about the Intel-gfx
mailing list