From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_legacy: Add subtest to verify cursor update state.
Date: Tue, 20 Mar 2018 14:55:16 +0100 [thread overview]
Message-ID: <20180320135517.53673-1-maarten.lankhorst@linux.intel.com> (raw)
Instead of doing a DPMS/suspend-resume cycle to verify state, we should
be able to verify by comparing atomic state with what we set.
This will obsolete the suspend/resume and dpms tests in kms_cursor_crc,
which saves us about 5 minutes.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
tests/kms_cursor_legacy.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index d0a28b3c442c..771e501e5ce0 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -1355,6 +1355,81 @@ static void flip_vs_cursor_busy_crc(igt_display_t *display, bool atomic)
igt_remove_fb(display->drm_fd, &cursor_fb);
}
+static void verify_cursor_parameters(igt_display_t *display)
+{
+ struct drm_mode_cursor arg[2];
+ struct igt_fb fb_info, cursor_fb, cursor_fb2;
+ enum pipe pipe = find_connected_pipe(display, false);
+ igt_pipe_t *pipe_obj = &display->pipes[pipe];
+ igt_plane_t *cursor = igt_pipe_get_plane_type(pipe_obj, DRM_PLANE_TYPE_CURSOR);
+ drmModePlane *drm_cursor;
+
+ /* Must support universal plane API for cursor plane for this test. */
+ igt_require(cursor->drm_plane);
+ 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);
+ igt_create_color_fb(display->drm_fd, 64, 64, DRM_FORMAT_ARGB8888, 0, .5, .5, .5, &cursor_fb2);
+
+ igt_plane_set_fb(cursor, &cursor_fb);
+ populate_cursor_args(display, pipe, arg, &cursor_fb);
+
+ igt_display_commit2(display, display->is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY);
+
+ /* Move Cursor with legacy cursor move. */
+ do_ioctl(display->drm_fd, DRM_IOCTL_MODE_CURSOR, arg);
+
+ drm_cursor = drmModeGetPlane(display->drm_fd, cursor->drm_plane->plane_id);
+ igt_assert(drm_cursor);
+
+ igt_assert_eq(drm_cursor->crtc_id, pipe_obj->crtc_id);
+ if (display->is_atomic) {
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_FB_ID), cursor_fb.fb_id);
+
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_SRC_X), 0);
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_SRC_Y), 0);
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_SRC_W), IGT_FIXED(cursor_fb.width, 0));
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_SRC_H), IGT_FIXED(cursor_fb.height, 0));
+
+ /* Make sure legacy cursor move overwriting atomic pos (0,0) is picked up. */
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_CRTC_X), arg->x);
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_CRTC_Y), arg->y);
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_CRTC_W), cursor_fb.width);
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_CRTC_H), cursor_fb.height);
+
+ /* COMMIT_ATOMIC specifies the fb id, do a strict check. */
+ igt_assert_eq(drm_cursor->fb_id, cursor_fb.fb_id);
+ } else {
+ /* Legacy cursor ioctl generates a new fb id */
+ igt_assert(drm_cursor->fb_id);
+ }
+ drmModeFreePlane(drm_cursor);
+
+ /* Use setplane API. */
+ igt_plane_set_fb(cursor, &cursor_fb2);
+ igt_plane_set_position(cursor, 1, 2);
+ igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+ drm_cursor = drmModeGetPlane(display->drm_fd, cursor->drm_plane->plane_id);
+ igt_assert(drm_cursor);
+
+ /* SetPlane specifies the fb id, do a strict check. */
+ igt_assert_eq(drm_cursor->fb_id, cursor_fb2.fb_id);
+
+ /* And compare atomic properties, to make sure the change sticks. */
+ if (display->is_atomic) {
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_FB_ID), cursor_fb2.fb_id);
+
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_CRTC_X), 1);
+ igt_assert_eq(igt_plane_get_prop(cursor, IGT_PLANE_CRTC_Y), 2);
+ }
+ drmModeFreePlane(drm_cursor);
+
+ igt_remove_fb(display->drm_fd, &cursor_fb2);
+ igt_remove_fb(display->drm_fd, &cursor_fb);
+ igt_remove_fb(display->drm_fd, &fb_info);
+}
+
igt_main
{
const int ncpus = sysconf(_SC_NPROCESSORS_ONLN);
@@ -1458,6 +1533,9 @@ igt_main
igt_subtest("flip-vs-cursor-busy-crc-atomic")
flip_vs_cursor_busy_crc(&display, true);
+ igt_subtest("verify-cursor-parameters")
+ verify_cursor_parameters(&display);
+
for (i = 0; i <= flip_test_last; i++) {
const char *modes[flip_test_last+1] = {
"legacy",
--
2.16.2
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2018-03-20 13:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-20 13:55 Maarten Lankhorst [this message]
2018-03-20 13:55 ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_cursor_crc: Remove DPMS/suspend tests Maarten Lankhorst
2018-03-20 17:30 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] tests/kms_cursor_legacy: Add subtest to verify cursor update state Patchwork
2018-03-20 21:08 ` [igt-dev] ✗ Fi.CI.IGT: failure " 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=20180320135517.53673-1-maarten.lankhorst@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=igt-dev@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