diff mbox

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

Message ID 1486474389-28854-1-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kahola Feb. 7, 2017, 1:33 p.m. UTC
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@intel.com>
---
 tests/kms_plane_lowres.c | 51 +++++++++++++++++++++++++++++++++++-------------
 1 file changed, 37 insertions(+), 14 deletions(-)

Comments

Maarten Lankhorst March 8, 2017, 12:38 p.m. UTC | #1
Hey,

Op 07-02-17 om 14:33 schreef Mika Kahola:
> 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
Mika Kahola March 8, 2017, 1:45 p.m. UTC | #2
On Wed, 2017-03-08 at 13:38 +0100, Maarten Lankhorst wrote:
> Hey,
> 
> Op 07-02-17 om 14:33 schreef Mika Kahola:
> > 
> > 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. :)

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.

> 
> I think that makes more sense than changing a unrelated test.
> 
> Cheers,
> ~Maarten
Maarten Lankhorst March 8, 2017, 2:01 p.m. UTC | #3
Op 08-03-17 om 14:45 schreef Mika Kahola:
> On Wed, 2017-03-08 at 13:38 +0100, Maarten Lankhorst wrote:
>> Hey,
>>
>> Op 07-02-17 om 14:33 schreef Mika Kahola:
>>> 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. :)
> 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! :)
diff mbox

Patch

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;