igt/kms: Make fence waiting explicit.
cover igt/kms: Make fence waiting explicit.
I wanted to make kms_atomic_transition pass, but the nonblocking modeset fencing tests were bogus.
This series changes the semantics for fencing slightly. It only keeps the out fences in pipe_obj->out_fence_fd, it's up to the test to decide what to do with it, which is probably just waiting on the fd or checking if it completed.
Maarten Lankhorst (5):
tests/kms_atomic_transition: Add test for plane completion ordering. lib/kms: Handle fence interaction correctly WRT TEST_ONLY. tests/kms_atomic_transition: Only request fence on enabled pipes tests/kms_atomic_transition: Do not clear in-fences after atomic
commit.
igt/kms: Do not wait for fence completion during commit
lib/igt_kms.c | 41 ++++++++---------- tests/kms_atomic_transition.c | 99 +++++++++++++++++++++++++++++++++---------- 2 files changed, 95 insertions(+), 45 deletions(-)
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/5 tests/kms_atomic_transition: Add test for plane completion ordering.
When a plane gets disabled, that commit has to complete before an atomic commit on that disabled plane only. Else for the old commit, new_plane_state may have been freed.
--- tests/kms_atomic_transition.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
tests/kms_atomic_transition.c +31 -0
@@ -30,6 +30,7 @@#include <stdio.h> #include <string.h> #include <time.h> +#include <poll.h> #ifndef DRM_CAP_CURSOR_WIDTH #define DRM_CAP_CURSOR_WIDTH 0x8
@@ -152,6 +153,7 @@ static drmEventContext drm_events = {enum transition_type {TRANSITION_PLANES , +TRANSITION_AFTER_FREE ,TRANSITION_MODESET ,TRANSITION_MODESET_DISABLE , };
@@ -480,6 +482,31 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *outputigt_skip ("Cannot run tests without proper size sprite planes\n" ); } +igt_display_commit2 (display,COMMIT_ATOMIC ); + +if (type ==TRANSITION_AFTER_FREE ) { +struct pollfd pfd = { display->drm_fd,POLLIN }; + +wm_setup_plane (display, pipe,0 , parms); + +atomic_commit (display, pipe, flags, (void *)(unsigned long )0 , fencing); + +for_each_plane_on_pipe (display, pipe, plane) + plane->fb_changed = true; + +igt_display_commit2 (display,COMMIT_ATOMIC ); + +/* +* Previous atomic commit should have completed +* before this plane-only atomic commit. +*/ +igt_assert_eq (poll (&pfd,1 ,0 ),1 ); + +drmHandleEvent (display->drm_fd, &drm_events); + + goto cleanup; + } +for (i =0 ; i < iter_max; i++) {igt_output_set_pipe (output, pipe);
@@ -854,6 +881,10 @@ igt_mainfor_each_pipe_with_valid_output (&display, pipe, output)run_transition_test (&display, pipe, output,TRANSITION_PLANES , true, true); + igt_subtest("plane-use-after-nonblocking-unbind") +for_each_pipe_with_valid_output (&display, pipe, output) +run_transition_test (&display, pipe, output,TRANSITION_AFTER_FREE , true, false); + igt_subtest("plane-all-modeset-transition")for_each_pipe_with_valid_output (&display, pipe, output)run_transition_test (&display, pipe, output,TRANSITION_MODESET , false, false);
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 lib/kms: Handle fence interaction correctly WRT TEST_ONLY.
In reply to Maarten LankhorstAll other atomic properties are reset in display_commit_changed, which is the right place because TEST_ONLY commits don't need to be reset.
--- lib/igt_kms.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-)
lib/igt_kms.c +16 -22
@@ -2505,7 +2505,6 @@ static void igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicRe pipe_obj->out_fence_fd =-1 ;if (pipe_obj->out_fence_requested) { - pipe_obj->out_fence_requested = false;igt_atomic_populate_crtc_req (req, pipe_obj,IGT_CRTC_OUT_FENCE_PTR , (uint64_t )(uintptr_t ) &pipe_obj->out_fence_fd); }
@@ -2586,27 +2585,6 @@ static int igt_atomic_commit(igt_display_t *display, uint32_t flags, void *user_ } ret =drmModeAtomicCommit (display->drm_fd, req, flags, user_data); -if (!ret) { - -for_each_pipe (display, pipe) { -igt_pipe_t *pipe_obj = &display->pipes[pipe]; -igt_plane_t *plane; - -/* reset fence_fd to prevent it from being set for the next commit */ -for_each_plane_on_pipe (display, pipe, plane) { -igt_plane_set_fence_fd (plane,-1 ); - } - -if (pipe_obj->out_fence_fd ==-1 ) -continue ; - -igt_assert (pipe_obj->out_fence_fd >=0 ); - ret =sync_fence_wait (pipe_obj->out_fence_fd,1000 ); -igt_assert (ret ==0 ); -close (pipe_obj->out_fence_fd); - pipe_obj->out_fence_fd =-1 ; - } - }drmModeAtomicFree (req);return ret;
@@ -2629,6 +2607,18 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s)if (s !=COMMIT_UNIVERSAL ) pipe_obj->mode_changed = false; +if (s ==COMMIT_ATOMIC ) { + pipe_obj->out_fence_requested = false; + +if (pipe_obj->out_fence_fd ==-1 ) +continue ; + +igt_assert (pipe_obj->out_fence_fd >=0 ); +igt_assert_eq (sync_fence_wait (pipe_obj->out_fence_fd,1000 ),0 ); +close (pipe_obj->out_fence_fd); + pipe_obj->out_fence_fd =-1 ; + } +for_each_plane_on_pipe (display, pipe, plane) { plane->fb_changed = false; plane->position_changed = false;
@@ -2638,6 +2628,10 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s) !(plane->type ==DRM_PLANE_TYPE_PRIMARY || plane->type == DRM_PLANE_TYPE_CURSOR)) plane->rotation_changed = false; + +if (s ==COMMIT_ATOMIC ) +/* reset fence_fd to prevent it from being set for the next commit */ +igt_plane_set_fence_fd (plane,-1 ); } }
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 tests/kms_atomic_transition: Only request fence on enabled pipes
In reply to Maarten LankhorstTrying to set a fence on disabled pipes will be rejected by the kernel:
[ 1275.865029] [drm:drm_atomic_check_only [drm]] [CRTC:39:pipe B] requesting event but off
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99911
--- tests/kms_atomic_transition.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/kms_atomic_transition.c +3 -3
@@ -717,11 +717,11 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblockigt_plane_set_fb (plane, &fbs[1 ]);igt_fb_set_size (&fbs[1 ], plane, mode->hdisplay, mode->vdisplay);igt_plane_set_size (plane, mode->hdisplay, mode->vdisplay); + +if (fencing) +igt_pipe_request_out_fence (&display->pipes[i]); }else igt_plane_set_fb (plane,NULL ); - -if (fencing) -igt_pipe_request_out_fence (&display->pipes[i]); }/*
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 tests/kms_atomic_transition: Do not clear in-fences after atomic commit.
In reply to Maarten LankhorstThis is already done in igt_display_commit* functions.
--- tests/kms_atomic_transition.c | 11 ----------- 1 file changed, 11 deletions(-)
tests/kms_atomic_transition.c +0 -11
@@ -367,14 +367,6 @@ static void configure_fencing(igt_display_t *display, enum pipe pipe) } } -static void clear_fencing (igt_display_t *display,enum pipe pipe) -{ -igt_plane_t *plane; - -for_each_plane_on_pipe (display, pipe, plane) -igt_plane_set_fence_fd (plane,-1 ); -} -static void atomic_commit (igt_display_t *display,enum pipe pipe,unsigned int flags,void *data,bool fencing) {if (fencing) {
@@ -383,9 +375,6 @@ static void atomic_commit(igt_display_t *display, enum pipe pipe, unsigned int f }igt_display_commit_atomic (display, flags, data); - -if (fencing) -clear_fencing (display, pipe); }/*
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/5 igt/kms: Do not wait for fence completion during commit
In reply to Maarten LankhorstThis will make the IGT tests that use fences more useful, since they can perform the waiting themselves when required.
To celebrate, also add plane-use-after-nonblocking-unbind-fencing, the fence version of plane-use-after-nonblocking-unbind.
--- lib/igt_kms.c | 19 ++++++------ tests/kms_atomic_transition.c | 71 ++++++++++++++++++++++++++++++++----------- 2 files changed, 63 insertions(+), 27 deletions(-)
lib/igt_kms.c +10 -9
@@ -1698,6 +1698,7 @@ void igt_display_init(igt_display_t *display, int drm_fd) pipe->plane_cursor =-1 ; pipe->plane_primary =-1 ; pipe->planes =NULL ; + pipe->out_fence_fd =-1 ; get_crtc_property(display->drm_fd, pipe->crtc_id, "background_color",
@@ -1913,6 +1914,9 @@ static void igt_pipe_fini(igt_pipe_t *pipe)free (pipe->planes); pipe->planes =NULL ; + +if (pipe->out_fence_fd !=-1 ) +close (pipe->out_fence_fd); }static void igt_output_fini (igt_output_t *output)
@@ -2502,7 +2506,11 @@ static void igt_atomic_prepare_crtc_commit(igt_pipe_t *pipe_obj, drmModeAtomicReigt_atomic_populate_crtc_req (req, pipe_obj,IGT_CRTC_ACTIVE , !!output); } - pipe_obj->out_fence_fd =-1 ; +if (pipe_obj->out_fence_fd !=-1 ) { +close (pipe_obj->out_fence_fd); + pipe_obj->out_fence_fd =-1 ; + } +if (pipe_obj->out_fence_requested) { igt_atomic_populate_crtc_req(req, pipe_obj, IGT_CRTC_OUT_FENCE_PTR,
@@ -2607,16 +2615,9 @@ display_commit_changed(igt_display_t *display, enum igt_commit_style s)if (s !=COMMIT_UNIVERSAL ) pipe_obj->mode_changed = false; -if (s ==COMMIT_ATOMIC ) { +if (s ==COMMIT_ATOMIC && pipe_obj->out_fence_requested) { pipe_obj->out_fence_requested = false; - -if (pipe_obj->out_fence_fd ==-1 ) -continue ; -igt_assert (pipe_obj->out_fence_fd >=0 ); -igt_assert_eq (sync_fence_wait (pipe_obj->out_fence_fd,1000 ),0 ); -close (pipe_obj->out_fence_fd); - pipe_obj->out_fence_fd =-1 ; }for_each_plane_on_pipe (display, pipe, plane) {
tests/kms_atomic_transition.c +53 -18
142 lines not on this page · raw message
Signature · 6 lines
2.11.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi Maarten,
2017-07-06 Maarten Lankhorst <[email protected]>:
Quoted 15 lines
I wanted to make
kms_atomic_transitionpass, but the nonblocking modeset fencing tests were bogus.This series changes the semantics for fencing slightly. It only keeps the out fences in
pipe_obj->out_fence_fd, it's up to the test to decide what to do with it, which is probably just waiting on the fd or checking if it completed.Maarten Lankhorst (5):
tests/kms_atomic_transition: Add test for plane completion ordering. lib/kms: Handle fence interaction correctly WRTTEST_ONLY. tests/kms_atomic_transition: Only request fence on enabled pipes tests/kms_atomic_transition: Do not clear in-fences after atomic
commit.
igt/kms: Do not wait for fence completion during commit
Quoted 3 lines
lib/igt_kms.c | 41 ++++++++---------- tests/kms_atomic_transition.c | 99 +++++++++++++++++++++++++++++++++---------- 2 files changed, 95 insertions(+), 45 deletions(-)
This make fencing a lot cleaner.
For the whole series:
Gustavo
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Op 07-07-17 om 02:15 schreef Gustavo Padovan:
Quoted 22 lines
Hi Maarten,
2017-07-06 Maarten Lankhorst <[email protected]>:
Quoted 15 lines
I wanted to make
kms_atomic_transitionpass, but the nonblocking modeset fencing tests were bogus.This series changes the semantics for fencing slightly. It only keeps the out fences in
pipe_obj->out_fence_fd, it's up to the test to decide what to do with it, which is probably just waiting on the fd or checking if it completed.Maarten Lankhorst (5):
tests/kms_atomic_transition: Add test for plane completion ordering. lib/kms: Handle fence interaction correctly WRTTEST_ONLY. tests/kms_atomic_transition: Only request fence on enabled pipes tests/kms_atomic_transition: Do not clear in-fences after atomic
commit.
igt/kms: Do not wait for fence completion during commitQuoted 3 lines
lib/igt_kms.c | 41 ++++++++---------- tests/kms_atomic_transition.c | 99 +++++++++++++++++++++++++++++++++---------- 2 files changed, 95 insertions(+), 45 deletions(-)
Quoted 8 lines
This make fencing a lot cleaner.
For the whole series:
Acked-by Gustavo Padovan <[email protected]>Gustavo
Thanks, pushed. :)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx