From: Daniel Vetter Date: Wed, 14 May 2014 15:59:02 +0000 (+0200) Subject: tests/kms_flip: nasty power management tests X-Git-Tag: intel-gpu-tools-1.7~70 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6727de0c1abe0b2d6d44255dd30a29dc3ee84993;p=profile%2Fextras%2Fintel-gpu-tools.git tests/kms_flip: nasty power management tests These check whether everything is still ok wrt vblank handling after runtime pm and system suspend-resume. In addition to the usual checks they also ensure that the vblank frame counter isn't totally ridiculous, something Keith complained about aeons ago. With Ville's drm_vblank_on/off rework this should now be fixed and solid. v2: - Ignore seq_step, vblanks completely immediately when the crtc goes off - Only run system suspend/resume tests once. Cc: Keith Packard Signed-off-by: Daniel Vetter --- diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 9783c7e..bb4f71d 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -71,6 +71,9 @@ #define TEST_ENOENT (1 << 22) #define TEST_FENCE_STRESS (1 << 23) #define TEST_VBLANK_RACE (1 << 24) +#define TEST_RPM (1 << 25) +#define TEST_SUSPEND (1 << 26) +#define TEST_TS_CONT (1 << 27) #define EVENT_FLIP (1 << 0) #define EVENT_VBLANK (1 << 1) @@ -551,14 +554,24 @@ static void check_state(struct test_output *o, struct event_state *es) es->name, es->name, (int) diff.tv_sec, (int) diff.tv_usec); - /* This bounding matches the one in DRM_IOCTL_WAIT_VBLANK. */ - if (!(o->flags & (TEST_DPMS | TEST_MODESET))) { - /* check only valid if no modeset happens in between, that - * increments by (1 << 23) on each step. */ - + /* check only valid if no modeset happens in between, that increments by + * (1 << 23) on each step. This bounding matches the one in + * DRM_IOCTL_WAIT_VBLANK. */ + if (!(o->flags & (TEST_DPMS | TEST_MODESET))) igt_assert_f(es->current_seq - (es->last_seq + o->seq_step) <= 1UL << 23, "unexpected %s seq %u, should be >= %u\n", es->name, es->current_seq, es->last_seq + o->seq_step); + + /* Check that the vblank frame didn't wrap unexpectedly. */ + if (o->flags & TEST_TS_CONT) { + /* Ignore seq_step here since vblank waits time out immediately + * when we kill the crtc. */ + igt_assert_f(es->current_seq - es->last_seq >= 0, + "unexpected %s seq %u, should be >= %u\n", + es->name, es->current_seq, es->last_seq); + igt_assert_f(es->current_seq - es->last_seq <= 100, + "unexpected %s seq %u, should be < %u\n", + es->name, es->current_seq, es->last_seq + 100); } if ((o->flags & TEST_CHECK_TS) && (!analog_tv_connector(o))) { @@ -919,6 +932,12 @@ static unsigned int run_test_step(struct test_output *o) "failed to disable output: %s\n", strerror(errno)); + if (o->flags & TEST_RPM) + igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED)); + + if (o->flags & TEST_SUSPEND) + igt_system_suspend_autoresume(); + if (do_vblank && (o->flags & TEST_EINVAL) && o->vblank_state.count > 0) igt_assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply) == -EINVAL); @@ -1312,6 +1331,10 @@ static int run_test(int duration, int flags) igt_require((flags & TEST_HANG) == 0 || !is_hung(drm_fd)); + + if (flags & TEST_RPM) + igt_require(igt_setup_runtime_pm()); + resources = drmModeGetResources(drm_fd); igt_assert(resources); @@ -1516,6 +1539,10 @@ int main(int argc, char **argv) { 0, TEST_ENOENT | TEST_NOEVENT, "nonexisting-fb" }, { 10, TEST_DPMS_OFF | TEST_DPMS | TEST_VBLANK_RACE, "dpms-vs-vblank-race" }, { 10, TEST_MODESET | TEST_VBLANK_RACE, "modeset-vs-vblank-race" }, + { 10, TEST_VBLANK | TEST_DPMS | TEST_RPM | TEST_TS_CONT, "dpms-vs-rpm" }, + { 10, TEST_VBLANK | TEST_DPMS | TEST_SUSPEND | TEST_TS_CONT, "dpms-vs-suspend" }, + { 0, TEST_VBLANK | TEST_MODESET | TEST_RPM | TEST_TS_CONT, "modeset-vs-rpm" }, + { 0, TEST_VBLANK | TEST_MODESET | TEST_SUSPEND | TEST_TS_CONT, "modeset-vs-suspend" }, }; int i; @@ -1541,6 +1568,10 @@ int main(int argc, char **argv) if (tests[i].flags & TEST_NO_2X_OUTPUT) continue; + /* code doesn't disable all crtcs, so skip rpm tests */ + if (tests[i].flags & TEST_RPM) + continue; + igt_subtest_f( "2x-%s", tests[i].name) run_pair(tests[i].duration, tests[i].flags); } @@ -1559,6 +1590,10 @@ int main(int argc, char **argv) if (tests[i].flags & TEST_NO_2X_OUTPUT) continue; + /* code doesn't disable all crtcs, so skip rpm tests */ + if (tests[i].flags & TEST_RPM) + continue; + igt_subtest_f( "2x-%s-interruptible", tests[i].name) run_pair(tests[i].duration, tests[i].flags); }