Skip to contentSkip to conversation

tests/kms_cursor_legacy: Rework the 2x tests.

PATCH New Maarten Lankhorst 2 participants 3 messages Nov 16, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/kms_cursor_legacy: Rework the 2x tests.

Instead of strictly measuring vblanks, we try to see if a page flip is queued on the next vblank if we run legacy cursor updates to the pipe and another pipe in the background.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101634

---
 tests/kms_cursor_legacy.c | 90 ++++++++++++++++++++++++++++-------------------
 1 file changed, 54 insertions(+), 36 deletions(-)
tests/kms_cursor_legacy.c +54 -36
index 5720dbef90d3..b8b15b609d7f 100644
@@ -884,14 +884,23 @@ cleanup:
 
 static void two_screens_flip_vs_cursor(igt_display_t *display, int nloops, bool modeset, bool atomic)
 {
-	struct drm_mode_cursor arg[2], arg2[2];
-	struct drm_event_vblank vbl;
+	struct drm_mode_cursor arg1[2], arg2[2];
 	struct igt_fb fb_info, fb2_info, cursor_fb;
-	unsigned vblank_start;
 	enum pipe pipe = find_connected_pipe(display, false);
 	enum pipe pipe2 = find_connected_pipe(display, true);
 	igt_output_t *output, *output2;
 	bool skip_test = false;
+	volatile unsigned long *shared;
+
+	if (modeset) {
+		uint64_t val;
+
+		igt_fail_on(!atomic);
+		igt_assert(drmGetCap(display->drm_fd, DRM_CAP_CRTC_IN_VBLANK_EVENT, &val) == 0);
+	}
+
+	shared = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+	igt_assert(shared != MAP_FAILED);
 
 	igt_fail_on(modeset && !atomic);
 
@@ -903,9 +912,9 @@ static void two_screens_flip_vs_cursor(igt_display_t *display, int nloops, bool
 
 	igt_create_color_fb(display->drm_fd, 64, 64, DRM_FORMAT_ARGB8888, 0, 1., 1., 1., &cursor_fb);
 	set_cursor_on_pipe(display, pipe, &cursor_fb);
-	populate_cursor_args(display, pipe, arg, &cursor_fb);
+	populate_cursor_args(display, pipe, arg1, &cursor_fb);
 
-	arg[1].x = arg[1].y = 192;
+	arg1[1].x = arg1[1].y = 192;
 
 	set_cursor_on_pipe(display, pipe2, &cursor_fb);
 	populate_cursor_args(display, pipe2, arg2, &cursor_fb);
@@ -917,29 +926,29 @@ static void two_screens_flip_vs_cursor(igt_display_t *display, int nloops, bool
 
 	igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
 
-	vblank_start = get_vblank(display->drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
-	igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
-	do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg[0]);
-	do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg2[0]);
-	igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
+	igt_fork(child, 2) {
+		struct drm_mode_cursor *arg = child ? arg2 : arg1;
+
+		while (!shared[0])
+			do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR,
+				 &arg[!shared[1]]);
+	}
 
 	while (nloops--) {
-		/* Start with a synchronous query to align with the vblank */
-		vblank_start = get_vblank(display->drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
-		do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg[nloops & 1]);
+		unsigned vblank_start =
+			get_vblank(display->drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
+
+		shared[1] = nloops & 1;
+
+		if (!modeset) {
+			flip_nonblocking(display, pipe, atomic, &fb_info);
+		} else {
+			unsigned flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
+			flags |= DRM_MODE_ATOMIC_NONBLOCK | DRM_MODE_PAGE_FLIP_EVENT;
 
-		if (!modeset)
-			flip_nonblocking(display, pipe, false, &fb_info);
-		else {
 			/*
-			 * There are 2 design issues that prevent us from doing
-			 * the test we would like here:
-			 *
-			 * - drm_event_vblank doesn't set crtc_id, so if we
-			 *   use events we don't know which pipe fired the event,
-			 *   no way to distinguish.
-			 * - Doing a modeset may add unrelated pipes, and fail with
-			 *   -EBUSY if a page flip is queued on one of those.
+			 * Doing a modeset may add unrelated pipes, and fail with
+			 * -EBUSY if a page flip is queued on one of those.
 			 *
 			 * Work around it by not setting an event, but doing a synchronous
 			 * commit to wait for completion, and queue the page flip and modeset
@@ -948,26 +957,32 @@ static void two_screens_flip_vs_cursor(igt_display_t *display, int nloops, bool
 
 			igt_plane_set_fb(igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY), &fb_info);
 			igt_output_set_pipe(output2, (nloops & 1) ? PIPE_NONE : pipe2);
-			igt_display_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_ATOMIC_NONBLOCK, NULL);
+			igt_display_commit_atomic(display, flags, NULL);
 		}
 
-		igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
-
-		do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg[nloops & 1]);
 		if (!modeset) {
-			do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg2[nloops & 1]);
-			do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg[nloops & 1]);
-			do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg2[nloops & 1]);
-
-			igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
+			struct drm_event_vblank vbl;
 
 			igt_set_timeout(1, "Stuck page flip");
+
 			igt_ignore_warn(read(display->drm_fd, &vbl, sizeof(vbl)));
-			igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start + 1);
-			igt_reset_timeout();
+			igt_assert(vbl.crtc_id == display->pipes[pipe].crtc_id);
+			igt_assert(vbl.sequence == vblank_start + 1);
 		} else {
-			do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg2[nloops & 1]);
+			struct drm_event_vblank vbl, vbl2;
+
+			igt_set_timeout(35, "Stuck nonblocking modeset");
+
+			igt_ignore_warn(read(display->drm_fd, &vbl, sizeof(vbl)));
+			igt_ignore_warn(read(display->drm_fd, &vbl2, sizeof(vbl2)));
+
+			igt_assert(vbl.crtc_id != vbl2.crtc_id);
+			igt_assert(vbl.crtc_id == display->pipes[pipe].crtc_id ||
+				   vbl.crtc_id == display->pipes[pipe2].crtc_id);
+			igt_assert(vbl2.crtc_id == display->pipes[pipe].crtc_id ||
+				   vbl2.crtc_id == display->pipes[pipe2].crtc_id);
 		}
+		igt_reset_timeout();
 
 		if (modeset) {
 			/* wait for pending modeset and page flip to complete, to prevent -EBUSY */
@@ -977,6 +992,9 @@ static void two_screens_flip_vs_cursor(igt_display_t *display, int nloops, bool
 		}
 	}
 
+	shared[0] = 1;
+	igt_waitchildren();
+
 cleanup:
 	do_cleanup_display(display);
 	igt_remove_fb(display->drm_fd, &fb_info);
Signature · 6 lines
2.15.0

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✓ Fi.CI.BAT: success for tests/kms_cursor_legacy: Rework the 2x tests.

== Series Details ==

== Series Details ==

Series: tests/kms_cursor_legacy: Rework the 2x tests.
URL : https://patchwork.freedesktop.org/series/33933/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 88d6550795fad3974d77e4db2f563c5e2e8872e1 Revert "tests/kms_flip: Make flip-vs-panning-vs-hang change DSPSURF"

with latest DRM-Tip kernel build CI_DRM_3352
7916df8b49cb drm-tip: 2017y-11m-15d-20h-05m-48s UTC integration manifest

No testlist changes.

Test chamelium:

        Subgroup dp-crc-fast:
                pass       -> FAIL       (fi-kbl-7500u) fdo#103163
Test kms_pipe_crc_basic:
        Subgroup suspend-read-crc-pipe-b:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713

fdo#103163 https://bugs.freedesktop.org/show_bug.cgi?id=103163
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:447s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:458s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:383s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:548s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:278s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:509s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:509s
fi-byt-j1900     total:289  pass:254  dwarn:0   dfail:0   fail:0   skip:35  time:506s
fi-byt-n2820     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:498s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:434s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:262s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:542s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:432s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:441s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:431s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:483s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:464s
fi-kbl-7500u     total:289  pass:263  dwarn:1   dfail:0   fail:1   skip:24  time:475s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:528s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:477s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:537s
fi-skl-6260u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:455s
fi-skl-6600u     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:549s
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:566s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:520s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:501s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:460s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:569s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:425s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_508/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

✗ Fi.CI.IGT: warning for tests/kms_cursor_legacy: Rework the 2x tests.

In reply to Maarten Lankhorst
== Series Details ==

== Series Details ==

Series: tests/kms_cursor_legacy: Rework the 2x tests.
URL : https://patchwork.freedesktop.org/series/33933/
State : warning

== Summary ==

Test kms_chv_cursor_fail:

        Subgroup pipe-c-128x128-bottom-edge:
                skip       -> PASS       (shard-hsw)
        Subgroup pipe-a-256x256-bottom-edge:
                skip       -> PASS       (shard-hsw)
Test kms_setmode:
        Subgroup basic:
                pass       -> FAIL       (shard-hsw) fdo#99912
Test drv_module_reload:
        Subgroup basic-reload-inject:
                dmesg-warn -> PASS       (shard-hsw) fdo#102707
Test kms_concurrent:
        Subgroup pipe-c:
                skip       -> PASS       (shard-hsw)
Test kms_plane:
        Subgroup plane-panning-bottom-right-suspend-pipe-c-planes:
                fail       -> PASS       (shard-hsw) fdo#103375
        Subgroup plane-panning-bottom-right-suspend-pipe-a-planes:
                fail       -> PASS       (shard-snb) fdo#102365
Test kms_cursor_legacy:
        Subgroup short-flip-before-cursor-toggle:
                pass       -> SKIP       (shard-hsw)
        Subgroup flip-vs-cursor-toggle:
                skip       -> PASS       (shard-hsw) fdo#102670
Test kms_flip:
        Subgroup plain-flip-fb-recreate-interruptible:
                pass       -> FAIL       (shard-hsw) fdo#100368
        Subgroup rcs-wf_vblank-vs-dpms-interruptible:
                dmesg-warn -> PASS       (shard-hsw) fdo#102614
Test kms_busy:
        Subgroup extended-modeset-hang-newfb-with-reset-render-b:
                dmesg-warn -> PASS       (shard-hsw) fdo#103038
        Subgroup extended-modeset-hang-newfb-with-reset-render-a:
                dmesg-warn -> PASS       (shard-hsw) fdo#102249
Test kms_vblank:
        Subgroup wait-busy:
                skip       -> PASS       (shard-hsw)
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-indfb-draw-mmap-wc:
                skip       -> PASS       (shard-hsw)
        Subgroup fbc-1p-offscren-pri-shrfb-draw-render:
                fail       -> PASS       (shard-snb) fdo#101623
Test pm_rpm:
        Subgroup gem-mmap-cpu:
                skip       -> PASS       (shard-hsw)

fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#102707 https://bugs.freedesktop.org/show_bug.cgi?id=102707
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#102365 https://bugs.freedesktop.org/show_bug.cgi?id=102365
fdo#102670 https://bugs.freedesktop.org/show_bug.cgi?id=102670
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#103038 https://bugs.freedesktop.org/show_bug.cgi?id=103038
fdo#102249 https://bugs.freedesktop.org/show_bug.cgi?id=102249
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623

shard-hsw        total:2584 pass:1470 dwarn:2   dfail:1   fail:11  skip:1100 time:9468s
shard-snb        total:2584 pass:1259 dwarn:2   dfail:1   fail:11  skip:1311 time:7994s

Blacklisted hosts:
shard-apl total:2584 pass:1622 dwarn:1 dfail:2 fail:23 skip:936 time:13319s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_508/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx