[igt-dev] [PATCH i-g-t 1/2] tests/kms_cursor_legacy: Add subtest to verify cursor update state.
Maarten Lankhorst
maarten.lankhorst at linux.intel.com
Tue Mar 20 13:55:16 UTC 2018
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 at 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
More information about the igt-dev
mailing list