Skip to contentSkip to conversation

Validate TEST_ONLY correctness against full atomic commit

PATCH Superseded Mika Kahola 2 participants 11 messages Dec 30, 2016 – Jan 23, 2017 1 message not in the archive

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Validate TEST_ONLY correctness against full atomic commit

This test case adds TEST_ONLY flag to the following test cases to test atomic commit correctness.

- kms_plane_multiple
- kms_atomic_transitions
- kms_plane_scaling
- kms_rotation_crc

The test randomly selects one of the above test cases and tests atomic commit. If the test fails with TEST_ONLY flag the real deal atomic commit is executed and the outcome is verified.

For: VIZ-6956

Mika Kahola (5):
tests/kms_plane_multiple: Add TEST_ONLY flag tests/kms_atomic_transition: Add TEST_ONLY flag tests/kms_plane_scaling: Add TEST_ONLY flag tests/kms_rotation_crc: Add TEST_ONLY flag tests/kms_test_only: Validate TEST_ONLY correctness against full
atomic commit

 tests/Makefile.sources        |   1 +
 tests/kms_atomic_transition.c | 227 ++++++++++++++-------
 tests/kms_plane_multiple.c    |  79 +++++---
 tests/kms_plane_scaling.c     | 152 ++++++++++++--
 tests/kms_rotation_crc.c      | 282 ++++++++++++++++++++------
 tests/kms_test_only.c         | 455 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 1014 insertions(+), 182 deletions(-)
 create mode 100644 tests/kms_test_only.c
Signature · 6 lines
2.7.4

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

PATCH 1/5 tests/kms_plane_multiple: Add TEST_ONLY flag

Add TEST_ONLY flag to test atomic modesetting commits without actual real-life commit.

---
 tests/kms_plane_multiple.c | 79 ++++++++++++++++++++++++++++------------------
 1 file changed, 49 insertions(+), 30 deletions(-)
tests/kms_plane_multiple.c +49 -30
index 5e12be4..1a77a38 100644
@@ -61,10 +61,12 @@ struct {
 	int iterations;
 	bool user_seed;
 	int seed;
+	bool test_only;
 } opt = {
 	.iterations = 64,
 	.user_seed = false,
 	.seed = 1,
+	.test_only = false,
 };
 
 static inline uint32_t pipe_select(int pipe)
@@ -228,7 +230,7 @@ prepare_planes(data_t *data, enum pipe pipe, color_t *color,
 static void
 test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 				       igt_output_t *output, int max_planes,
-				       uint64_t tiling)
+				       uint64_t tiling, bool test_only)
 {
 	char buf[256];
 	struct drm_event *e = (void *)buf;
@@ -240,6 +242,12 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 	int iterations = opt.iterations < 1 ? 1 : opt.iterations;
 	bool loop_forever;
 	char info[256];
+	int flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
+
+	if (test_only)
+		flags |= DRM_MODE_ATOMIC_TEST_ONLY;
+	else
+		flags |= DRM_MODE_PAGE_FLIP_EVENT;
 
 	if (opt.iterations == LOOP_FOREVER) {
 		loop_forever = true;
@@ -256,8 +264,9 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	test_init(data, pipe);
 
-	test_grab_crc(data, output, pipe, true, &blue, tiling,
-		      &test.reference_crc);
+	if (!test_only)
+		test_grab_crc(data, output, pipe, true, &blue, tiling,
+			      &test.reference_crc);
 
 	i = 0;
 	while (i < iterations || loop_forever) {
@@ -265,24 +274,27 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 
 		vblank_start = get_vblank(data->display.drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
 
-		igt_display_commit_atomic(&data->display,
-					  DRM_MODE_PAGE_FLIP_EVENT,
-					  &data->display);
+		ret = igt_display_try_commit_atomic(&data->display,
+						    flags,
+						    &data->display);
+		igt_assert(ret != -EINVAL);
 
-		igt_set_timeout(1, "Stuck on page flip");
+		if (!test_only) {
+			igt_set_timeout(1, "Stuck on page flip");
 
-		ret = read(data->display.drm_fd, buf, sizeof(buf));
-		igt_assert(ret >= 0);
+			ret = read(data->display.drm_fd, buf, sizeof(buf));
+			igt_assert(ret >= 0);
 
-		igt_assert_eq(get_vblank(data->display.drm_fd, pipe, 0), vblank_start + 1);
-		igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
-		igt_reset_timeout();
+			igt_assert_eq(get_vblank(data->display.drm_fd, pipe, 0), vblank_start + 1);
+			igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
+			igt_reset_timeout();
 
-		n = igt_pipe_crc_get_crcs(data->pipe_crc, MAX_CRCS, &crc);
+			n = igt_pipe_crc_get_crcs(data->pipe_crc, MAX_CRCS, &crc);
 
-		igt_assert_eq(n, MAX_CRCS);
+			igt_assert_eq(n, MAX_CRCS);
 
-		igt_assert_crc_equal(&test.reference_crc, crc);
+			igt_assert_crc_equal(&test.reference_crc, crc);
+		}
 
 		i++;
 	}
@@ -345,7 +357,7 @@ test_legacy_plane_position_with_output(data_t *data, enum pipe pipe,
 
 static void
 test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes,
-		    uint64_t tiling)
+		    uint64_t tiling, bool test_only)
 {
 	igt_output_t *output;
 	int connected_outs;
@@ -372,7 +384,8 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes,
 			test_atomic_plane_position_with_output(data, pipe,
 							       output,
 							       max_planes,
-							       tiling);
+							       tiling,
+							       test_only);
 		else
 			test_legacy_plane_position_with_output(data, pipe,
 							       output,
@@ -387,54 +400,55 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes,
 }
 
 static void
-run_tests_for_pipe_plane(data_t *data, enum pipe pipe, int max_planes)
+run_tests_for_pipe_plane(data_t *data, enum pipe pipe, int max_planes,
+			 bool test_only)
 {
 	igt_subtest_f("legacy-pipe-%s-tiling-none-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_DRM_FORMAT_MOD_NONE);
+				    LOCAL_DRM_FORMAT_MOD_NONE, test_only);
 
 	igt_subtest_f("atomic-pipe-%s-tiling-none-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_X_TILED);
+				    LOCAL_I915_FORMAT_MOD_X_TILED, test_only);
 
 	igt_subtest_f("legacy-pipe-%s-tiling-x-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_I915_FORMAT_MOD_X_TILED);
+				    LOCAL_I915_FORMAT_MOD_X_TILED, test_only);
 
 	igt_subtest_f("atomic-pipe-%s-tiling-x-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_X_TILED);
+				    LOCAL_I915_FORMAT_MOD_X_TILED, test_only);
 
 	igt_subtest_f("legacy-pipe-%s-tiling-y-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Y_TILED);
+				    LOCAL_I915_FORMAT_MOD_Y_TILED, test_only);
 
 	igt_subtest_f("atomic-pipe-%s-tiling-y-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Y_TILED);
+				    LOCAL_I915_FORMAT_MOD_Y_TILED, test_only);
 
 	igt_subtest_f("legacy-pipe-%s-tiling-yf-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Yf_TILED);
+				    LOCAL_I915_FORMAT_MOD_Yf_TILED, test_only);
 
 	igt_subtest_f("atomic-pipe-%s-tiling-yf-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Yf_TILED);
+				    LOCAL_I915_FORMAT_MOD_Yf_TILED, test_only);
 }
 
 static void
-run_tests_for_pipe(data_t *data, enum pipe pipe)
+run_tests_for_pipe(data_t *data, enum pipe pipe, bool test_only)
 {
 	for (int planes = IGT_PLANE_PRIMARY; planes < IGT_MAX_PLANES; planes++)
-		run_tests_for_pipe_plane(data, pipe, planes);
+		run_tests_for_pipe_plane(data, pipe, planes, test_only);
 }
 
 static data_t data;
@@ -455,6 +469,9 @@ static int opt_handler(int option, int option_index, void *input)
 		opt.user_seed = true;
 		opt.seed = strtol(optarg, NULL, 0);
 		break;
+	case 't':
+		opt.test_only = true;
+		break;
 	default:
 		igt_assert(false);
 	}
@@ -464,13 +481,15 @@ static int opt_handler(int option, int option_index, void *input)
 
 const char *help_str =
 	"  --iterations Number of iterations for test coverage. -1 loop forever, default 64 iterations\n"
-	"  --seed       Seed for random number generator\n";
+	"  --seed       Seed for random number generator\n"
+	"  --test-only  test only atomic commit\n";
 
 int main(int argc, char *argv[])
 {
 	struct option long_options[] = {
 		{ "iterations", required_argument, NULL, 'i'},
 		{ "seed",    required_argument, NULL, 's'},
+		{ "test-only", no_argument, NULL, 't'},
 		{ 0, 0, 0, 0 }
 	};
 
@@ -489,7 +508,7 @@ int main(int argc, char *argv[])
 	}
 
 	for (int pipe = 0; pipe < I915_MAX_PIPES; pipe++)
-		run_tests_for_pipe(&data, pipe);
+		run_tests_for_pipe(&data, pipe, opt.test_only);
 
 	igt_fixture {
 		igt_display_fini(&data.display);
Signature · 6 lines
2.7.4

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

Re: [PATCH i-g-t 1/5] tests/kms_plane_multiple: Add TEST_ONLY flag

Op 30-12-16 om 13:00 schreef Mika Kahola:

Quoted 35 lines

Add TEST_ONLY flag to test atomic modesetting commits without actual real-life commit.

---
 tests/kms_plane_multiple.c | 79 ++++++++++++++++++++++++++++------------------
 1 file changed, 49 insertions(+), 30 deletions(-)
tests/kms_plane_multiple.c +3 -1
index 5e12be4..1a77a38 100644
@@ -61,10 +61,12 @@ struct {
 	int iterations;
 	bool user_seed;
 	int seed;
+	bool test_only;
 } opt = {
 	.iterations = 64,
 	.user_seed = false,
 	.seed = 1,
+	.test_only = false,
 };
 
 static inline uint32_t pipe_select(int pipe)
@@ -228,7 +230,7 @@ prepare_planes(data_t *data, enum pipe pipe, color_t *color,
 static void
 test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 				       igt_output_t *output, int max_planes,
-				       uint64_t tiling)
+				       uint64_t tiling, bool test_only)
 {
 	char buf[256];
 	struct drm_event *e = (void *)buf;

tests/kms_plane_multiple.c test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, · line 250

Quoted 9 lines
tests/kms_plane_multiple.c +6 -0
@@ -240,6 +242,12 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 	int iterations = opt.iterations < 1 ? 1 : opt.iterations;
 	bool loop_forever;
 	char info[256];
+	int flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
+
+	if (test_only)
+		flags |= DRM_MODE_ATOMIC_TEST_ONLY;
+	else
+		flags |= DRM_MODE_PAGE_FLIP_EVENT;

I would only pass ALLOW_MODESET for the TEST_ONLY case.

tests/kms_plane_multiple.c test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, · line 269

Quoted 11 lines
tests/kms_plane_multiple.c +3 -2
 	if (opt.iterations == LOOP_FOREVER) {
 		loop_forever = true;
@@ -256,8 +264,9 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 
 	test_init(data, pipe);
 
-	test_grab_crc(data, output, pipe, true, &blue, tiling,
-		      &test.reference_crc);
+	if (!test_only)
+		test_grab_crc(data, output, pipe, true, &blue, tiling,
+			      &test.reference_crc);

You still want to do some kind of pipe setup, else the state of the pipe will depend on what was set before it.

I'm not sure what you want the state to be though.

tests/kms_plane_multiple.c test_atomic_plane_position_with_output(data_t *data, enum pipe pipe, · line 280

Quoted 13 lines
tests/kms_plane_multiple.c +4 -3
 	i = 0;
 	while (i < iterations || loop_forever) {
@@ -265,24 +274,27 @@ test_atomic_plane_position_with_output(data_t *data, enum pipe pipe,
 
 		vblank_start = get_vblank(data->display.drm_fd, pipe, DRM_VBLANK_NEXTONMISS);
 
-		igt_display_commit_atomic(&data->display,
-					  DRM_MODE_PAGE_FLIP_EVENT,
-					  &data->display);
+		ret = igt_display_try_commit_atomic(&data->display,
+						    flags,
+						    &data->display);
+		igt_assert(ret != -EINVAL);

Other failures are fine? I would leave igt_display_commit_atomic here, it catches errors for you. :)

Quoted 50 lines
tests/kms_plane_multiple.c +14 -11
-		igt_set_timeout(1, "Stuck on page flip");
+		if (!test_only) {
+			igt_set_timeout(1, "Stuck on page flip");
 
-		ret = read(data->display.drm_fd, buf, sizeof(buf));
-		igt_assert(ret >= 0);
+			ret = read(data->display.drm_fd, buf, sizeof(buf));
+			igt_assert(ret >= 0);
 
-		igt_assert_eq(get_vblank(data->display.drm_fd, pipe, 0), vblank_start + 1);
-		igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
-		igt_reset_timeout();
+			igt_assert_eq(get_vblank(data->display.drm_fd, pipe, 0), vblank_start + 1);
+			igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
+			igt_reset_timeout();
 
-		n = igt_pipe_crc_get_crcs(data->pipe_crc, MAX_CRCS, &crc);
+			n = igt_pipe_crc_get_crcs(data->pipe_crc, MAX_CRCS, &crc);
 
-		igt_assert_eq(n, MAX_CRCS);
+			igt_assert_eq(n, MAX_CRCS);
 
-		igt_assert_crc_equal(&test.reference_crc, crc);
+			igt_assert_crc_equal(&test.reference_crc, crc);
+		}
 
 		i++;
 	}
@@ -345,7 +357,7 @@ test_legacy_plane_position_with_output(data_t *data, enum pipe pipe,
 
 static void
 test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes,
-		    uint64_t tiling)
+		    uint64_t tiling, bool test_only)
 {
 	igt_output_t *output;
 	int connected_outs;
@@ -372,7 +384,8 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes,
 			test_atomic_plane_position_with_output(data, pipe,
 							       output,
 							       max_planes,
-							       tiling);
+							       tiling,
+							       test_only);
 		else
 			test_legacy_plane_position_with_output(data, pipe,
 							       output,
@@ -387,54 +400,55 @@ test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes,
 }
 

tests/kms_plane_multiple.c test_plane_position(data_t *data, enum pipe pipe, bool atomic, int max_planes, · line 409

Quoted 10 lines
tests/kms_plane_multiple.c +3 -2
 static void
-run_tests_for_pipe_plane(data_t *data, enum pipe pipe, int max_planes)
+run_tests_for_pipe_plane(data_t *data, enum pipe pipe, int max_planes,
+			 bool test_only)
 {
 	igt_subtest_f("legacy-pipe-%s-tiling-none-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_DRM_FORMAT_MOD_NONE);
+				    LOCAL_DRM_FORMAT_MOD_NONE, test_only);

I'm pretty sure the legacy tests don't work with TEST_ONLY..

Quoted 69 lines
tests/kms_plane_multiple.c +13 -10
 	igt_subtest_f("atomic-pipe-%s-tiling-none-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_X_TILED);
+				    LOCAL_I915_FORMAT_MOD_X_TILED, test_only);
 
 	igt_subtest_f("legacy-pipe-%s-tiling-x-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_I915_FORMAT_MOD_X_TILED);
+				    LOCAL_I915_FORMAT_MOD_X_TILED, test_only);
 
 	igt_subtest_f("atomic-pipe-%s-tiling-x-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_X_TILED);
+				    LOCAL_I915_FORMAT_MOD_X_TILED, test_only);
 
 	igt_subtest_f("legacy-pipe-%s-tiling-y-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Y_TILED);
+				    LOCAL_I915_FORMAT_MOD_Y_TILED, test_only);
 
 	igt_subtest_f("atomic-pipe-%s-tiling-y-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Y_TILED);
+				    LOCAL_I915_FORMAT_MOD_Y_TILED, test_only);
 
 	igt_subtest_f("legacy-pipe-%s-tiling-yf-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, false, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Yf_TILED);
+				    LOCAL_I915_FORMAT_MOD_Yf_TILED, test_only);
 
 	igt_subtest_f("atomic-pipe-%s-tiling-yf-planes-%d",
 		      kmstest_pipe_name(pipe), max_planes)
 		test_plane_position(data, pipe, true, max_planes,
-				    LOCAL_I915_FORMAT_MOD_Yf_TILED);
+				    LOCAL_I915_FORMAT_MOD_Yf_TILED, test_only);
 }
 
 static void
-run_tests_for_pipe(data_t *data, enum pipe pipe)
+run_tests_for_pipe(data_t *data, enum pipe pipe, bool test_only)
 {
 	for (int planes = IGT_PLANE_PRIMARY; planes < IGT_MAX_PLANES; planes++)
-		run_tests_for_pipe_plane(data, pipe, planes);
+		run_tests_for_pipe_plane(data, pipe, planes, test_only);
 }
 
 static data_t data;
@@ -455,6 +469,9 @@ static int opt_handler(int option, int option_index, void *input)
 		opt.user_seed = true;
 		opt.seed = strtol(optarg, NULL, 0);
 		break;
+	case 't':
+		opt.test_only = true;
+		break;
 	default:
 		igt_assert(false);
 	}
@@ -464,13 +481,15 @@ static int opt_handler(int option, int option_index, void *input)
 
 const char *help_str =
 	"  --iterations Number of iterations for test coverage. -1 loop forever, default 64 iterations\n"
-	"  --seed       Seed for random number generator\n";
+	"  --seed       Seed for random number generator\n"

tests/kms_plane_multiple.c static int opt_handler(int option, int option_index, void *input) · line 494

Quoted 10 lines
tests/kms_plane_multiple.c +2 -0
+	"  --test-only  test only atomic commit\n";
 
 int main(int argc, char *argv[])
 {
 	struct option long_options[] = {
 		{ "iterations", required_argument, NULL, 'i'},
 		{ "seed",    required_argument, NULL, 's'},
+		{ "test-only", no_argument, NULL, 't'},
 		{ 0, 0, 0, 0 }
 	};

I think it's best to just list the tests twice, once normal and once with test-only in the test name?

tests/kms_plane_multiple.c int main(int argc, char *argv[]) · line 514

Quoted 9 lines
tests/kms_plane_multiple.c +1 -1
@@ -489,7 +508,7 @@ int main(int argc, char *argv[])
 	}
 
 	for (int pipe = 0; pipe < I915_MAX_PIPES; pipe++)
-		run_tests_for_pipe(&data, pipe);
+		run_tests_for_pipe(&data, pipe, opt.test_only);
 
 	igt_fixture {
 		igt_display_fini(&data.display);

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

#3 lore raw

PATCH 2/5 tests/kms_atomic_transition: Add TEST_ONLY flag

In reply to Mika Kahola

Add TEST_ONLY flag to test atomic transition display commits without actual real-life commit.

---
 tests/kms_atomic_transition.c | 227 ++++++++++++++++++++++++++++--------------
 1 file changed, 152 insertions(+), 75 deletions(-)
tests/kms_atomic_transition.c +152 -75
index 851ffc9..2505210 100644
@@ -68,7 +68,7 @@ wm_setup_plane(igt_display_t *display, enum pipe pipe,
 	}
 }
 
-static bool skip_on_unsupported_nonblocking_modeset(igt_display_t *display)
+static bool skip_on_unsupported_nonblocking_modeset(igt_display_t *display, bool test_only)
 {
 	enum pipe pipe;
 	int ret;
@@ -81,12 +81,14 @@ static bool skip_on_unsupported_nonblocking_modeset(igt_display_t *display)
 	 */
 	igt_display_commit_atomic(display, DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET, NULL);
 
-	ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_ATOMIC_NONBLOCK, NULL);
+	if (!test_only) {
+		ret = igt_display_try_commit_atomic(display, DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_ATOMIC_NONBLOCK, NULL);
 
-	if (ret == -EINVAL)
-		return true;
+		if (ret == -EINVAL)
+			return true;
 
-	igt_assert_eq(ret, 0);
+		igt_assert_eq(ret, 0);
+	}
 
 	/* Force the next state to update all crtc's, to synchronize with the nonblocking modeset. */
 	for_each_pipe(display, pipe)
@@ -267,7 +269,7 @@ retry:
  */
 static void
 run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output,
-		    enum transition_type type, bool nonblocking)
+		    enum transition_type type, bool nonblocking, bool test_only)
 {
 	struct igt_fb fb, argb_fb, sprite_fb;
 	drmModeModeInfo *mode, override_mode;
@@ -276,6 +278,10 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	struct plane_parms parms[IGT_MAX_PLANES];
 	bool skip_test = false;
 	unsigned flags = DRM_MODE_PAGE_FLIP_EVENT;
+	int ret;
+
+	if (test_only)
+		flags = DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_ATOMIC_TEST_ONLY;
 
 	if (nonblocking)
 		flags |= DRM_MODE_ATOMIC_NONBLOCK;
@@ -295,18 +301,26 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 	wm_setup_plane(display, pipe, 0, NULL);
 
 	if (flags & DRM_MODE_ATOMIC_ALLOW_MODESET) {
-		skip_test = nonblocking && skip_on_unsupported_nonblocking_modeset(display);
+		skip_test = nonblocking && skip_on_unsupported_nonblocking_modeset(display, test_only);
 		if (skip_test)
 			goto cleanup;
 
 		igt_output_set_pipe(output, PIPE_NONE);
 
-		igt_display_commit2(display, COMMIT_ATOMIC);
+		if (test_only) {
+			ret = igt_display_try_commit_atomic(display, flags, NULL);
+			igt_assert_eq(ret, 0);
+		} else
+			igt_display_commit2(display, COMMIT_ATOMIC);
 
 		igt_output_set_pipe(output, pipe);
 	}
 
-	igt_display_commit2(display, COMMIT_ATOMIC);
+	if (test_only) {
+		ret = igt_display_try_commit_atomic(display, flags, NULL);
+		igt_assert_eq(ret, 0);
+	} else
+		igt_display_commit2(display, COMMIT_ATOMIC);
 
 	setup_parms(display, pipe, mode, &argb_fb, &sprite_fb, parms);
 
@@ -315,17 +329,22 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 
 		wm_setup_plane(display, pipe, i, parms);
 
-		igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
-		drmHandleEvent(display->drm_fd, &drm_events);
+		ret = igt_display_try_commit_atomic(display, flags, (void *)(unsigned long)i);
+		igt_assert_eq(ret, 0);
+
+		if (!test_only)
+			drmHandleEvent(display->drm_fd, &drm_events);
 
 		if (type == TRANSITION_MODESET_DISABLE) {
 			igt_output_set_pipe(output, PIPE_NONE);
 
 			wm_setup_plane(display, pipe, 0, parms);
 
-			igt_display_commit_atomic(display, flags, (void *)0UL);
+			ret = igt_display_try_commit_atomic(display, flags, (void *)0UL);
+			igt_assert_eq(ret, 0);
 
-			drmHandleEvent(display->drm_fd, &drm_events);
+			if (!test_only)
+				drmHandleEvent(display->drm_fd, &drm_events);
 		} else {
 			uint32_t j;
 
@@ -336,15 +355,21 @@ run_transition_test(igt_display_t *display, enum pipe pipe, igt_output_t *output
 				if (type == TRANSITION_MODESET)
 					igt_output_override_mode(output, &override_mode);
 
-				igt_display_commit_atomic(display, flags, (void *)(unsigned long)j);
-				drmHandleEvent(display->drm_fd, &drm_events);
+				ret = igt_display_try_commit_atomic(display, flags, (void *)(unsigned long)j);
+				igt_assert_eq(ret, 0);
+
+				if (!test_only)
+					drmHandleEvent(display->drm_fd, &drm_events);
 
 				wm_setup_plane(display, pipe, i, parms);
 				if (type == TRANSITION_MODESET)
 					igt_output_override_mode(output, NULL);
 
-				igt_display_commit_atomic(display, flags, (void *)(unsigned long)i);
-				drmHandleEvent(display->drm_fd, &drm_events);
+				ret = igt_display_try_commit_atomic(display, flags, (void *)(unsigned long)i);
+				igt_assert_eq(ret, 0);
+
+				if (!test_only)
+					drmHandleEvent(display->drm_fd, &drm_events);
 			}
 		}
 	}
