diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-12-13 21:30:43 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-12-17 15:30:53 +0100 |
commit | df41e1a6bbe75f047e83bb543e0b0564ed10862b (patch) | |
tree | 979993012ec49da007c11583e00e20c7d250b02f | |
parent | 8ed0112f88a8738d3e813428e5045333a6e07fbf (diff) |
flip_test: recreate fb
... to test the latency of rmfb, getfb and addfb. Since if those still
can cause spikes, we have a problem.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | tests/flip_test.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/tests/flip_test.c b/tests/flip_test.c index c3615e1fb..2b0346c35 100644 --- a/tests/flip_test.c +++ b/tests/flip_test.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #define TEST_VBLANK_BLOCK (1 << 9) | 53 | #define TEST_VBLANK_BLOCK (1 << 9) |
54 | #define TEST_VBLANK_ABSOLUTE (1 << 10) | 54 | #define TEST_VBLANK_ABSOLUTE (1 << 10) |
55 | #define TEST_VBLANK_EXPIRED_SEQ (1 << 11) | 55 | #define TEST_VBLANK_EXPIRED_SEQ (1 << 11) |
56 | #define TEST_FB_RECREATE (1 << 12) | ||
56 | 57 | ||
57 | #define EVENT_FLIP (1 << 0) | 58 | #define EVENT_FLIP (1 << 0) |
58 | #define EVENT_VBLANK (1 << 1) | 59 | #define EVENT_VBLANK (1 << 1) |
@@ -115,6 +116,7 @@ struct test_output { | |||
115 | unsigned int fb_width; | 116 | unsigned int fb_width; |
116 | unsigned int fb_height; | 117 | unsigned int fb_height; |
117 | unsigned int fb_ids[2]; | 118 | unsigned int fb_ids[2]; |
119 | int bpp, depth; | ||
118 | struct kmstest_fb fb_info[2]; | 120 | struct kmstest_fb fb_info[2]; |
119 | 121 | ||
120 | struct event_state flip_state; | 122 | struct event_state flip_state; |
@@ -464,6 +466,28 @@ static void check_all_state(struct test_output *o, | |||
464 | check_state_correlation(o, &o->flip_state, &o->vblank_state); | 466 | check_state_correlation(o, &o->flip_state, &o->vblank_state); |
465 | } | 467 | } |
466 | 468 | ||
469 | static void recreate_fb(struct test_output *o) | ||
470 | { | ||
471 | drmModeFBPtr r; | ||
472 | struct kmstest_fb *fb_info = &o->fb_info[o->current_fb_id]; | ||
473 | uint32_t new_fb_id; | ||
474 | |||
475 | /* Call rmfb/getfb/addfb to ensure those don't introduce stalls */ | ||
476 | r = drmModeGetFB(drm_fd, fb_info->fb_id); | ||
477 | assert(r); | ||
478 | |||
479 | do_or_die(drmModeAddFB(drm_fd, o->fb_width, o->fb_height, o->depth, | ||
480 | o->bpp, fb_info->stride, | ||
481 | r->handle, &new_fb_id)); | ||
482 | |||
483 | drmFree(r); | ||
484 | gem_close(drm_fd, r->handle); | ||
485 | do_or_die(drmModeRmFB(drm_fd, fb_info->fb_id)); | ||
486 | |||
487 | o->fb_ids[o->current_fb_id] = new_fb_id; | ||
488 | o->fb_info[o->current_fb_id].fb_id = new_fb_id; | ||
489 | } | ||
490 | |||
467 | /* Return mask of completed events. */ | 491 | /* Return mask of completed events. */ |
468 | static unsigned int run_test_step(struct test_output *o) | 492 | static unsigned int run_test_step(struct test_output *o) |
469 | { | 493 | { |
@@ -494,6 +518,8 @@ static unsigned int run_test_step(struct test_output *o) | |||
494 | 518 | ||
495 | 519 | ||
496 | o->current_fb_id = !o->current_fb_id; | 520 | o->current_fb_id = !o->current_fb_id; |
521 | if (o->flags & TEST_FB_RECREATE) | ||
522 | recreate_fb(o); | ||
497 | new_fb_id = o->fb_ids[o->current_fb_id]; | 523 | new_fb_id = o->fb_ids[o->current_fb_id]; |
498 | 524 | ||
499 | if ((o->flags & TEST_VBLANK_EXPIRED_SEQ) && | 525 | if ((o->flags & TEST_VBLANK_EXPIRED_SEQ) && |
@@ -830,9 +856,11 @@ static unsigned event_loop(struct test_output *o, unsigned duration_sec) | |||
830 | 856 | ||
831 | static void run_test_on_crtc(struct test_output *o, int crtc, int duration) | 857 | static void run_test_on_crtc(struct test_output *o, int crtc, int duration) |
832 | { | 858 | { |
833 | int bpp = 32, depth = 24; | ||
834 | unsigned ellapsed; | 859 | unsigned ellapsed; |
835 | 860 | ||
861 | o->bpp = 32; | ||
862 | o->depth = 24; | ||
863 | |||
836 | connector_find_preferred_mode(o, crtc); | 864 | connector_find_preferred_mode(o, crtc); |
837 | if (!o->mode_valid) | 865 | if (!o->mode_valid) |
838 | return; | 866 | return; |
@@ -846,11 +874,11 @@ static void run_test_on_crtc(struct test_output *o, int crtc, int duration) | |||
846 | if (o->flags & TEST_PAN) | 874 | if (o->flags & TEST_PAN) |
847 | o->fb_width *= 2; | 875 | o->fb_width *= 2; |
848 | 876 | ||
849 | o->fb_ids[0] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height, bpp, | 877 | o->fb_ids[0] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height, |
850 | depth, false, &o->fb_info[0], | 878 | o->bpp, o->depth, false, &o->fb_info[0], |
851 | paint_flip_mode, (void *)false); | 879 | paint_flip_mode, (void *)false); |
852 | o->fb_ids[1] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height, bpp, | 880 | o->fb_ids[1] = kmstest_create_fb(drm_fd, o->fb_width, o->fb_height, |
853 | depth, false, &o->fb_info[1], | 881 | o->bpp, o->depth, false, &o->fb_info[1], |
854 | paint_flip_mode, (void *)true); | 882 | paint_flip_mode, (void *)true); |
855 | 883 | ||
856 | if (!o->fb_ids[0] || !o->fb_ids[1]) { | 884 | if (!o->fb_ids[0] || !o->fb_ids[1]) { |
@@ -985,6 +1013,8 @@ int main(int argc, char **argv) | |||
985 | 1013 | ||
986 | { 15, TEST_FLIP | TEST_EBUSY , "plain-flip" }, | 1014 | { 15, TEST_FLIP | TEST_EBUSY , "plain-flip" }, |
987 | { 15, TEST_FLIP | TEST_CHECK_TS | TEST_EBUSY , "plain-flip-ts-check" }, | 1015 | { 15, TEST_FLIP | TEST_CHECK_TS | TEST_EBUSY , "plain-flip-ts-check" }, |
1016 | { 15, TEST_FLIP | TEST_CHECK_TS | TEST_EBUSY | TEST_FB_RECREATE, | ||
1017 | "plain-flip-fb-recreate" }, | ||
988 | { 30, TEST_FLIP | TEST_DPMS | TEST_EINVAL, "flip-vs-dpms" }, | 1018 | { 30, TEST_FLIP | TEST_DPMS | TEST_EINVAL, "flip-vs-dpms" }, |
989 | { 30, TEST_FLIP | TEST_DPMS | TEST_WITH_DUMMY_LOAD, "delayed-flip-vs-dpms" }, | 1019 | { 30, TEST_FLIP | TEST_DPMS | TEST_WITH_DUMMY_LOAD, "delayed-flip-vs-dpms" }, |
990 | { 5, TEST_FLIP | TEST_PAN, "flip-vs-panning" }, | 1020 | { 5, TEST_FLIP | TEST_PAN, "flip-vs-panning" }, |