[i-g-t] kms_rotation_crc: Test 90 and 270 degree rotation in sequence
diff mbox

Message ID 1438780989-4067-1-git-send-email-tvrtko.ursulin@linux.intel.com
State New
Headers show

Commit Message

Tvrtko Ursulin Aug. 5, 2015, 1:23 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Sounds like a useful thing to test going straight from 90 to 270 degrees,
without resetting to no rotation in between. 

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 tests/kms_rotation_crc.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

Patch
diff mbox

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 3fd77c42b803..5e32eb6911b2 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -36,8 +36,10 @@  typedef struct {
 	struct igt_fb fb;
 	struct igt_fb fb_modeset;
 	igt_crc_t ref_crc;
+	igt_crc_t ref_crc2;
 	igt_pipe_crc_t *pipe_crc;
 	igt_rotation_t rotation;
+	igt_rotation_t rotation2;
 	int pos_x;
 	int pos_y;
 	unsigned int w, h;
@@ -174,6 +176,12 @@  static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	commit_crtc(data, output, plane);
 	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
 
+	if (data->rotation2 != IGT_ROTATION_0) {
+		paint_squares(data, mode, data->rotation2, plane);
+		commit_crtc(data, output, plane);
+		igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc2);
+	}
+
 	/*
 	 * Step 2: prepare the plane with an non-rotated fb let the hw
 	 * rotate it.
@@ -249,6 +257,21 @@  static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 						     &crc_output);
 			}
 
+			if (data->rotation2 != IGT_ROTATION_0) {
+				igt_plane_set_rotation(plane, data->rotation2);
+				ret = igt_display_try_commit2(display, commit);
+				if (data->override_fmt ||
+				    data->override_tiling) {
+					igt_assert(ret == -EINVAL);
+				} else {
+					igt_assert(ret == 0);
+					igt_pipe_crc_collect_crc(data->pipe_crc,
+								 &crc_output);
+					igt_assert_crc_equal(&data->ref_crc2,
+							     &crc_output);
+				}
+			}
+
 			/*
 			 * check the rotation state has been reset when the VT
 			 * mode is restored
@@ -284,7 +307,10 @@  igt_main
 		igt_require_pipe_crc();
 
 		igt_display_init(&data.display, data.gfx_fd);
+
+		data.rotation2 = IGT_ROTATION_0;
 	}
+
 	igt_subtest_f("primary-rotation-180") {
 		data.rotation = IGT_ROTATION_180;
 		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
@@ -312,9 +338,17 @@  igt_main
 		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
 	}
 
+	igt_subtest_f("primary-rotation-90-270") {
+		igt_require(gen >= 9);
+		data.rotation = IGT_ROTATION_90;
+		data.rotation2 = IGT_ROTATION_270;
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+	}
+
 	igt_subtest_f("sprite-rotation-90") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_90;
+		data.rotation2 = IGT_ROTATION_0;
 		test_plane_rotation(&data, IGT_PLANE_2);
 	}
 
@@ -324,9 +358,17 @@  igt_main
 		test_plane_rotation(&data, IGT_PLANE_2);
 	}
 
+	igt_subtest_f("sprite-rotation-90-270") {
+		igt_require(gen >= 9);
+		data.rotation = IGT_ROTATION_90;
+		data.rotation2 = IGT_ROTATION_270;
+		test_plane_rotation(&data, IGT_PLANE_2);
+	}
+
 	igt_subtest_f("sprite-rotation-90-pos-100-0") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_90;
+		data.rotation2 = IGT_ROTATION_0;
 		data.pos_x = 100,
 		data.pos_y = 0;
 		test_plane_rotation(&data, IGT_PLANE_2);