@@ -355,7 +380,8 @@ cleanup:
 	for_each_plane_on_pipe(display, pipe, plane)
 		igt_plane_set_fb(plane, NULL);
 
-	igt_display_commit2(display, COMMIT_ATOMIC);
+	if (!test_only)
+		igt_display_commit2(display, COMMIT_ATOMIC);
 
 	igt_remove_fb(display->drm_fd, &fb);
 	igt_remove_fb(display->drm_fd, &argb_fb);
@@ -364,51 +390,60 @@ cleanup:
 		igt_skip("Atomic nonblocking modesets are not supported.\n");
 }
 
-static void commit_display(igt_display_t *display, unsigned event_mask, bool nonblocking)
+static void commit_display(igt_display_t *display, unsigned int event_mask,
+			   bool nonblocking, bool test_only)
 {
 	unsigned flags;
 	int num_events = hweight32(event_mask);
 	ssize_t ret;
 
-	flags = DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_PAGE_FLIP_EVENT;
+	if (test_only)
+		flags = DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET;
+	else
+		flags = DRM_MODE_ATOMIC_ALLOW_MODESET | DRM_MODE_PAGE_FLIP_EVENT;
+
 	if (nonblocking)
 		flags |= DRM_MODE_ATOMIC_NONBLOCK;
 
-	igt_display_commit_atomic(display, flags, NULL);
+	ret = igt_display_try_commit_atomic(display, flags, NULL);
 
-	igt_debug("Event mask: %x, waiting for %i events\n", event_mask, num_events);
+	igt_assert_eq(ret, 0);
 
-	igt_set_timeout(30, "Waiting for events timed out\n");
+	if (!test_only) {
+		igt_debug("Event mask: %x, waiting for %i events\n", event_mask, num_events);
 
-	while (num_events) {
-		char buf[32];
-		struct drm_event *e = (void *)buf;
-		struct drm_event_vblank *vblank = (void *)buf;
-		uint32_t crtc_id, pipe = I915_MAX_PIPES;
+		igt_set_timeout(30, "Waiting for events timed out\n");
 
-		ret = read(display->drm_fd, buf, sizeof(buf));
-		if (ret < 0 && (errno == EINTR || errno == EAGAIN))
-			continue;
+		while (num_events) {
+			char buf[32];
+			struct drm_event *e = (void *)buf;
+			struct drm_event_vblank *vblank = (void *)buf;
+			uint32_t crtc_id, pipe = I915_MAX_PIPES;
 
-		igt_assert(ret >= 0);
-		igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
+			ret = read(display->drm_fd, buf, sizeof(buf));
+			if (ret < 0 && (errno == EINTR || errno == EAGAIN))
+				continue;
 
-		crtc_id = vblank->reserved;
-		if (crtc_id) {
-			for_each_pipe(display, pipe)
-				if (display->pipes[pipe].crtc_id == crtc_id)
-					break;
+			igt_assert(ret >= 0);
+			igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
 
-			igt_assert_lt(pipe, display->n_pipes);
+			crtc_id = vblank->reserved;
+			if (crtc_id) {
+				for_each_pipe(display, pipe)
+					if (display->pipes[pipe].crtc_id == crtc_id)
+						break;
 
-			igt_debug("Retrieved vblank seq: %u on %u/%u\n", vblank->sequence, vblank->reserved, pipe);
-		} else
-			igt_debug("Retrieved vblank seq: %u on unk/unk\n", vblank->sequence);
+				igt_assert_lt(pipe, display->n_pipes);
 
-		num_events--;
-	}
+				igt_debug("Retrieved vblank seq: %u on %u/%u\n", vblank->sequence, vblank->reserved, pipe);
+			} else
+				igt_debug("Retrieved vblank seq: %u on unk/unk\n", vblank->sequence);
 
-	igt_reset_timeout();
+			num_events--;
+		}
+
+		igt_reset_timeout();
+	}
 }
 
 static unsigned set_combinations(igt_display_t *display, unsigned mask, struct igt_fb *fb)
@@ -481,7 +516,8 @@ static void collect_crcs_mask(igt_pipe_crc_t **pipe_crcs, unsigned mask, igt_crc
 	}
 }
 
-static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblocking)
+static void run_modeset_tests(igt_display_t *display, int howmany,
+			      bool nonblocking, bool test_only)
 {
 	struct igt_fb fbs[2];
 	int i, j;
@@ -490,6 +526,7 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 	igt_output_t *output;
 	unsigned width = 0, height = 0;
 	bool skip_test = false;
+	int ret;
 
 	for_each_connected_output(display, output) {
 		drmModeModeInfo *mode = igt_output_get_mode(output);
@@ -501,7 +538,7 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 	}
 
 	igt_create_pattern_fb(display->drm_fd, width, height,
-				   DRM_FORMAT_XRGB8888, 0, &fbs[0]);
+			      DRM_FORMAT_XRGB8888, 0, &fbs[0]);
 	igt_create_color_pattern_fb(display->drm_fd, width, height,
 				    DRM_FORMAT_XRGB8888, 0, .5, .5, .5, &fbs[1]);
 
@@ -533,10 +570,15 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 	 * When i915 supports nonblocking modeset, this if branch can be removed.
 	 * It's only purpose is to ensure nonblocking modeset works.
 	 */
-	if (nonblocking && (skip_test = skip_on_unsupported_nonblocking_modeset(display)))
+	if (nonblocking && (skip_test = skip_on_unsupported_nonblocking_modeset(display, test_only)))
 		goto cleanup;
 
-	igt_display_commit2(display, COMMIT_ATOMIC);
+	if (test_only)
+		ret = igt_display_try_commit2(display, DRM_MODE_ATOMIC_TEST_ONLY | COMMIT_ATOMIC);
+	else
+		ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
+
+	igt_assert_eq(ret, 0);
 
 	for (i = 0; i < iter_max; i++) {
 		igt_crc_t crcs[5][I915_MAX_PIPES];
@@ -549,9 +591,10 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 		if (!event_mask && i)
 			continue;
 
-		commit_display(display, event_mask, nonblocking);
+		commit_display(display, event_mask, nonblocking, test_only);
 
-		collect_crcs_mask(pipe_crcs, i, crcs[0]);
+		if (!test_only)
+			collect_crcs_mask(pipe_crcs, i, crcs[0]);
 
 		for (j = iter_max - 1; j > i + 1; j--) {
 			if (hweight32(j) > howmany)
@@ -564,43 +607,54 @@ static void run_modeset_tests(igt_display_t *display, int howmany, bool nonblock
 			if (!event_mask)
 				continue;
 
-			commit_display(display, event_mask, nonblocking);
+			commit_display(display, event_mask, nonblocking, test_only);
 
-			collect_crcs_mask(pipe_crcs, j, crcs[1]);
+			if (!test_only)
+				collect_crcs_mask(pipe_crcs, j, crcs[1]);
 
 			refresh_primaries(display);
-			commit_display(display, j, nonblocking);
-			collect_crcs_mask(pipe_crcs, j, crcs[2]);
+			commit_display(display, j, nonblocking, test_only);
+
+			if (!test_only)
+				collect_crcs_mask(pipe_crcs, j, crcs[2]);
 
 			event_mask = set_combinations(display, i, &fbs[0]);
 			if (!event_mask)
 				continue;
 
-			commit_display(display, event_mask, nonblocking);
-			collect_crcs_mask(pipe_crcs, i, crcs[3]);
+			commit_display(display, event_mask, nonblocking, test_only);
+
+			if (!test_only)
+				collect_crcs_mask(pipe_crcs, i, crcs[3]);
 
 			refresh_primaries(display);
-			commit_display(display, i, nonblocking);
-			collect_crcs_mask(pipe_crcs, i, crcs[4]);
+			commit_display(display, i, nonblocking, test_only);
+
+			if (!test_only)
+				collect_crcs_mask(pipe_crcs, i, crcs[4]);
 
 			if (!is_i915_device(display->drm_fd))
 				continue;
 
-			for (int k = 0; k < I915_MAX_PIPES; k++) {
-				if (i & (1 << k)) {
-					igt_assert_crc_equal(&crcs[0][k], &crcs[3][k]);
-					igt_assert_crc_equal(&crcs[0][k], &crcs[4][k]);
-				}
+			if (!test_only) {
+				for (int k = 0; k < I915_MAX_PIPES; k++) {
+					if (i & (1 << k)) {
+						igt_assert_crc_equal(&crcs[0][k], &crcs[3][k]);
+						igt_assert_crc_equal(&crcs[0][k], &crcs[4][k]);
+					}
 
-				if (j & (1 << k))
-					igt_assert_crc_equal(&crcs[1][k], &crcs[2][k]);
+					if (j & (1 << k))
+						igt_assert_crc_equal(&crcs[1][k], &crcs[2][k]);
+				}
 			}
 		}
 	}
 
 cleanup:
 	set_combinations(display, 0, NULL);
-	igt_display_commit2(display, COMMIT_ATOMIC);
+
+	if (!test_only)
+		igt_display_commit2(display, COMMIT_ATOMIC);
 
 	if (is_i915_device(display->drm_fd))
 		for_each_pipe(display, i)
@@ -614,7 +668,8 @@ cleanup:
 
 }
 
-static void run_modeset_transition(igt_display_t *display, int requested_outputs, bool nonblocking)
+static void run_modeset_transition(igt_display_t *display, int requested_outputs,
+				   bool nonblocking, bool test_only)
 {
 	igt_output_t *outputs[I915_MAX_PIPES] = {};
 	int num_outputs = 0;
@@ -642,7 +697,7 @@ static void run_modeset_transition(igt_display_t *display, int requested_outputs
 		      "Should have at least %i outputs, found %i\n",
 		      requested_outputs, num_outputs);
 
-	run_modeset_tests(display, requested_outputs, nonblocking);
+	run_modeset_tests(display, requested_outputs, nonblocking, test_only);
 }
 
 igt_main
@@ -673,26 +728,48 @@ igt_main
 
 	igt_subtest("plane-all-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false);
+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, false);
+
+	igt_subtest("plane-all-transition-test-only")
+		for_each_pipe_with_valid_output(&display, pipe, output)
+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, false, true);
 
 	igt_subtest("plane-all-transition-nonblocking")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true);
+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, false);
+
+	igt_subtest("plane-all-transition-nonblocking-test-only")
+		for_each_pipe_with_valid_output(&display, pipe, output)
+			run_transition_test(&display, pipe, output, TRANSITION_PLANES, true, true);
 
 	igt_subtest("plane-all-modeset-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false);
+			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, false);
+
+	igt_subtest("plane-all-modeset-transition-test-only")
+		for_each_pipe_with_valid_output(&display, pipe, output)
+			run_transition_test(&display, pipe, output, TRANSITION_MODESET, false, true);
 
 	igt_subtest("plane-toggle-modeset-transition")
 		for_each_pipe_with_valid_output(&display, pipe, output)
-			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false);
+			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false, false);
+
+	igt_subtest("plane-toggle-modeset-transition-test-only")
+		for_each_pipe_with_valid_output(&display, pipe, output)
+			run_transition_test(&display, pipe, output, TRANSITION_MODESET_DISABLE, false, true);
 
 	for (i = 1; i <= I915_MAX_PIPES; i++) {
 		igt_subtest_f("%ix-modeset-transitions", i)
-			run_modeset_transition(&display, i, false);
+			run_modeset_transition(&display, i, false, false);
+
+		igt_subtest_f("%ix-modeset-transitions-test-only", i)
+			run_modeset_transition(&display, i, false, true);
 
 		igt_subtest_f("%ix-modeset-transitions-nonblocking", i)
-			run_modeset_transition(&display, i, true);
+			run_modeset_transition(&display, i, true, false);
+
+		igt_subtest_f("%ix-modeset-transitions-nonblocking-test-only", i)
+			run_modeset_transition(&display, i, true, true);
 	}
 
 	igt_fixture {
Signature · 6 lines
2.7.4

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

PATCH 3/5 tests/kms_plane_scaling: Add TEST_ONLY flag

In reply to Mika Kahola

Add TEST_ONLY flag to test atomic scaling without
actually committing the changes.

---
 tests/kms_plane_scaling.c | 152 ++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 135 insertions(+), 17 deletions(-)
tests/kms_plane_scaling.c +135 -17
index 368da09..ae3ce40 100644
@@ -55,9 +55,18 @@ typedef struct {
 
 #define FILE_NAME   "1080p-left.png"
 
+/* Command line parameters. */
+struct {
+	bool test_only;
+} opt = {
+	.test_only = false,
+};
+
 static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
-			igt_plane_t *plane, drmModeModeInfo *mode, enum igt_commit_style s)
+			 igt_plane_t *plane, drmModeModeInfo *mode,
+			 enum igt_commit_style s, bool test_only)
 {
+	int ret;
 	igt_display_t *display = &data->display;
 
 	igt_output_set_pipe(output, pipe);
@@ -94,7 +103,6 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 
 	igt_plane_set_fb(plane, &data->fb1);
 	if (s == COMMIT_LEGACY) {
-		int ret;
 		ret = drmModeSetCrtc(data->drm_fd,
 				plane->pipe->crtc_id,
 				data->fb_id1,
@@ -103,6 +111,12 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 				1,
 				mode);
 		igt_assert_eq(ret, 0);
+	} else if (test_only) {
+		ret = igt_display_try_commit2(display,
+					      DRM_MODE_ATOMIC_TEST_ONLY |
+					      DRM_MODE_ATOMIC_ALLOW_MODESET |
+					      COMMIT_ATOMIC);
+		igt_assert_eq(ret, 0);
 	} else {
 		igt_display_commit2(display, s);
 	}
@@ -175,13 +189,14 @@ static void iterate_plane_scaling(data_t *d, drmModeModeInfo *mode)
 	}
 }
 
-static void test_plane_scaling(data_t *d)
+static void test_plane_scaling(data_t *d, bool test_only)
 {
 	igt_display_t *display = &d->display;
 	igt_output_t *output;
 	enum pipe pipe;
 	int valid_tests = 0;
 	int primary_plane_scaling = 0; /* For now */
+	int ret;
 
 	igt_require(d->num_scalers);
 
@@ -208,7 +223,7 @@ static void test_plane_scaling(data_t *d)
 
 		/* Set up display with plane 1 */
 		d->plane1 = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
-		prepare_crtc(d, output, pipe, d->plane1, mode, COMMIT_UNIVERSAL);
+		prepare_crtc(d, output, pipe, d->plane1, mode, COMMIT_UNIVERSAL, test_only);
 
 		if (primary_plane_scaling) {
 			/* Primary plane upscaling */
@@ -216,14 +231,30 @@ static void test_plane_scaling(data_t *d)
 			igt_fb_set_size(&d->fb1, d->plane1, 500, 500);
 			igt_plane_set_position(d->plane1, 0, 0);
 			igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay);
-			igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+			if (test_only) {
+				ret = igt_display_try_commit_atomic(&d->display,
+								    DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET,
+								    NULL);
+				igt_assert_eq(ret, 0);
+			} else {
+				igt_display_commit2(display, COMMIT_UNIVERSAL);
+			}
 
 			/* Primary plane 1:1 no scaling */
 			igt_fb_set_position(&d->fb1, d->plane1, 0, 0);
 			igt_fb_set_size(&d->fb1, d->plane1, d->fb1.width, d->fb1.height);
 			igt_plane_set_position(d->plane1, 0, 0);
 			igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay);
-			igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+			if (test_only) {
+				ret = igt_display_try_commit_atomic(&d->display,
+								    DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET,
+								    NULL);
+				igt_assert_eq(ret, 0);
+			} else {
+				igt_display_commit2(display, COMMIT_UNIVERSAL);
+			}
 		}
 
 		/* Set up fb2->plane2 mapping. */
@@ -235,7 +266,15 @@ static void test_plane_scaling(data_t *d)
 		igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-200, d->fb2.height-200);
 		igt_plane_set_position(d->plane2, 100, 100);
 		igt_plane_set_size(d->plane2, mode->hdisplay-200, mode->vdisplay-200);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+		if (test_only) {
+			ret = igt_display_try_commit_atomic(&d->display,
+							    DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET,
+							    NULL);
+			igt_assert_eq(ret, 0);
+		} else {
+			igt_display_commit2(display, COMMIT_UNIVERSAL);
+		}
 
 		iterate_plane_scaling(d, mode);
 
@@ -244,14 +283,30 @@ static void test_plane_scaling(data_t *d)
 		igt_fb_set_size(&d->fb2, d->plane2, 500, 500);
 		igt_plane_set_position(d->plane2, 10, 10);
 		igt_plane_set_size(d->plane2, mode->hdisplay-20, mode->vdisplay-20);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+		if (test_only) {
+			ret = igt_display_try_commit_atomic(&d->display,
+							    DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET,
+							    NULL);
+			igt_assert_eq(ret, 0);
+		} else {
+			igt_display_commit2(display, COMMIT_UNIVERSAL);
+		}
 
 		/* 2nd plane downscaling */
 		igt_fb_set_position(&d->fb2, d->plane2, 0, 0);
 		igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width, d->fb2.height);
 		igt_plane_set_position(d->plane2, 10, 10);
 		igt_plane_set_size(d->plane2, 500, 500 * d->fb2.height/d->fb2.width);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+		if (test_only) {
+			ret = igt_display_try_commit_atomic(&d->display,
+							    DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET,
+							    NULL);
+			igt_assert_eq(ret, 0);
+		} else {
+			igt_display_commit2(display, COMMIT_UNIVERSAL);
+		}
 
 		if (primary_plane_scaling) {
 			/* Primary plane up scaling */
@@ -259,7 +314,15 @@ static void test_plane_scaling(data_t *d)
 			igt_fb_set_size(&d->fb1, d->plane1, 500, 500);
 			igt_plane_set_position(d->plane1, 0, 0);
 			igt_plane_set_size(d->plane1, mode->hdisplay, mode->vdisplay);
-			igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+			if (test_only) {
+				ret = igt_display_try_commit_atomic(&d->display,
+								    DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET,
+								    NULL);
+				igt_assert_eq(ret, 0);
+			} else {
+				igt_display_commit2(display, COMMIT_UNIVERSAL);
+			}
 		}
 
 		/* Set up fb3->plane3 mapping. */
@@ -271,7 +334,15 @@ static void test_plane_scaling(data_t *d)
 		igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-300, d->fb3.height-300);
 		igt_plane_set_position(d->plane3, 100, 100);
 		igt_plane_set_size(d->plane3, mode->hdisplay-300, mode->vdisplay-300);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+		if (test_only) {
+			ret = igt_display_try_commit_atomic(&d->display,
+							    DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET,
+							    NULL);
+			igt_assert_eq(ret, 0);
+		} else {
+			igt_display_commit2(display, COMMIT_UNIVERSAL);
+		}
 
 		/* Switch scaler from plane 2 to plane 3 */
 		igt_fb_set_position(&d->fb2, d->plane2, 100, 100);
@@ -283,7 +354,15 @@ static void test_plane_scaling(data_t *d)
 		igt_fb_set_size(&d->fb3, d->plane3, d->fb3.width-400, d->fb3.height-400);
 		igt_plane_set_position(d->plane3, 10, 10);
 		igt_plane_set_size(d->plane3, mode->hdisplay-300, mode->vdisplay-300);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+		if (test_only) {
+			ret = igt_display_try_commit_atomic(&d->display,
+							    DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET,
+							    NULL);
+			igt_assert_eq(ret, 0);
+		} else {
+			igt_display_commit2(display, COMMIT_UNIVERSAL);
+		}
 
 		if (primary_plane_scaling) {
 			/* Switch scaler from plane 1 to plane 2 */
@@ -296,13 +375,29 @@ static void test_plane_scaling(data_t *d)
 			igt_fb_set_size(&d->fb2, d->plane2, d->fb2.width-500,d->fb2.height-500);
 			igt_plane_set_position(d->plane2, 100, 100);
 			igt_plane_set_size(d->plane2, mode->hdisplay-200, mode->vdisplay-200);
-			igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+			if (test_only) {
+				ret = igt_display_try_commit_atomic(&d->display,
+								    DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET,
+								    NULL);
+				igt_assert_eq(ret, 0);
+			} else {
+				igt_display_commit2(display, COMMIT_UNIVERSAL);
+			}
 		}
 
 		/* back to single plane mode */
 		igt_plane_set_fb(d->plane2, NULL);
 		igt_plane_set_fb(d->plane3, NULL);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
+
+		if (test_only) {
+			ret = igt_display_try_commit_atomic(&d->display,
+							    DRM_MODE_ATOMIC_TEST_ONLY | DRM_MODE_ATOMIC_ALLOW_MODESET,
+							    NULL);
+			igt_assert_eq(ret, 0);
+		} else {
+			igt_display_commit2(display, COMMIT_UNIVERSAL);
+		}
 
 		valid_tests++;
 		cleanup_crtc(d, output, d->plane1);
@@ -310,12 +405,35 @@ static void test_plane_scaling(data_t *d)
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 }
 
-igt_simple_main
+static int opt_handler(int option, int option_index, void *input)
+{
+	switch (option) {
+	case 't':
+		opt.test_only = true;
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	return 0;
+}
+
+const char *help_str =
+	"  --test-only  test only atomic commit\n";
+
+int main(int argc, char *argv[])
 {
 	data_t data = {};
 
-	igt_skip_on_simulation();
+	struct option long_options[] = {
+		{ "test-only", no_argument, NULL, 't'},
+		{ 0, 0, 0, 0 }
+	};
 
+	igt_subtest_init_parse_opts(&argc, argv, "", long_options, help_str,
+				    opt_handler, NULL);
+
+	igt_skip_on_simulation();
 
 	data.drm_fd = drm_open_driver(DRIVER_INTEL);
 	igt_require_pipe_crc();
@@ -324,7 +442,7 @@ igt_simple_main
 
 	data.num_scalers = intel_gen(data.devid) >= 9 ? 2 : 0;
 
-	test_plane_scaling(&data);
+	test_plane_scaling(&data, opt.test_only);
 
 	igt_display_fini(&data.display);
 }
Signature · 6 lines
2.7.4

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

PATCH 4/5 tests/kms_rotation_crc: Add TEST_ONLY flag

In reply to Mika Kahola

Add TEST_ONLY flag to test atomic transition display commits without actual real-life commit.

---
 tests/kms_rotation_crc.c | 282 +++++++++++++++++++++++++++++++++++++----------
 1 file changed, 222 insertions(+), 60 deletions(-)
tests/kms_rotation_crc.c +222 -60
index 796b448..434f845 100644
@@ -84,11 +84,25 @@ paint_squares(data_t *data, drmModeModeInfo *mode, igt_rotation_t rotation,
 	cairo_destroy(cr);
 }
 
-static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
+static int display_commit_test_only(igt_display_t *display)
+{
+	int ret;
+
+	ret = igt_display_try_commit_atomic(display,
+					    DRM_MODE_ATOMIC_TEST_ONLY |
+					    DRM_MODE_ATOMIC_ALLOW_MODESET,
+					    NULL);
+
+	return ret;
+}
+
+static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane,
+	bool test_only)
 {
 	igt_display_t *display = &data->display;
 	enum igt_commit_style commit = COMMIT_LEGACY;
 	igt_plane_t *primary;
+	int ret;
 
 	/*
 	 * With igt_display_commit2 and COMMIT_UNIVERSAL, we call just the
@@ -99,7 +113,13 @@ static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 
 	primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY);
 	igt_plane_set_fb(primary, &data->fb_modeset);
-	igt_display_commit(display);
+
+	if (test_only) {
+		ret = display_commit_test_only(display);
+		igt_assert_eq(ret, 0);
+	} else {
+		igt_display_commit(display);
+	}
 
 	igt_plane_set_fb(plane, &data->fb);
 
@@ -111,12 +131,19 @@ static void commit_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 
 	if (data->display.is_atomic)
 		commit = COMMIT_ATOMIC;
+	else
+		igt_skip_on(test_only);
 
-	igt_display_commit2(display, commit);
+	if (test_only) {
+		ret = display_commit_test_only(display);
+		igt_assert_eq(ret, 0);
+	} else {
+		igt_display_commit2(display, commit);
+	}
 }
 
 static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
-			 igt_plane_t *plane)
+			 igt_plane_t *plane, bool test_only)
 {
 	drmModeModeInfo *mode;
 	int fb_id, fb_modeset_id;
@@ -181,8 +208,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 
 	/* Step 1: create a reference CRC for a software-rotated fb */
 	paint_squares(data, mode, data->rotation, &data->fb, 1.0);
-	commit_crtc(data, output, plane);
-	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
+	commit_crtc(data, output, plane, test_only);
+
+	if (!test_only)
+		igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
 
 	/*
 	 * Step 2: prepare the plane with an non-rotated fb let the hw
@@ -192,10 +221,12 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 	igt_plane_set_fb(plane, &data->fb);
 }
 
-static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
+static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane,
+	bool test_only)
 {
 	igt_display_t *display = &data->display;
-
+	int ret;
+
 	igt_pipe_crc_free(data->pipe_crc);
 	data->pipe_crc = NULL;
 
@@ -215,7 +246,12 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
 	igt_plane_set_fb(plane, NULL);
 	igt_output_set_pipe(output, PIPE_ANY);
 
-	igt_display_commit(display);
+	if (test_only) {
+		ret = display_commit_test_only(display);
+		igt_assert_eq(ret, 0);
+	} else {
+		igt_display_commit(display);
+	}
 }
 
 static void wait_for_pageflip(int fd)
@@ -235,7 +271,7 @@ static void wait_for_pageflip(int fd)
 	igt_assert(drmHandleEvent(fd, &evctx) == 0);
 }
 
-static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
+static void test_plane_rotation(data_t *data, enum igt_plane plane_type, bool test_only)
 {
 	igt_display_t *display = &data->display;
 	igt_output_t *output;
@@ -254,6 +290,8 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 
 	if (data->display.is_atomic)
 		commit = COMMIT_ATOMIC;
+	else
+		igt_skip_on(test_only);
 
 	for_each_connected_output(display, output) {
 		for_each_pipe(display, pipe) {
@@ -264,17 +302,32 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 			plane = igt_output_get_plane(output, plane_type);
 			igt_require(igt_plane_supports_rotation(plane));
 
-			prepare_crtc(data, output, pipe, plane);
+			prepare_crtc(data, output, pipe, plane, test_only);
 
-			igt_display_commit2(display, commit);
+			if (test_only) {
+				ret = display_commit_test_only(display);
+				igt_assert_eq(ret, 0);
+			} else {
+				igt_display_commit2(display, commit);
+			}
 
 			/* collect unrotated CRC */
-			igt_pipe_crc_collect_crc(data->pipe_crc, &crc_unrotated);
+			if (!test_only)
+				igt_pipe_crc_collect_crc(data->pipe_crc, &crc_unrotated);
 
 			igt_plane_set_rotation(plane, data->rotation);
-			ret = igt_display_try_commit2(display, commit);
+
+			if (test_only) {
+				ret = display_commit_test_only(display);
+				igt_assert_eq(ret, 0);
+			} else {
+				ret = igt_display_try_commit2(display, commit);
+			}
+
 			if (data->override_fmt || data->override_tiling) {
 				igt_assert_eq(ret, -EINVAL);
+			} else if (test_only) {
+				igt_assert_eq(ret, 0);
 			} else {
 				igt_assert_eq(ret, 0);
 				igt_pipe_crc_collect_crc(data->pipe_crc,
@@ -283,22 +336,24 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 						     &crc_output);
 			}
 
-			flip_count = data->flip_stress;
-			while (flip_count--) {
-				ret = drmModePageFlip(data->gfx_fd,
-						      output->config.crtc->crtc_id,
-						      data->fb_flip.fb_id,
-						      DRM_MODE_PAGE_FLIP_EVENT,
-						      NULL);
-				igt_assert(ret == 0);
-				wait_for_pageflip(data->gfx_fd);
-				ret = drmModePageFlip(data->gfx_fd,
-						      output->config.crtc->crtc_id,
-						      data->fb.fb_id,
-						      DRM_MODE_PAGE_FLIP_EVENT,
-						      NULL);
-				igt_assert(ret == 0);
-				wait_for_pageflip(data->gfx_fd);
+			if (!test_only) {
+				flip_count = data->flip_stress;
+				while (flip_count--) {
+					ret = drmModePageFlip(data->gfx_fd,
+							      output->config.crtc->crtc_id,
+							      data->fb_flip.fb_id,
+							      DRM_MODE_PAGE_FLIP_EVENT,
+							      NULL);
+					igt_assert(ret == 0);
+					wait_for_pageflip(data->gfx_fd);
+					ret = drmModePageFlip(data->gfx_fd,
+							      output->config.crtc->crtc_id,
+							      data->fb.fb_id,
+							      DRM_MODE_PAGE_FLIP_EVENT,
+							      NULL);
+					igt_assert(ret == 0);
+					wait_for_pageflip(data->gfx_fd);
+				}
 			}
 
 			/*
@@ -307,20 +362,24 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type)
 			 */
 			kmstest_restore_vt_mode();
 			kmstest_set_vt_graphics_mode();
+
+			commit_crtc(data, output, plane, test_only);
 
-			commit_crtc(data, output, plane);
-
-			igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
-			igt_assert_crc_equal(&crc_unrotated, &crc_output);
+			if (!test_only) {
+				igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
+				igt_assert_crc_equal(&crc_unrotated, &crc_output);
+			}
 
 			valid_tests++;
-			cleanup_crtc(data, output, plane);
+			cleanup_crtc(data, output, plane, test_only);
 		}
 	}
 	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
 }
 
