Right now it's hardcoded to a maximum difference of 150 page flips to account the fixed amount of time that the suspend cycle should take, but in some cases suspending and resuming will take much more time due to unrelated issues. In my case, I have a machine in which the RTC will cause an interrupt storm (~8k interrupts per second) from the moment an alarm is set until the alarm actually fires. This causes so much CPU contention that the suspend cycle takes much longer and the 150 value is not enough. This patch takes into account the time that passed between the last two page flips and calculates an acceptable difference taking into account the vertical refresh rate of the current mode. Signed-off-by: Tomeu Vizoso <tomeu.vizoso@xxxxxxxxxxxxx> References: https://bugs.freedesktop.org/show_bug.cgi?id=98289 --- tests/kms_flip.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/kms_flip.c b/tests/kms_flip.c index 41406dfe9199..522777c24da2 100644 --- a/tests/kms_flip.c +++ b/tests/kms_flip.c @@ -500,17 +500,25 @@ static void check_state(const struct test_output *o, const struct event_state *e /* Check that the vblank frame didn't wrap unexpectedly. */ if (o->flags & TEST_TS_CONT) { + double elapsed; + unsigned max_delta; + /* 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 <= 150, + + timersub(&es->current_ts, &es->last_ts, &diff); + elapsed = 1e6*diff.tv_sec + diff.tv_usec; + max_delta = elapsed * o->kmode[0].vrefresh / 1e6; + + igt_assert_f(es->current_seq - es->last_seq <= max_delta, "unexpected %s seq %u, should be < %u\n", - es->name, es->current_seq, es->last_seq + 150); + es->name, es->current_seq, es->last_seq + max_delta); - igt_debug("testing ts continuity: Current frame %u, old frame %u\n", - es->current_seq, es->last_seq); + igt_debug("testing ts continuity: Current frame %u, old frame %u, max delta %u\n", + es->current_seq, es->last_seq, max_delta); } if (o->flags & TEST_CHECK_TS) { -- 2.9.3 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx