summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2020-05-28 22:06:23 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2020-05-28 22:10:14 +0100
commit757b6e72d546fd2dbc3801a73796d67b0854021b (patch)
treed1c0d8366de2de9ae168600423a84cfd66bc0609 /tests
parente5371a99a877be134c6ad5361a5f03843a66f775 (diff)
kms_busy: Measure the warmup and use that as our timeout
For determining whether or not we flip too fast, we don't have to wait long, just long enough. A ballpark measure of how long is reasonable is given by how fast we perform the warmup, as that is 3 flips/modesets. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/kms_busy.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/kms_busy.c b/tests/kms_busy.c
index b1b2ea775..9e483f805 100644
--- a/tests/kms_busy.c
+++ b/tests/kms_busy.c
@@ -70,11 +70,10 @@ static void do_cleanup_display(igt_display_t *dpy)
static void flip_to_fb(igt_display_t *dpy, int pipe,
igt_output_t *output,
- struct igt_fb *fb, unsigned ring,
+ struct igt_fb *fb, unsigned ring, int timeout,
const char *name, bool modeset)
{
struct pollfd pfd = { .fd = dpy->drm_fd, .events = POLLIN };
- const int timeout = modeset ? 8500 : 100;
struct drm_event_vblank ev;
IGT_CORK_FENCE(cork);
igt_spin_t *t;
@@ -136,7 +135,9 @@ static void test_flip(igt_display_t *dpy, unsigned ring, int pipe, bool modeset)
{
struct igt_fb fb[2];
int warmup[] = { 0, 1, 0, -1 };
+ struct timespec tv = {};
igt_output_t *output;
+ int timeout;
if (modeset)
igt_require(dpy->is_atomic);
@@ -153,6 +154,7 @@ static void test_flip(igt_display_t *dpy, unsigned ring, int pipe, bool modeset)
/* Bind both fb to the display (such that they are ready for future
* flips without stalling for the bind) leaving fb[0] as bound.
*/
+ igt_nsec_elapsed(&tv);
for (int i = 0; warmup[i] != -1; i++) {
struct drm_event_vblank ev;
@@ -163,12 +165,14 @@ static void test_flip(igt_display_t *dpy, unsigned ring, int pipe, bool modeset)
&fb[warmup[i]]));
igt_assert(read(dpy->drm_fd, &ev, sizeof(ev)) == sizeof(ev));
}
+ timeout = igt_nsec_elapsed(&tv) / 1000 / 1000;
+ igt_info("Using timeout of %dms\n", timeout);
/* Make the frontbuffer busy and try to flip to itself */
- flip_to_fb(dpy, pipe, output, &fb[0], ring, "fb[0]", modeset);
+ flip_to_fb(dpy, pipe, output, &fb[0], ring, timeout, "fb[0]", modeset);
/* Repeat for flip to second buffer */
- flip_to_fb(dpy, pipe, output, &fb[1], ring, "fb[1]", modeset);
+ flip_to_fb(dpy, pipe, output, &fb[1], ring, timeout, "fb[1]", modeset);
do_cleanup_display(dpy);
igt_remove_fb(dpy->drm_fd, &fb[1]);