-static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_type)
+static void test_plane_rotation_ytiled_obj(data_t *data,
+					   enum igt_plane plane_type,
+					   bool test_only)
 {
 	igt_display_t *display = &data->display;
 	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
@@ -348,6 +407,8 @@ static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_ty
 
 	if (data->display.is_atomic)
 		commit = COMMIT_ATOMIC;
+	else
+		igt_skip_on(test_only);
 
 	mode = igt_output_get_mode(output);
 	w = mode->hdisplay;
@@ -379,14 +440,20 @@ static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_ty
 				 DRM_MODE_OBJECT_PLANE,
 				 plane->rotation_property,
 				 plane->rotation);
-	ret = igt_display_try_commit2(display, commit);
+
+	if (test_only)
+		ret = display_commit_test_only(display);
+	else
+		ret = igt_display_try_commit2(display, commit);
 
 	kmstest_restore_vt_mode();
 	igt_remove_fb(fd, &data->fb);
 	igt_assert(ret == 0);
 }
 
-static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plane_type)
+static void test_plane_rotation_exhaust_fences(data_t *data,
+					       enum igt_plane plane_type,
+					       bool test_only)
 {
 	igt_display_t *display = &data->display;
 	uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED;
@@ -416,6 +483,8 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plan
 
 	if (data->display.is_atomic)
 		commit = COMMIT_ATOMIC;
+	else
+		igt_skip_on(test_only);
 
 	mode = igt_output_get_mode(output);
 	w = mode->hdisplay;
@@ -435,7 +504,13 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plan
 	igt_require(total_fbs_size < total_aperture_size * 0.9);
 
 	igt_plane_set_fb(plane, NULL);
-	igt_display_commit(display);
+
+	if (test_only) {
+		ret = display_commit_test_only(display);
+		igt_assert_eq(ret, 0);
+	} else {
+		igt_display_commit(display);
+	}
 
 	for (i = 0; i < MAX_FENCES + 1; i++) {
 		gem_handle = gem_create(fd, size);
@@ -460,10 +535,18 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plan
 		igt_plane_set_fb(plane, &data2[i].fb);
 		igt_plane_set_rotation(plane, IGT_ROTATION_0);
 
-		ret = igt_display_try_commit2(display, commit);
-		if (ret) {
-			igt_warn("failed to commit unrotated fb\n");
-			goto err_commit;
+		if (test_only) {
+			ret = display_commit_test_only(display);
+			if (ret) {
+				igt_warn("test only: failed to commit unrotated fb\n");
+				goto err_commit;
+			}
+		} else {
+			ret = igt_display_try_commit2(display, commit);
+			if (ret) {
+				igt_warn("failed to commit unrotated fb\n");
+				goto err_commit;
+			}
 		}
 
 		igt_plane_set_rotation(plane, IGT_ROTATION_90);
@@ -472,10 +555,19 @@ static void test_plane_rotation_exhaust_fences(data_t *data, enum igt_plane plan
 					 DRM_MODE_OBJECT_PLANE,
 					 plane->rotation_property,
 					 plane->rotation);
-		ret = igt_display_try_commit2(display, commit);
-		if (ret) {
-			igt_warn("failed to commit hardware rotated fb\n");
-			goto err_commit;
+
+		if (test_only) {
+			ret = display_commit_test_only(display);
+			if (ret) {
+				igt_warn("test only: failed to commit hardware rotated fb\n");
+				goto err_commit;
+			}
+		} else {
+			ret = igt_display_try_commit2(display, commit);
+			if (ret) {
+				igt_warn("failed to commit hardware rotated fb\n");
+				goto err_commit;
+			}
 		}
 	}
 
@@ -511,41 +603,73 @@ igt_main
 	}
 	igt_subtest_f("primary-rotation-180") {
 		data.rotation = IGT_ROTATION_180;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, false);
+	}
+	igt_subtest_f("primary-rotation-180-test-only") {
+		data.rotation = IGT_ROTATION_180;
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, true);
 	}
 
 	igt_subtest_f("sprite-rotation-180") {
 		data.rotation = IGT_ROTATION_180;
-		test_plane_rotation(&data, IGT_PLANE_2);
+		test_plane_rotation(&data, IGT_PLANE_2, false);
+	}
+	igt_subtest_f("sprite-rotation-180-test-only") {
+		data.rotation = IGT_ROTATION_180;
+		test_plane_rotation(&data, IGT_PLANE_2, true);
 	}
 
 	igt_subtest_f("cursor-rotation-180") {
 		data.rotation = IGT_ROTATION_180;
-		test_plane_rotation(&data, IGT_PLANE_CURSOR);
+		test_plane_rotation(&data, IGT_PLANE_CURSOR, false);
+	}
+	igt_subtest_f("cursor-rotation-180-test-only") {
+		data.rotation = IGT_ROTATION_180;
+		test_plane_rotation(&data, IGT_PLANE_CURSOR, true);
 	}
 
 	igt_subtest_f("primary-rotation-90") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_90;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, false);
+	}
+	igt_subtest_f("primary-rotation-90-test-only") {
+		igt_require(gen >= 9);
+		data.rotation = IGT_ROTATION_90;
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, true);
 	}
 
 	igt_subtest_f("primary-rotation-270") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_270;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, false);
+	}
+	igt_subtest_f("primary-rotation-270-test-only") {
+		igt_require(gen >= 9);
+		data.rotation = IGT_ROTATION_270;
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, true);
 	}
 
 	igt_subtest_f("sprite-rotation-90") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_90;
-		test_plane_rotation(&data, IGT_PLANE_2);
+		test_plane_rotation(&data, IGT_PLANE_2, false);
+	}
+	igt_subtest_f("sprite-rotation-90-test-only") {
+		igt_require(gen >= 9);
+		data.rotation = IGT_ROTATION_90;
+		test_plane_rotation(&data, IGT_PLANE_2, true);
 	}
 
 	igt_subtest_f("sprite-rotation-270") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_270;
-		test_plane_rotation(&data, IGT_PLANE_2);
+		test_plane_rotation(&data, IGT_PLANE_2, false);
+	}
+	igt_subtest_f("sprite-rotation-270-test-only") {
+		igt_require(gen >= 9);
+		data.rotation = IGT_ROTATION_270;
+		test_plane_rotation(&data, IGT_PLANE_2, true);
 	}
 
 	igt_subtest_f("sprite-rotation-90-pos-100-0") {
@@ -553,7 +677,14 @@ igt_main
 		data.rotation = IGT_ROTATION_90;
 		data.pos_x = 100,
 		data.pos_y = 0;
-		test_plane_rotation(&data, IGT_PLANE_2);
+		test_plane_rotation(&data, IGT_PLANE_2, false);
+	}
+	igt_subtest_f("sprite-rotation-90-pos-100-0-test-only") {
+		igt_require(gen >= 9);
+		data.rotation = IGT_ROTATION_90;
+		data.pos_x = 100,
+		data.pos_y = 0;
+		test_plane_rotation(&data, IGT_PLANE_2, true);
 	}
 
 	igt_subtest_f("bad-pixel-format") {
@@ -562,7 +693,15 @@ igt_main
 		data.pos_y = 0;
 		data.rotation = IGT_ROTATION_90;
 		data.override_fmt = DRM_FORMAT_RGB565;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, false);
+	}
+	igt_subtest_f("bad-pixel-format-test-only") {
+		igt_require(gen >= 9);
+		data.pos_x = 0,
+		data.pos_y = 0;
+		data.rotation = IGT_ROTATION_90;
+		data.override_fmt = DRM_FORMAT_RGB565;
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, true);
 	}
 
 	igt_subtest_f("bad-tiling") {
@@ -570,7 +709,14 @@ igt_main
 		data.override_fmt = 0;
 		data.rotation = IGT_ROTATION_90;
 		data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, false);
+	}
+	igt_subtest_f("bad-tiling-test-only") {
+		igt_require(gen >= 9);
+		data.override_fmt = 0;
+		data.rotation = IGT_ROTATION_90;
+		data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE;
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, true);
 	}
 
 	igt_subtest_f("primary-rotation-90-flip-stress") {
@@ -578,18 +724,34 @@ igt_main
 		data.override_tiling = 0;
 		data.flip_stress = 60;
 		data.rotation = IGT_ROTATION_90;
-		test_plane_rotation(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, false);
+	}
+	igt_subtest_f("primary-rotation-90-flip-stress-test-only") {
+		igt_require(gen >= 9);
+		data.override_tiling = 0;
+		data.flip_stress = 60;
+		data.rotation = IGT_ROTATION_90;
+		test_plane_rotation(&data, IGT_PLANE_PRIMARY, true);
 	}
 
 	igt_subtest_f("primary-rotation-90-Y-tiled") {
 		igt_require(gen >= 9);
 		data.rotation = IGT_ROTATION_90;
-		test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY, false);
+	}
+	igt_subtest_f("primary-rotation-90-Y-tiled-test-only") {
+		igt_require(gen >= 9);
+		data.rotation = IGT_ROTATION_90;
+		test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY, true);
 	}
 
 	igt_subtest_f("exhaust-fences") {
 		igt_require(gen >= 9);
-		test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY);
+		test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY, false);
+	}
+	igt_subtest_f("exhaust-fences-test-only") {
+		igt_require(gen >= 9);
+		test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY, true);
 	}
 
 	igt_fixture {
Signature · 6 lines
2.7.4

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

PATCH 5/5 tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit

In reply to Mika Kahola

This test case adds TEST_ONLY flag to the following test cases to test atomic commit correctness.

- kms_plane_multiple
- kms_atomic_transitions
- kms_plane_scaling
- kms_rotation_crc

The test randomly selects one of the above test cases and tests atomic commit. If the test fails with TEST_ONLY flag the real deal atomic commit is executed and the outcome is verified.

The test runs by default for 64 iterations.

---
 tests/Makefile.sources |   1 +
 tests/kms_test_only.c  | 455 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 456 insertions(+)
 create mode 100644 tests/kms_test_only.c
tests/Makefile.sources +1 -0
index 6316ea6..ff599c3 100644
@@ -112,6 +112,7 @@ TESTS_progs_M = \
 	kms_plane \
 	kms_plane_multiple \
 	kms_plane_lowres \
+	kms_test_only \
 	kms_properties \
 	kms_psr_sink_crc \
 	kms_render \
tests/kms_test_only.c new file +455 -0

455 lines not on this page · raw message

Signature · 6 lines
2.7.4

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

Re: [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit

Op 30-12-16 om 13:00 schreef Mika Kahola:

Quoted 12 lines

This test case adds TEST_ONLY flag to the following test cases to test atomic commit correctness.

- kms_plane_multiple
- kms_atomic_transitions
- kms_plane_scaling
- kms_rotation_crc

The test randomly selects one of the above test cases and tests atomic commit. If the test fails with TEST_ONLY flag the real deal atomic commit is executed and the outcome is verified.

Quoted 8 lines

The test runs by default for 64 iterations.

---
 tests/Makefile.sources |   1 +
 tests/kms_test_only.c  | 455 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 456 insertions(+)
 create mode 100644 tests/kms_test_only.c

Hey,

What does this test add?

Any test should pass with PASS. This test retrying failed test-only tests won't add much there. No test should ever fail.

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Re: [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit

Hey,

Op 12-01-17 om 11:28 schreef Mika Kahola:

Quoted 28 lines · Maarten Lankhorst
Quoted 27 lines

Op 30-12-16 om 13:00 schreef Mika Kahola:

Quoted 17 lines

This test case adds TEST_ONLY flag to the following test cases to test
atomic commit correctness.

- kms_plane_multiple
- kms_atomic_transitions
- kms_plane_scaling
- kms_rotation_crc

The test randomly selects one of the above test cases and tests atomic
commit. If the test fails with TEST_ONLY flag the real deal atomic commit
is executed and the outcome is verified.

The test runs by default for 64 iterations.

Quoted 7 lines
---
 tests/Makefile.sources |   1 +
 tests/kms_test_only.c  | 455
+++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 456 insertions(+)
 create mode 100644 tests/kms_test_only.c

Hey,

Quoted 8 lines
Quoted 1 line

What does this test add?

This is for VIZ-6956. The idea here is to test atomic commits with TEST_ONLY first, and it that fails we try to commit in real.

Quoted 2 lines

Any test should pass with PASS. This test retrying failed test-only tests won't add much there. No test should ever fail.

That's my thought also. You could argue whether or not this test adds any value. In my mind, this test only tests if TEST_ONLY flag is behaving ok :)

But you can already compare test passes vs test fails. There's no need for a separate test because any test failing should already be investigated.

I don't think a test that tests another test is useful, we already have infrastructure for that. :-)

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

#10 lore raw

Re: [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit

Quoted 47 lines · Maarten Lankhorst

Hey,

Op 12-01-17 om 11:28 schreef Mika Kahola:

Quoted 37 lines · Maarten Lankhorst
Quoted 29 lines

Op 30-12-16 om 13:00 schreef Mika Kahola:

Quoted 20 lines

This test case adds TEST_ONLY flag to the following test cases to
test
atomic commit correctness.

 - kms_plane_multiple
 - kms_atomic_transitions
 - kms_plane_scaling
 - kms_rotation_crc

The test randomly selects one of the above test cases and tests atomic
commit. If the test fails with TEST_ONLY flag the real deal atomic
commit
is executed and the outcome is verified.

The test runs by default for 64 iterations.

Quoted 7 lines

---
 tests/Makefile.sources |   1 +
 tests/kms_test_only.c  | 455
+++++++++++++++++++++++++++++++++++++++++++++++++

 2 files changed, 456 insertions(+)

 create mode 100644 tests/kms_test_only.c

Quoted 3 lines

Hey,

What does this test add?

This is for VIZ-6956. The idea here is to test atomic commits with TEST_ONLY first, and it that fails we try to commit in real.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

Any test should pass with PASS. This test retrying failed test- only
tests won't add much there. No test should ever fail.

That's my thought also. You could argue whether or not this test adds
any value. In my mind, this test only tests if TEST_ONLY flag is behaving ok :)

Quoted 6 lines

But you can already compare test passes vs test fails. There's no need for a separate test because any test failing should already be investigated.

I don't think a test that tests another test is useful, we already have infrastructure for that. :-)

So what should we do about this test? Would it be enough if we just add these TEST_ONLY flag tests to these igt tests and forget this one that just tests if the test was successful or not?

Quoted 2 lines

~Maarten

Signature · 6 lines
Mika Kahola - Intel OTC

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

Re: [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit

Op 23-01-17 om 14:26 schreef Mika Kahola:

Quoted 48 lines · Maarten Lankhorst
Quoted 47 lines

Hey,

Op 12-01-17 om 11:28 schreef Mika Kahola:

Quoted 33 lines · Maarten Lankhorst
Quoted 27 lines

Op 30-12-16 om 13:00 schreef Mika Kahola:

Quoted 19 lines

This test case adds TEST_ONLY flag to the following test cases to
test
atomic commit correctness.

- kms_plane_multiple
- kms_atomic_transitions
- kms_plane_scaling
- kms_rotation_crc

The test randomly selects one of the above test cases and tests atomic
commit. If the test fails with TEST_ONLY flag the real deal atomic
commit
is executed and the outcome is verified.

The test runs by default for 64 iterations.

Quoted 7 lines
---
 tests/Makefile.sources |   1 +
 tests/kms_test_only.c  | 455
+++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 456 insertions(+)
 create mode 100644 tests/kms_test_only.c
Quoted 3 lines

Hey,

What does this test add?

This is for VIZ-6956. The idea here is to test atomic commits with TEST_ONLY first, and it that fails we try to commit in real.

Quoted 7 lines
Quoted 3 lines

Any test should pass with PASS. This test retrying failed test- only
tests won't add much there. No test should ever fail.

That's my thought also. You could argue whether or not this test adds
any value. In my mind, this test only tests if TEST_ONLY flag is behaving ok :)

But you can already compare test passes vs test fails. There's no need for a separate test because any test failing should already be investigated.

Quoted 5 lines
Quoted 2 lines

I don't think a test that tests another test is useful, we already have infrastructure for that. :-)

So what should we do about this test? Would it be enough if we just add these TEST_ONLY flag tests to these igt tests and forget this one that just tests if the test was successful or not?

Yes. But we should also probably determine what we want to test.

Easiest might just be to do each commit twice, once with TEST_ONLY, followed by the same commit done normally.

Maybe we could create a test mode for this in igt core that can be toggled, that performs any atomic commit twice?

Plugging that in would be a whole lot less invasive, only adding a single line to each changed test.

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