summaryrefslogtreecommitdiff
path: root/tests/kms_cursor_legacy.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2016-09-07 17:00:39 +0200
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2016-09-08 12:20:23 +0200
commit4fb21789eb0f04a61033c85d2888db0e904716c2 (patch)
tree1849362242fc467b0ab3de64ea437c14bae9e750 /tests/kms_cursor_legacy.c
parente4d74f2981a8a48f31674ea51b5b58287ce01c13 (diff)
kms_cursor_legacy: Add cursor crc tests.
On skylake there's a add_all_affected_planes call that will make atomic commit use the old cursor state. Add a test that first does a page flip then cursor update to expose the issue. The test currently fails on the vblank wait, but that's a common issue affecting all the tests. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Diffstat (limited to 'tests/kms_cursor_legacy.c')
-rw-r--r--tests/kms_cursor_legacy.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index c9eef27b..373873a8 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -867,6 +867,72 @@ cleanup:
igt_skip("Nonblocking modeset is not supported by this kernel\n");
}
+static void flip_vs_cursor_crc(igt_display_t *display, bool atomic)
+{
+ struct drm_mode_cursor arg[2];
+ struct drm_event_vblank vbl;
+ struct igt_fb fb_info, cursor_fb;
+ unsigned vblank_start;
+ enum pipe pipe = find_connected_pipe(display, false);
+ igt_pipe_crc_t *pipe_crc;
+ igt_crc_t crcs[3];
+
+ if (atomic)
+ igt_require(display->is_atomic);
+
+ igt_require(set_fb_on_crtc(display, pipe, &fb_info));
+
+ igt_create_color_fb(display->drm_fd, 64, 64, DRM_FORMAT_ARGB8888, 0, 1., 1., 1., &cursor_fb);
+ populate_cursor_args(display, pipe, arg, &cursor_fb);
+
+ arg[0].flags = arg[1].flags = DRM_MODE_CURSOR_BO;
+ arg[1].handle = 0;
+ arg[1].width = arg[1].height = 0;
+
+ igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+
+ pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
+
+ /* Collect reference crc with cursor disabled. */
+ igt_pipe_crc_collect_crc(pipe_crc, &crcs[1]);
+
+ set_cursor_on_pipe(display, pipe, &cursor_fb);
+ igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+ do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg[0]);
+
+ get_vblank(display->drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
+
+ /* Collect reference crc with cursor enabled. */
+ igt_pipe_crc_collect_crc(pipe_crc, &crcs[0]);
+
+ /* Disable cursor, and immediately queue a flip. Check if resulting crc is correct. */
+ for (int i = 1; i >= 0; i--) {
+ vblank_start = get_vblank(display->drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
+
+ flip_nonblocking(display, pipe, atomic, &fb_info);
+ do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, &arg[i]);
+
+ igt_assert_eq(get_vblank(display->drm_fd, pipe, 0), vblank_start);
+
+ 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_debug("Checking for cursor %s\n", i ? "disabled" : "enabled");
+ igt_pipe_crc_collect_crc(pipe_crc, &crcs[2]);
+
+ igt_assert_crc_equal(&crcs[i], &crcs[2]);
+ }
+
+ do_cleanup_display(display);
+ igt_remove_fb(display->drm_fd, &fb_info);
+ igt_remove_fb(display->drm_fd, &cursor_fb);
+ igt_pipe_crc_free(pipe_crc);
+}
+
+
igt_main
{
const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
@@ -947,6 +1013,12 @@ igt_main
igt_subtest("2x-long-cursor-vs-nonblocking-modeset-atomic")
two_screens_cursor_vs_flip(&display, 150, true);
+ igt_subtest("flip-vs-cursor-crc-legacy")
+ flip_vs_cursor_crc(&display, false);
+
+ igt_subtest("flip-vs-cursor-crc-atomic")
+ flip_vs_cursor_crc(&display, true);
+
for (i = 0; i <= flip_test_last; i++) {
const char *modes[flip_test_last+1] = {
"legacy",