[PATCH i-g-t] tests/kms_plane_lowres: Add DRM_MODE_ATOMIC_ALLOW_MODESET test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When doing a full atomic modeset, kernel should fail if the flag
DRM_MODE_ATOMIC_ALLOW_MODESET is not set. Let's add this test as part of
'kms_plane_lowres' testset. The testcases are 'pipe-x-allow-modeset' where
x stands for pipe in question.

For: VIZ-6955

Signed-off-by: Mika Kahola <mika.kahola@xxxxxxxxx>
---
 tests/kms_plane_lowres.c | 51 +++++++++++++++++++++++++++++++++++-------------
 1 file changed, 37 insertions(+), 14 deletions(-)

diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
index 689c248..a127124 100644
--- a/tests/kms_plane_lowres.c
+++ b/tests/kms_plane_lowres.c
@@ -142,12 +142,16 @@ test_fini(data_t *data, igt_output_t *output)
 }
 
 static int
-display_commit_mode(data_t *data, enum pipe pipe, int flags, igt_crc_t *crc)
+display_commit_mode(data_t *data, enum pipe pipe, bool test_modeset, igt_crc_t *crc)
 {
 	char buf[256];
 	struct drm_event *e = (void *)buf;
 	unsigned int vblank_start, vblank_stop;
 	int n, ret;
+	int flags = DRM_MODE_PAGE_FLIP_EVENT;
+
+	if (!test_modeset)
+		flags |= DRM_MODE_ATOMIC_ALLOW_MODESET;
 
 	vblank_start = kmstest_get_vblank(data->display.drm_fd, pipe,
 					  DRM_VBLANK_NEXTONMISS);
@@ -155,6 +159,9 @@ display_commit_mode(data_t *data, enum pipe pipe, int flags, igt_crc_t *crc)
 	ret = igt_display_try_commit_atomic(&data->display,
 					    flags,
 					    NULL);
+	if (test_modeset)
+		return ret;
+
 	igt_skip_on(ret != 0);
 
 	igt_set_timeout(1, "Stuck on page flip");
@@ -181,8 +188,7 @@ check_mode(drmModeModeInfo *mode1, drmModeModeInfo *mode2)
 }
 
 static drmModeModeInfo *
-test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags,
-	   igt_output_t *output)
+test_setup(data_t *data, enum pipe pipe, uint64_t modifier, igt_output_t *output)
 {
 	struct kmstest_crtc crtc;
 	drmModeModeInfo *mode;
@@ -238,21 +244,21 @@ test_setup(data_t *data, enum pipe pipe, uint64_t modifier, int flags,
 
 static void
 test_plane_position_with_output(data_t *data, enum pipe pipe,
-				igt_output_t *output, uint64_t modifier)
+				igt_output_t *output, uint64_t modifier,
+				bool test_modeset)
 {
 	igt_crc_t *crc_hires1, *crc_hires2;
 	igt_crc_t *crc_lowres;
 	drmModeModeInfo mode_lowres;
 	drmModeModeInfo *mode1, *mode2, *mode3;
 	int ret, n;
-	int flags = DRM_MODE_PAGE_FLIP_EVENT | DRM_MODE_ATOMIC_ALLOW_MODESET;
 
 	igt_info("Testing connector %s using pipe %s\n",
 		 igt_output_name(output), kmstest_pipe_name(pipe));
 
 	test_init(data, pipe);
 
-	mode1 = test_setup(data, pipe, modifier, flags, output);
+	mode1 = test_setup(data, pipe, modifier, output);
 
 	mode_lowres = get_lowres_mode(data->drm_fd, mode1);
 
@@ -273,7 +279,12 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	check_mode(&mode_lowres, mode2);
 
-	display_commit_mode(data, pipe, flags, crc_lowres);
+	ret = display_commit_mode(data, pipe, test_modeset, crc_lowres);
+
+	if (test_modeset) {
+		igt_assert(ret != 0);
+		goto out;
+	}
 
 	igt_assert_plane_visible(pipe, false);
 
@@ -285,17 +296,24 @@ test_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	check_mode(mode1, mode3);
 
-	display_commit_mode(data, pipe, flags, crc_hires2);
+	ret = display_commit_mode(data, pipe, test_modeset, crc_hires2);
+
+	if (test_modeset) {
+		igt_assert(ret != 0);
+		goto out;
+	}
 
 	igt_assert_plane_visible(pipe, true);
 
+out:
 	igt_pipe_crc_stop(data->pipe_crc);
 
 	test_fini(data, output);
 }
 
 static void
-test_plane_position(data_t *data, enum pipe pipe, uint64_t modifier)
+test_plane_position(data_t *data, enum pipe pipe, uint64_t modifier,
+		    bool test_modeset)
 {
 	igt_output_t *output;
 	int connected_outs;
@@ -310,7 +328,8 @@ test_plane_position(data_t *data, enum pipe pipe, uint64_t modifier)
 
 	connected_outs = 0;
 	for_each_valid_output_on_pipe(&data->display, pipe, output) {
-		test_plane_position_with_output(data, pipe, output, modifier);
+		test_plane_position_with_output(data, pipe, output, modifier,
+						test_modeset);
 		connected_outs++;
 	}
 
@@ -322,19 +341,23 @@ run_tests_for_pipe(data_t *data, enum pipe pipe)
 {
 	igt_subtest_f("pipe-%s-tiling-none",
 		      kmstest_pipe_name(pipe))
-		test_plane_position(data, pipe, LOCAL_DRM_FORMAT_MOD_NONE);
+		test_plane_position(data, pipe, LOCAL_DRM_FORMAT_MOD_NONE, false);
 
 	igt_subtest_f("pipe-%s-tiling-x",
 		      kmstest_pipe_name(pipe))
-		test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_X_TILED);
+		test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_X_TILED, false);
 
 	igt_subtest_f("pipe-%s-tiling-y",
 		      kmstest_pipe_name(pipe))
-		test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_Y_TILED);
+		test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_Y_TILED, false);
 
 	igt_subtest_f("pipe-%s-tiling-yf",
 		      kmstest_pipe_name(pipe))
-		test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_Yf_TILED);
+		test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_Yf_TILED, false);
+
+	igt_subtest_f("pipe-%s-allow-modeset",
+		      kmstest_pipe_name(pipe))
+		test_plane_position(data, pipe, LOCAL_I915_FORMAT_MOD_X_TILED, true);
 }
 
 static data_t data;
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux