mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2025-06-21 14:56:18 +00:00
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 <keithp@keithp.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
bd521b493e
commit
6727de0c1a
@ -71,6 +71,9 @@
|
|||||||
#define TEST_ENOENT (1 << 22)
|
#define TEST_ENOENT (1 << 22)
|
||||||
#define TEST_FENCE_STRESS (1 << 23)
|
#define TEST_FENCE_STRESS (1 << 23)
|
||||||
#define TEST_VBLANK_RACE (1 << 24)
|
#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_FLIP (1 << 0)
|
||||||
#define EVENT_VBLANK (1 << 1)
|
#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,
|
es->name, es->name,
|
||||||
(int) diff.tv_sec, (int) diff.tv_usec);
|
(int) diff.tv_sec, (int) diff.tv_usec);
|
||||||
|
|
||||||
/* This bounding matches the one in DRM_IOCTL_WAIT_VBLANK. */
|
/* check only valid if no modeset happens in between, that increments by
|
||||||
if (!(o->flags & (TEST_DPMS | TEST_MODESET))) {
|
* (1 << 23) on each step. This bounding matches the one in
|
||||||
/* check only valid if no modeset happens in between, that
|
* DRM_IOCTL_WAIT_VBLANK. */
|
||||||
* increments by (1 << 23) on each step. */
|
if (!(o->flags & (TEST_DPMS | TEST_MODESET)))
|
||||||
|
|
||||||
igt_assert_f(es->current_seq - (es->last_seq + o->seq_step) <= 1UL << 23,
|
igt_assert_f(es->current_seq - (es->last_seq + o->seq_step) <= 1UL << 23,
|
||||||
"unexpected %s seq %u, should be >= %u\n",
|
"unexpected %s seq %u, should be >= %u\n",
|
||||||
es->name, es->current_seq, es->last_seq + o->seq_step);
|
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))) {
|
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",
|
"failed to disable output: %s\n",
|
||||||
strerror(errno));
|
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)
|
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)
|
igt_assert(do_wait_for_vblank(o, o->pipe, target_seq, &vbl_reply)
|
||||||
== -EINVAL);
|
== -EINVAL);
|
||||||
@ -1312,6 +1331,10 @@ static int run_test(int duration, int flags)
|
|||||||
|
|
||||||
igt_require((flags & TEST_HANG) == 0 || !is_hung(drm_fd));
|
igt_require((flags & TEST_HANG) == 0 || !is_hung(drm_fd));
|
||||||
|
|
||||||
|
|
||||||
|
if (flags & TEST_RPM)
|
||||||
|
igt_require(igt_setup_runtime_pm());
|
||||||
|
|
||||||
resources = drmModeGetResources(drm_fd);
|
resources = drmModeGetResources(drm_fd);
|
||||||
igt_assert(resources);
|
igt_assert(resources);
|
||||||
|
|
||||||
@ -1516,6 +1539,10 @@ int main(int argc, char **argv)
|
|||||||
{ 0, TEST_ENOENT | TEST_NOEVENT, "nonexisting-fb" },
|
{ 0, TEST_ENOENT | TEST_NOEVENT, "nonexisting-fb" },
|
||||||
{ 10, TEST_DPMS_OFF | TEST_DPMS | TEST_VBLANK_RACE, "dpms-vs-vblank-race" },
|
{ 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_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;
|
int i;
|
||||||
|
|
||||||
@ -1541,6 +1568,10 @@ int main(int argc, char **argv)
|
|||||||
if (tests[i].flags & TEST_NO_2X_OUTPUT)
|
if (tests[i].flags & TEST_NO_2X_OUTPUT)
|
||||||
continue;
|
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)
|
igt_subtest_f( "2x-%s", tests[i].name)
|
||||||
run_pair(tests[i].duration, tests[i].flags);
|
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)
|
if (tests[i].flags & TEST_NO_2X_OUTPUT)
|
||||||
continue;
|
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)
|
igt_subtest_f( "2x-%s-interruptible", tests[i].name)
|
||||||
run_pair(tests[i].duration, tests[i].flags);
|
run_pair(tests[i].duration, tests[i].flags);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user