All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 2/2] tests/drm_read: Change tests to not require fbcon
Date: Fri, 13 Oct 2017 16:10:49 +0200	[thread overview]
Message-ID: <20171013141049.5242-4-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20171013141049.5242-1-maarten.lankhorst@linux.intel.com>

The first active pipe might not be pipe A, and we shouldn't rely on
fbcon for a working crtc. Use igt_kms to set up something basic, and
use the kmstest helper to get an event from the correct pipe.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 tests/drm_read.c | 62 +++++++++++++++++++++++++++++++-------------------------
 1 file changed, 34 insertions(+), 28 deletions(-)

diff --git a/tests/drm_read.c b/tests/drm_read.c
index 7df36e965c59..b6aab731261d 100644
--- a/tests/drm_read.c
+++ b/tests/drm_read.c
@@ -57,18 +57,9 @@ static void assert_empty(int fd)
 	do_or_die(poll(&pfd, 1, 0));
 }
 
-static void generate_event(int fd)
+static void generate_event(int fd, enum pipe pipe)
 {
-	union drm_wait_vblank vbl;
-
-	/* We require that pipe 0 is running */
-
-	vbl.request.type =
-		DRM_VBLANK_RELATIVE |
-		DRM_VBLANK_EVENT;
-	vbl.request.sequence = 0;
-
-	do_ioctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl);
+	igt_assert(kmstest_get_vblank(fd, pipe, DRM_VBLANK_EVENT));
 }
 
 static void wait_for_event(int fd)
@@ -120,7 +111,7 @@ static void test_invalid_buffer(int in)
 	teardown(fd);
 }
 
-static void test_fault_buffer(int in)
+static void test_fault_buffer(int in, enum pipe pipe)
 {
 	int fd = setup(in, 0);
 	struct drm_mode_map_dumb arg;
@@ -134,7 +125,7 @@ static void test_fault_buffer(int in)
 	buf = mmap(0, 4096, PROT_WRITE, MAP_SHARED, fd, arg.offset);
 	igt_assert(buf != MAP_FAILED);
 
-	generate_event(fd);
+	generate_event(fd, pipe);
 
 	alarm(1);
 
@@ -156,13 +147,13 @@ static void test_empty(int in, int nonblock, int expected)
 	teardown(fd);
 }
 
-static void test_short_buffer(int in, int nonblock)
+static void test_short_buffer(int in, int nonblock, enum pipe pipe)
 {
 	char buffer[1024]; /* events are typically 32 bytes */
 	int fd = setup(in, nonblock);
 
-	generate_event(fd);
-	generate_event(fd);
+	generate_event(fd, pipe);
+	generate_event(fd, pipe);
 
 	wait_for_event(fd);
 
@@ -175,31 +166,46 @@ static void test_short_buffer(int in, int nonblock)
 	teardown(fd);
 }
 
-static bool crtc0_active(int fd)
-{
-	union drm_wait_vblank vbl = {};
-
-	vbl.request.type = DRM_VBLANK_RELATIVE;
-	return drmIoctl(fd, DRM_IOCTL_WAIT_VBLANK, &vbl) == 0;
-}
-
 igt_main
 {
 	int fd;
+	igt_display_t display;
+	struct igt_fb fb;
+	enum pipe pipe;
 
 	signal(SIGALRM, sighandler);
 	siginterrupt(SIGALRM, 1);
 
 	igt_fixture {
+		igt_output_t *output;
+
 		fd = drm_open_driver_master(DRIVER_ANY);
-		igt_require(crtc0_active(fd));
+		kmstest_set_vt_graphics_mode();
+
+		igt_display_init(&display, fd);
+		igt_display_require_output(&display);
+
+		for_each_pipe_with_valid_output(&display, pipe, output) {
+			drmModeModeInfo *mode = igt_output_get_mode(output);
+
+			igt_create_pattern_fb(fd, mode->hdisplay, mode->vdisplay,
+					      DRM_FORMAT_XRGB8888,
+					      LOCAL_DRM_FORMAT_MOD_NONE, &fb);
+
+			igt_output_set_pipe(output, pipe);
+			igt_plane_set_fb(igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY), &fb);
+			break;
+		}
+
+		igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+		igt_require(kmstest_get_vblank(fd, pipe, 0));
 	}
 
 	igt_subtest("invalid-buffer")
 		test_invalid_buffer(fd);
 
 	igt_subtest("fault-buffer")
-		test_fault_buffer(fd);
+		test_fault_buffer(fd, pipe);
 
 	igt_subtest("empty-block")
 		test_empty(fd, 0, EINTR);
@@ -208,8 +214,8 @@ igt_main
 		test_empty(fd, 1, EAGAIN);
 
 	igt_subtest("short-buffer-block")
-		test_short_buffer(fd, 0);
+		test_short_buffer(fd, 0, pipe);
 
 	igt_subtest("short-buffer-nonblock")
-		test_short_buffer(fd, 1);
+		test_short_buffer(fd, 1, pipe);
 }
-- 
2.14.1

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

  parent reply	other threads:[~2017-10-13 14:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13 14:10 [PATCH] HAX: Do not restore mode through fbcon Maarten Lankhorst
2017-10-13 14:10 ` [PATCH i-g-t 1/2] tests/kms_plane_lowres: Rework tests to work without fbcon Maarten Lankhorst
2017-10-13 14:10 ` [PATCH i-g-t] tests/pm_backlight: Enable connected output to allow tests to succeed, v2 Maarten Lankhorst
2017-10-13 14:58   ` [PATCH i-g-t] tests/kms_plane_lowres: Rework tests to work without fbcon Maarten Lankhorst
2017-10-23 10:05     ` Mika Kahola
2017-10-23 10:14       ` Maarten Lankhorst
2017-10-13 14:10 ` Maarten Lankhorst [this message]
2017-10-13 14:22   ` [PATCH i-g-t 2/2] tests/drm_read: Change tests to not require fbcon Chris Wilson
2017-10-16  7:40     ` Maarten Lankhorst
2017-10-13 16:44 ` ✗ Fi.CI.BAT: failure for HAX: Do not restore mode through fbcon (rev2) Patchwork
2017-10-13 19:06 ` ✗ Fi.CI.BAT: warning for tests/pm_backlight: Enable connected output to allow tests to succeed, v2. (rev2) Patchwork
2017-10-20 14:12 ` ✗ Fi.CI.BAT: failure for HAX: Do not restore mode through fbcon (rev2) Patchwork
2017-10-20 15:07 ` Patchwork
2017-10-20 15:17 ` ✗ Fi.CI.IGT: " Patchwork
2017-10-20 17:08 ` Patchwork
2017-10-21 12:53 ` ✗ Fi.CI.BAT: " Patchwork
2017-10-21 13:43 ` ✗ Fi.CI.IGT: " Patchwork

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=20171013141049.5242-4-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.