summaryrefslogtreecommitdiff
path: root/tests/kms_atomic_transition.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-07-04 14:23:53 +0200
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2017-07-10 09:04:22 +0200
commit33fd63f5067d0850bb89f2a09f410a76cd564534 (patch)
tree18b1a3f7c870577778f8acd41605217167cdda0a /tests/kms_atomic_transition.c
parent5071ed7e5729150fde180880aa2160f6f57de633 (diff)
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. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Acked-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Diffstat (limited to 'tests/kms_atomic_transition.c')
-rw-r--r--tests/kms_atomic_transition.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index ba5cd4d6..2b56eef6 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -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 *output
igt_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_main
for_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);