Skip to contentSkip to conversation

tests/kms_plane_lowres: Add DRM_MODE_ATOMIC_ALLOW_MODESET test

PATCH Superseded Mika Kahola 2 participants 4 messages Feb 7, 2017 – Mar 8, 2017

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/kms_plane_lowres: Add DRM_MODE_ATOMIC_ALLOW_MODESET test

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

---
 tests/kms_plane_lowres.c | 51 +++++++++++++++++++++++++++++++++++-------------
 1 file changed, 37 insertions(+), 14 deletions(-)
tests/kms_plane_lowres.c +37 -14
index 689c248..a127124 100644
@@ -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;
Signature · 6 lines
2.7.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

Hey,

Op 07-02-17 om 14:33 schreef Mika Kahola:

Quoted 6 lines

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

I think it makes sense for this to be a standalone test, kms_atomic_allow_modeset. igt_display

It should be trying the following:

0. Add a way to control the active property to lib/igt_kms.c either auto (backwards compatible), off or on.
1. Toggling the active property only, with and without mode set. (Testing active_changed vs modeset flag)
2. With the active property set to disabled (dpms off), try to set and unset the mode. (Testing mode_changed vs modeset flag)
3. Try swapping connectors on a crtc. (Testing connectors_changed vs modeset flag)

With and without TEST_ONLY. :)

I think that makes more sense than changing a unrelated test.

Cheers,
~Maarten
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 27 lines · Maarten Lankhorst

Hey,

Op 07-02-17 om 14:33 schreef Mika Kahola:

Quoted 9 lines

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

I think it makes sense for this to be a standalone test, kms_atomic_allow_modeset.
igt_display

It should be trying the following:

0. Add a way to control the active property to lib/igt_kms.c either auto (backwards compatible), off or on.
1. Toggling the active property only, with and without mode set. (Testing active_changed vs modeset flag)
2. With the active property set to disabled (dpms off), try to set and unset the mode. (Testing mode_changed vs modeset flag)
3. Try swapping connectors on a crtc. (Testing connectors_changed vs modeset flag)

Quoted 1 line

With and without TEST_ONLY. :)

Thanks Maarten for review. I guess it's back to the drawing board then :)

I could change the test as a standalone one that tests DRM_MODE_ATOMIC_ALLOW_MODESET flag with dpms on/off.

Quoted 5 lines

I think that makes more sense than changing a unrelated test.

Cheers,
~Maarten

Signature · 6 lines
Mika Kahola - Intel OTC

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Op 08-03-17 om 14:45 schreef Mika Kahola:

Quoted 27 lines · Maarten Lankhorst
Quoted 26 lines

Hey,

Op 07-02-17 om 14:33 schreef Mika Kahola:

Quoted 8 lines

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

I think it makes sense for this to be a standalone test, kms_atomic_allow_modeset.
igt_display

It should be trying the following:

0. Add a way to control the active property to lib/igt_kms.c either auto (backwards compatible), off or on.
1. Toggling the active property only, with and without mode set. (Testing active_changed vs modeset flag)
2. With the active property set to disabled (dpms off), try to set and unset the mode. (Testing mode_changed vs modeset flag)
3. Try swapping connectors on a crtc. (Testing connectors_changed vs modeset flag)

Quoted 6 lines
Quoted 1 line

With and without TEST_ONLY. :)

Thanks Maarten for review. I guess it's back to the drawing board then :)

I could change the test as a standalone one that tests DRM_MODE_ATOMIC_ALLOW_MODESET flag with dpms on/off.

No problem, fortunately adding standalone atomic tests is easy with the igt_display framework! :)
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx