[Intel-gfx] [PATCH i-g-t 3/7] kms_vblank: Reorganize subtests by pipe
Maarten Lankhorst
maarten.lankhorst at linux.intel.com
Thu Jan 4 13:15:05 UTC 2018
Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
tests/kms_vblank.c | 102 ++++++++++++++++++++++++++++-------------------------
1 file changed, 53 insertions(+), 49 deletions(-)
diff --git a/tests/kms_vblank.c b/tests/kms_vblank.c
index 9a5a98743fa6..a83500635976 100644
--- a/tests/kms_vblank.c
+++ b/tests/kms_vblank.c
@@ -119,57 +119,48 @@ static void run_test(data_t *data, int fd, void (*testfunc)(data_t *, int, int))
int nchildren =
data->flags & FORKED ? sysconf(_SC_NPROCESSORS_ONLN) : 1;
igt_display_t *display = &data->display;
- igt_output_t *output;
- enum pipe p;
-
- for_each_pipe_with_valid_output(display, p, output) {
- igt_hang_t hang;
+ igt_output_t *output = data->output;
+ igt_hang_t hang;
- data->pipe = p;
- prepare_crtc(data, fd, output);
+ prepare_crtc(data, fd, output);
- igt_info("Beginning %s on pipe %s, connector %s (%d threads)\n",
- igt_subtest_name(),
- kmstest_pipe_name(data->pipe),
- igt_output_name(output),
- nchildren);
+ igt_info("Beginning %s on pipe %s, connector %s (%d threads)\n",
+ igt_subtest_name(), kmstest_pipe_name(data->pipe),
+ igt_output_name(output), nchildren);
- if (data->flags & HANG)
- hang = igt_hang_ring(display->drm_fd, I915_EXEC_DEFAULT);
+ if (data->flags & HANG)
+ hang = igt_hang_ring(display->drm_fd, I915_EXEC_DEFAULT);
- if (data->flags & BUSY) {
- union drm_wait_vblank vbl;
+ if (data->flags & BUSY) {
+ union drm_wait_vblank vbl;
- memset(&vbl, 0, sizeof(vbl));
- vbl.request.type =
- DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
- vbl.request.type |= kmstest_get_vbl_flag(data->pipe);
- vbl.request.sequence = 120 + 12;
- igt_assert_eq(wait_vblank(fd, &vbl), 0);
- }
+ memset(&vbl, 0, sizeof(vbl));
+ vbl.request.type =
+ DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT;
+ vbl.request.type |= kmstest_get_vbl_flag(data->pipe);
+ vbl.request.sequence = 120 + 12;
+ igt_assert_eq(wait_vblank(fd, &vbl), 0);
+ }
- igt_fork(child, nchildren)
- testfunc(data, fd, nchildren);
- igt_waitchildren();
+ igt_fork(child, nchildren)
+ testfunc(data, fd, nchildren);
+ igt_waitchildren();
- if (data->flags & BUSY) {
- struct drm_event_vblank buf;
- igt_assert_eq(read(fd, &buf, sizeof(buf)), sizeof(buf));
- }
+ if (data->flags & BUSY) {
+ struct drm_event_vblank buf;
+ igt_assert_eq(read(fd, &buf, sizeof(buf)), sizeof(buf));
+ }
- igt_assert(poll(&(struct pollfd){fd, POLLIN}, 1, 0) == 0);
+ igt_assert(poll(&(struct pollfd){fd, POLLIN}, 1, 0) == 0);
- if (data->flags & HANG)
- igt_post_hang_ring(fd, hang);
+ if (data->flags & HANG)
+ igt_post_hang_ring(fd, hang);
- igt_info("\n%s on pipe %s, connector %s: PASSED\n\n",
- igt_subtest_name(),
- kmstest_pipe_name(data->pipe),
- igt_output_name(output));
+ igt_info("\n%s on pipe %s, connector %s: PASSED\n\n",
+ igt_subtest_name(), kmstest_pipe_name(data->pipe), igt_output_name(output));
- /* cleanup what prepare_crtc() has done */
- cleanup_crtc(data, fd, output);
- }
+ /* cleanup what prepare_crtc() has done */
+ cleanup_crtc(data, fd, output);
}
static void crtc_id_subtest(data_t *data, int fd)
@@ -338,6 +329,8 @@ igt_main
{ "wait", vblank_wait, IDLE | FORKED | BUSY | HANG },
{ }
}, *f;
+ enum pipe p;
+
const struct {
const char *name;
unsigned int flags;
@@ -361,15 +354,26 @@ igt_main
igt_subtest("crtc-id")
crtc_id_subtest(&data, fd);
- for (f = funcs; f->name; f++) {
- for (m = modes; m->name; m++) {
- if (m->flags & ~f->valid)
- continue;
-
- igt_subtest_f("%s-%s%s", f->name, m->name,
- m->flags & HANG ? "-hang" : "") {
- data.flags = m->flags;
- run_test(&data, fd, f->func);
+ for_each_pipe_static(p) igt_subtest_group {
+ igt_fixture
+ igt_display_require_output_on_pipe(&data.display, p);
+
+ data.pipe = p;
+
+ for (f = funcs; f->name; f++) {
+ for (m = modes; m->name; m++) {
+ if (m->flags & ~f->valid)
+ continue;
+
+ igt_subtest_f("pipe-%s-%s-%s%s",
+ kmstest_pipe_name(data.pipe),
+ f->name, m->name,
+ m->flags & HANG ? "-hang" : "") {
+ for_each_valid_output_on_pipe(&data.display, data.pipe, data.output) {
+ data.flags = m->flags;
+ run_test(&data, fd, f->func);
+ }
+ }
}
}
}
--
2.15.1
More information about the Intel-gfx
mailing list