tests/gem_ringfill: Add {render,blitter}-forked-1 subtests.

Add forking subtests to gem_ringfill. Tests cause consistent GPU
hangs on SKL.

v2: Removed noop parts.
v3:
- Allow executing the tests in order too (Chris Wilson).
- Rename the tests to -forked-1

Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
[ickle: Extend to cover forked-N]
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89959
This commit is contained in:
Joonas Lahtinen 2015-06-26 14:52:34 +03:00 committed by Chris Wilson
parent 46f277b90b
commit ad411e2d5d

View File

@ -55,6 +55,7 @@ struct bo {
}; };
static const int width = 512, height = 512; static const int width = 512, height = 512;
int fd;
static void create_bo(drm_intel_bufmgr *bufmgr, static void create_bo(drm_intel_bufmgr *bufmgr,
struct bo *b, struct bo *b,
@ -88,7 +89,10 @@ static int check_bo(struct bo *b)
const uint32_t *map; const uint32_t *map;
int i, fails = 0; int i, fails = 0;
drm_intel_bo_map(b->dst, false); igt_debug("verifying\n");
do_or_die(drm_intel_bo_map(b->dst, false));
map = b->dst->virtual; map = b->dst->virtual;
for (i = 0; i < width*height; i++) { for (i = 0; i < width*height; i++) {
if (map[i] != i && ++fails <= 9) { if (map[i] != i && ++fails <= 9) {
@ -111,17 +115,17 @@ static void destroy_bo(struct bo *b)
drm_intel_bo_unreference(b->dst); drm_intel_bo_unreference(b->dst);
} }
static int check_ring(drm_intel_bufmgr *bufmgr, static void fill_ring(drm_intel_bufmgr *bufmgr,
struct intel_batchbuffer *batch,
const char *ring, const char *ring,
igt_render_copyfunc_t copy) igt_render_copyfunc_t copy)
{ {
struct intel_batchbuffer *batch;
struct igt_buf src, tmp, dst; struct igt_buf src, tmp, dst;
struct bo bo; struct bo bo;
char output[100];
int i; int i;
snprintf(output, 100, "filling %s ring: ", ring); batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
igt_assert(batch);
create_bo(bufmgr, &bo, ring); create_bo(bufmgr, &bo, ring);
@ -154,8 +158,6 @@ static int check_ring(drm_intel_bufmgr *bufmgr,
int x = i % width; int x = i % width;
int y = i / width; int y = i / width;
igt_progress(output, i, width*height);
igt_assert_lt(y, height); igt_assert_lt(y, height);
/* Dummy load to fill the ring */ /* Dummy load to fill the ring */
@ -165,11 +167,9 @@ static int check_ring(drm_intel_bufmgr *bufmgr,
} }
/* verify */ /* verify */
igt_info("verifying\n"); igt_assert_eq(check_bo(&bo), 0);
i = check_bo(&bo);
destroy_bo(&bo); destroy_bo(&bo);
intel_batchbuffer_free(batch);
return i;
} }
static void blt_copy(struct intel_batchbuffer *batch, static void blt_copy(struct intel_batchbuffer *batch,
@ -193,9 +193,47 @@ static void blt_copy(struct intel_batchbuffer *batch,
intel_batchbuffer_flush(batch); intel_batchbuffer_flush(batch);
} }
drm_intel_bufmgr *bufmgr; static void run_test(int ring, bool interruptible, int nchild) {
struct intel_batchbuffer *batch; drm_intel_bufmgr *bufmgr;
int fd; igt_render_copyfunc_t copy;
const char* ring_name;
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
igt_assert(bufmgr);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
if (ring == I915_EXEC_RENDER) {
copy = igt_get_render_copyfunc(intel_get_drm_devid(fd));
ring_name = "render";
} else if (ring == I915_EXEC_BLT) {
copy = blt_copy;
ring_name = "blt";
} else {
igt_fail_on_f(true, "Unsupported ring.");
}
/* Not all platforms have dedicated render ring. */
igt_require(copy);
if (interruptible) {
igt_fork_signal_helper();
}
if (nchild) {
igt_fork(child, nchild) {
fill_ring(bufmgr, ring_name, copy);
}
igt_waitchildren();
} else {
fill_ring(bufmgr, ring_name, copy);
}
if (interruptible) {
igt_stop_signal_helper();
}
drm_intel_bufmgr_destroy(bufmgr);
}
igt_main igt_main
{ {
@ -203,48 +241,33 @@ igt_main
igt_fixture { igt_fixture {
fd = drm_open_any(); fd = drm_open_any();
bufmgr = drm_intel_bufmgr_gem_init(fd, 4096);
drm_intel_bufmgr_gem_enable_reuse(bufmgr);
batch = intel_batchbuffer_alloc(bufmgr, intel_get_drm_devid(fd));
} }
igt_subtest("blitter") igt_subtest("blitter")
check_ring(bufmgr, batch, "blt", blt_copy); run_test(I915_EXEC_BLT, false, 0);
/* Strictly only required on architectures with a separate BLT ring, igt_subtest("render")
* but lets stress everybody. run_test(I915_EXEC_RENDER, false, 0);
*/
igt_subtest("render") {
igt_render_copyfunc_t copy;
copy = igt_get_render_copyfunc(batch->devid);
igt_require(copy);
check_ring(bufmgr, batch, "render", copy);
}
igt_fork_signal_helper();
igt_subtest("blitter-interruptible") igt_subtest("blitter-interruptible")
check_ring(bufmgr, batch, "blt", blt_copy); run_test(I915_EXEC_BLT, true, 0);
/* Strictly only required on architectures with a separate BLT ring, igt_subtest("render-interruptible")
* but lets stress everybody. run_test(I915_EXEC_RENDER, true, 0);
*/
igt_subtest("render-interruptible") {
igt_render_copyfunc_t copy;
copy = igt_get_render_copyfunc(batch->devid); igt_subtest("blitter-forked-1")
igt_require(copy); run_test(I915_EXEC_BLT, false, 1);
check_ring(bufmgr, batch, "render", copy); igt_subtest("render-forked-1")
} run_test(I915_EXEC_RENDER, false, 1);
igt_stop_signal_helper();
igt_subtest("blitter-forked-4")
run_test(I915_EXEC_BLT, false, 4);
igt_subtest("render-forked-4")
run_test(I915_EXEC_RENDER, false, 4);
igt_fixture { igt_fixture {
intel_batchbuffer_free(batch);
drm_intel_bufmgr_destroy(bufmgr);
close(fd); close(fd);
} }
} }