Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: gustavo.padovan@collabora.co.uk
Subject: [PATCH i-g-t 1/5] tests/kms_atomic_transition: Add test for plane completion ordering.
Date: Thu,  6 Jul 2017 09:11:43 +0200	[thread overview]
Message-ID: <20170706071147.15414-2-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20170706071147.15414-1-maarten.lankhorst@linux.intel.com>

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>
---
 tests/kms_atomic_transition.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index ba5cd4d6e289..2b56eef66b7b 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);
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-07-06  7:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-06  7:11 [PATCH i-g-t 0/5] igt/kms: Make fence waiting explicit Maarten Lankhorst
2017-07-06  7:11 ` Maarten Lankhorst [this message]
2017-07-06  7:11 ` [PATCH i-g-t 2/5] lib/kms: Handle fence interaction correctly WRT TEST_ONLY Maarten Lankhorst
2017-07-06  7:11 ` [PATCH i-g-t 3/5] tests/kms_atomic_transition: Only request fence on enabled pipes Maarten Lankhorst
2017-07-06  7:11 ` [PATCH i-g-t 4/5] tests/kms_atomic_transition: Do not clear in-fences after atomic commit Maarten Lankhorst
2017-07-06  7:11 ` [PATCH i-g-t 5/5] igt/kms: Do not wait for fence completion during commit Maarten Lankhorst
2017-07-07  0:15 ` [PATCH i-g-t 0/5] igt/kms: Make fence waiting explicit Gustavo Padovan
2017-07-10  7:06   ` Maarten Lankhorst

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170706071147.15414-2-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox