All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 0/5] Validate TEST_ONLY correctness against full atomic commit
@ 2016-12-30 12:00 Mika Kahola
  2016-12-30 12:00 ` [PATCH i-g-t 1/5] tests/kms_plane_multiple: Add TEST_ONLY flag Mika Kahola
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Mika Kahola @ 2016-12-30 12:00 UTC (permalink / raw)
  To: intel-gfx

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

-- 
2.7.4

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH i-g-t 1/5] tests/kms_plane_multiple: Add TEST_ONLY flag
  2016-12-30 12:00 [PATCH i-g-t 0/5] Validate TEST_ONLY correctness against full atomic commit Mika Kahola
@ 2016-12-30 12:00 ` Mika Kahola
  2017-01-12 13:45   ` Maarten Lankhorst
  2016-12-30 12:00 ` [PATCH i-g-t 2/5] tests/kms_atomic_transition: " Mika Kahola
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Mika Kahola @ 2016-12-30 12:00 UTC (permalink / raw)
  To: intel-gfx

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

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 tests/kms_plane_multiple.c | 79 ++++++++++++++++++++++++++++------------------
 1 file changed, 49 insertions(+), 30 deletions(-)

diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
index 5e12be4..1a77a38 100644
--- a/tests/kms_plane_multiple.c
+++ b/tests/kms_plane_multiple.c
@@ -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);
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH i-g-t 2/5] tests/kms_atomic_transition: Add TEST_ONLY flag
  2016-12-30 12:00 [PATCH i-g-t 0/5] Validate TEST_ONLY correctness against full atomic commit Mika Kahola
  2016-12-30 12:00 ` [PATCH i-g-t 1/5] tests/kms_plane_multiple: Add TEST_ONLY flag Mika Kahola
@ 2016-12-30 12:00 ` Mika Kahola
  2016-12-30 12:00 ` [PATCH i-g-t 3/5] tests/kms_plane_scaling: " Mika Kahola
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 11+ messages in thread
From: Mika Kahola @ 2016-12-30 12:00 UTC (permalink / raw)
  To: intel-gfx

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

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 tests/kms_atomic_transition.c | 227 ++++++++++++++++++++++++++++--------------
 1 file changed, 152 insertions(+), 75 deletions(-)

diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 851ffc9..2505210 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -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 {
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH i-g-t 3/5] tests/kms_plane_scaling: Add TEST_ONLY flag
  2016-12-30 12:00 [PATCH i-g-t 0/5] Validate TEST_ONLY correctness against full atomic commit Mika Kahola
  2016-12-30 12:00 ` [PATCH i-g-t 1/5] tests/kms_plane_multiple: Add TEST_ONLY flag Mika Kahola
  2016-12-30 12:00 ` [PATCH i-g-t 2/5] tests/kms_atomic_transition: " Mika Kahola
@ 2016-12-30 12:00 ` Mika Kahola
  2016-12-30 12:00 ` [PATCH i-g-t 4/5] tests/kms_rotation_crc: " Mika Kahola
  2016-12-30 12:00 ` [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit Mika Kahola
  4 siblings, 0 replies; 11+ messages in thread
From: Mika Kahola @ 2016-12-30 12:00 UTC (permalink / raw)
  To: intel-gfx

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

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 tests/kms_plane_scaling.c | 152 ++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 135 insertions(+), 17 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index 368da09..ae3ce40 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -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);
 }
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH i-g-t 4/5] tests/kms_rotation_crc: Add TEST_ONLY flag
  2016-12-30 12:00 [PATCH i-g-t 0/5] Validate TEST_ONLY correctness against full atomic commit Mika Kahola
                   ` (2 preceding siblings ...)
  2016-12-30 12:00 ` [PATCH i-g-t 3/5] tests/kms_plane_scaling: " Mika Kahola
@ 2016-12-30 12:00 ` Mika Kahola
  2016-12-30 12:00 ` [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit Mika Kahola
  4 siblings, 0 replies; 11+ messages in thread
From: Mika Kahola @ 2016-12-30 12:00 UTC (permalink / raw)
  To: intel-gfx

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

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 tests/kms_rotation_crc.c | 282 +++++++++++++++++++++++++++++++++++++----------
 1 file changed, 222 insertions(+), 60 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 796b448..434f845 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -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 {
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit
  2016-12-30 12:00 [PATCH i-g-t 0/5] Validate TEST_ONLY correctness against full atomic commit Mika Kahola
                   ` (3 preceding siblings ...)
  2016-12-30 12:00 ` [PATCH i-g-t 4/5] tests/kms_rotation_crc: " Mika Kahola
@ 2016-12-30 12:00 ` Mika Kahola
  2017-01-12 10:11   ` Maarten Lankhorst
  4 siblings, 1 reply; 11+ messages in thread
From: Mika Kahola @ 2016-12-30 12:00 UTC (permalink / raw)
  To: intel-gfx

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.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 tests/Makefile.sources |   1 +
 tests/kms_test_only.c  | 455 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 456 insertions(+)
 create mode 100644 tests/kms_test_only.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 6316ea6..ff599c3 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -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 \
diff --git a/tests/kms_test_only.c b/tests/kms_test_only.c
new file mode 100644
index 0000000..1ae835e
--- /dev/null
+++ b/tests/kms_test_only.c
@@ -0,0 +1,455 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include "igt.h"
+#include "drmtest.h"
+#include <errno.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+
+IGT_TEST_DESCRIPTION("Test atomic mode setting with a TEST_ONLY flag");
+
+#define LOOP_FOREVER     -1
+
+#define FAIL   -1
+#define SKIP    0
+#define SUCCESS 1
+
+/* Command line parameters. */
+struct {
+	int iterations;
+} opt = {
+	.iterations = 64,
+};
+
+static
+int parse_output(char *testname)
+{
+	FILE *fid;
+	char output[1024];
+	char result[32];
+
+	fid = popen(testname, "r");
+	igt_assert(fid != NULL);
+
+	while (fgets(output, sizeof(output)-1, fid) != NULL) {
+		if (strstr(output, "Subtest")) {
+			sscanf(output, "%*s %*s %s%*c", result);
+
+			if (strncmp(result, "FAIL", 4) == 0) {
+				pclose(fid);
+				return FAIL;
+			} else if (strncmp(result, "SKIP", 4) == 0) {
+				pclose(fid);
+				return SKIP;
+			} else if (strncmp(result, "SUCCESS", 7) == 0) {
+				pclose(fid);
+				return SUCCESS;
+			}
+		} else if (strstr(output, "Test requirement not met in function")) {
+			pclose(fid);
+			return SKIP;
+		}
+	}
+
+	pclose(fid);
+
+	return -EINVAL;
+}
+
+static
+void test_kms_rotation_crc(void)
+{
+	int ret;
+	char testname[256];
+
+	strcpy(testname, "kms_rotation_crc --run-subtest primary-rotation-180-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest primary-rotation-180");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest sprite-rotation-180-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest sprite-rotation-180");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest cursor-rotation-180-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest cursor-rotation-180");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest primary-rotation-90-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest primary-rotation-90");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest primary-rotation-270-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest primary-rotation-270");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest sprite-rotation-90-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest sprite-rotation-90");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest sprite-rotation-270-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest sprite-rotation-270");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest sprite-rotation-90-pos-100-0-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest sprite-rotation-90-pos-100-0");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest bad-pixel-format-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest bad-pixel-format");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest bad-tiling-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest bad-tiling");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest primary-rotation-90-flip-stress-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest primary-rotation-90-flip-stress");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest primary-rotation-90-Y-tiled-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest primary-rotation-90-Y-tiled");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_rotation_crc --run-subtest exhaust-fences-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_rotation_crc --run-subtest exhaust-fences");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+}
+
+static
+void test_kms_atomic_transition(void)
+{
+	int ret;
+	char testname[256];
+
+	strcpy(testname, "kms_atomic_transition --run-subtest plane-all-transition-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_atomic_transition --run-subtest plane-all-transition");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_atomic_transition --run-subtest plane-all-transition-nonblocking-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_atomic_transition --run-subtest plane-all-transition-nonblocking");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_atomic_transition --run-subtest plane-all-modeset-transition-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_atomic_transition --run-subtest plane-all-modeset-transition");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	strcpy(testname, "kms_atomic_transition --run-subtest plane-toggle-modeset-transition-test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_atomic_transition --run-subtest plane-toggle-modeset-transition");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+
+	for (int i = 1; i <= I915_MAX_PIPES; i++) {
+		sprintf(testname, "kms_atomic_transition --run-subtest %ix-modeset-transitions-test-only", i);
+		ret = parse_output(testname);
+		if (ret == SKIP)
+			return;
+
+		if (ret == FAIL) {
+			igt_info("%s failed. Trying with real atomic commit\n", testname);
+			sprintf(testname, "kms_atomic_transition --run-subtest %ix-modeset-transitions", i);
+			ret = parse_output(testname);
+			igt_assert_eq(ret, FAIL);
+		}
+
+		sprintf(testname, "kms_atomic_transition --run-subtest %ix-modeset-transitions-nonblocking-test-only", i);
+		ret = parse_output(testname);
+		if (ret == SKIP)
+			return;
+
+		if (ret == FAIL) {
+			igt_info("%s failed. Trying with real atomic commit\n", testname);
+			sprintf(testname, "kms_atomic_transition --run-subtest %ix-modeset-transitions-nonblocking", i);
+			ret = parse_output(testname);
+			igt_assert_eq(ret, FAIL);
+		}
+	}
+}
+
+static
+void test_kms_plane_scaling(void)
+{
+	int ret;
+	char testname[256];
+
+	strcpy(testname, "kms_plane_scaling --test-only");
+	ret = parse_output(testname);
+	if (ret == SKIP)
+		return;
+
+	if (ret == FAIL) {
+		igt_info("%s failed. Trying with real atomic commit\n", testname);
+		strcpy(testname, "kms_plane_scaling");
+		ret = parse_output(testname);
+		igt_assert_eq(ret, FAIL);
+	}
+}
+
+static
+void test_kms_plane_multiple(void)
+{
+	char testname[256];
+	const char *tiling_list[4] = {"none", "x", "y", "yf"};
+	int ret;
+
+	for (int pipe = 0; pipe < I915_MAX_PIPES; pipe++) {
+		for (int tiling = 0; tiling < 4; tiling++) {
+			for (int plane = IGT_PLANE_PRIMARY; plane < IGT_MAX_PLANES; plane++) {
+				sprintf(testname, "kms_plane_multiple --run-subtest atomic-pipe-%s-tiling-%s-planes-%d --iterations 1 --test-only",
+					kmstest_pipe_name(pipe), tiling_list[tiling], plane);
+
+				ret = parse_output(testname);
+
+				if (ret == SKIP)
+					return;
+
+				if (ret == FAIL) {
+					igt_info("%s failed. Trying with real atomic commit\n", testname);
+					sprintf(testname, "kms_plane_multiple --run-subtest atomic-pipe-%s-tiling-%s-planes-%d --iterations 1",
+						kmstest_pipe_name(pipe), tiling_list[tiling], plane);
+					ret = parse_output(testname);
+					igt_assert_eq(ret, FAIL);
+				}
+			}
+		}
+	}
+}
+
+static
+int run_test(int index)
+{
+	switch (index) {
+	case 0:
+		igt_info("testing kms_plane_multiple\n");
+		test_kms_plane_multiple();
+		return 0;
+	case 1:
+		igt_info("testing kms_atomic_transition\n");
+		test_kms_atomic_transition();
+		return 1;
+	case 2:
+		igt_info("testing kms_plane_scaling\n");
+		test_kms_plane_scaling();
+		return 2;
+	case 3:
+		igt_info("testing kms_rotation_crc\n");
+		test_kms_rotation_crc();
+		return 3;
+	default:
+		igt_assert(false);
+	}
+}
+
+static int opt_handler(int option, int option_index, void *input)
+{
+	switch (option) {
+	case 'i':
+		opt.iterations = strtol(optarg, NULL, 0);
+
+		if (opt.iterations < LOOP_FOREVER || opt.iterations == 0) {
+			igt_info("incorrect number of iterations\n");
+			igt_assert(false);
+		}
+		break;
+	default:
+		igt_assert(false);
+	}
+
+	return 0;
+}
+
+const char *help_str =
+	"  --iterations Number of iterations for test coverage. -1 loop forever, default 64 iterations\n";
+
+int main(int argc, char *argv[])
+{
+	int i;
+	bool loop_forever;
+
+	struct option long_options[] = {
+		{ "iterations", required_argument, NULL, 'i'},
+		{ 0, 0, 0, 0 }
+	};
+
+	if (opt.iterations == LOOP_FOREVER) {
+		loop_forever = true;
+		opt.iterations =  1;
+	} else {
+		loop_forever = false;
+	}
+
+	igt_subtest_init_parse_opts(&argc, argv, "", long_options, help_str,
+				    opt_handler, NULL);
+
+	igt_skip_on_simulation();
+
+	srand(time(NULL));
+
+	i = 0;
+	while (i < opt.iterations || loop_forever) {
+		run_test(rand() % 4);
+		i++;
+	}
+
+	igt_success();
+
+	igt_exit();
+}
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit
  2016-12-30 12:00 ` [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit Mika Kahola
@ 2017-01-12 10:11   ` Maarten Lankhorst
       [not found]     ` <1484216887.9014.8.camel@intel.com>
  0 siblings, 1 reply; 11+ messages in thread
From: Maarten Lankhorst @ 2017-01-12 10:11 UTC (permalink / raw)
  To: Mika Kahola, intel-gfx

Op 30-12-16 om 13:00 schreef 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.
>
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit
       [not found]     ` <1484216887.9014.8.camel@intel.com>
@ 2017-01-12 11:37       ` Maarten Lankhorst
  2017-01-23 13:26         ` Mika Kahola
  0 siblings, 1 reply; 11+ messages in thread
From: Maarten Lankhorst @ 2017-01-12 11:37 UTC (permalink / raw)
  To: mika.kahola; +Cc: Intel Graphics Development

Hey,

Op 12-01-17 om 11:28 schreef Mika Kahola:
> On Thu, 2017-01-12 at 11:11 +0100, Maarten Lankhorst wrote:
>> Op 30-12-16 om 13:00 schreef 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.
>>>
>>> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
>>> ---
>>>  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?
> 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. 
>> 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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH i-g-t 1/5] tests/kms_plane_multiple: Add TEST_ONLY flag
  2016-12-30 12:00 ` [PATCH i-g-t 1/5] tests/kms_plane_multiple: Add TEST_ONLY flag Mika Kahola
@ 2017-01-12 13:45   ` Maarten Lankhorst
  0 siblings, 0 replies; 11+ messages in thread
From: Maarten Lankhorst @ 2017-01-12 13:45 UTC (permalink / raw)
  To: Mika Kahola, intel-gfx

Op 30-12-16 om 13:00 schreef Mika Kahola:
> Add TEST_ONLY flag to test atomic modesetting commits without
> actual real-life commit.
>
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> ---
>  tests/kms_plane_multiple.c | 79 ++++++++++++++++++++++++++++------------------
>  1 file changed, 49 insertions(+), 30 deletions(-)
>
> diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c
> index 5e12be4..1a77a38 100644
> --- a/tests/kms_plane_multiple.c
> +++ b/tests/kms_plane_multiple.c
> @@ -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;
I would only pass ALLOW_MODESET for the TEST_ONLY case.
>  	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.
>  	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. :)
> -		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);
I'm pretty sure the legacy tests don't work with 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 }
>  	};
I think it's best to just list the tests twice, once normal and once with test-only in the test name?
> @@ -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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit
  2017-01-12 11:37       ` Maarten Lankhorst
@ 2017-01-23 13:26         ` Mika Kahola
  2017-01-23 15:35           ` Maarten Lankhorst
  0 siblings, 1 reply; 11+ messages in thread
From: Mika Kahola @ 2017-01-23 13:26 UTC (permalink / raw)
  To: Maarten Lankhorst; +Cc: Intel Graphics Development

On Thu, 2017-01-12 at 12:37 +0100, Maarten Lankhorst wrote:
> Hey,
> 
> Op 12-01-17 om 11:28 schreef Mika Kahola:
> > 
> > On Thu, 2017-01-12 at 11:11 +0100, Maarten Lankhorst wrote:
> > > 
> > > Op 30-12-16 om 13:00 schreef 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.
> > > > 
> > > > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> > > > ---
> > > >  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?
> > 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. 
> > > 
> > > 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. :-)
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?

> 
> ~Maarten
-- 
Mika Kahola - Intel OTC

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit
  2017-01-23 13:26         ` Mika Kahola
@ 2017-01-23 15:35           ` Maarten Lankhorst
  0 siblings, 0 replies; 11+ messages in thread
From: Maarten Lankhorst @ 2017-01-23 15:35 UTC (permalink / raw)
  To: mika.kahola; +Cc: Intel Graphics Development

Op 23-01-17 om 14:26 schreef Mika Kahola:
> On Thu, 2017-01-12 at 12:37 +0100, Maarten Lankhorst wrote:
>> Hey,
>>
>> Op 12-01-17 om 11:28 schreef Mika Kahola:
>>> On Thu, 2017-01-12 at 11:11 +0100, Maarten Lankhorst wrote:
>>>> Op 30-12-16 om 13:00 schreef 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.
>>>>>
>>>>> Signed-off-by: Mika Kahola <mika.kahola@intel.com>
>>>>> ---
>>>>>  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?
>>> 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. 
>>>> 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. :-)
> 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
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-01-23 15:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-30 12:00 [PATCH i-g-t 0/5] Validate TEST_ONLY correctness against full atomic commit Mika Kahola
2016-12-30 12:00 ` [PATCH i-g-t 1/5] tests/kms_plane_multiple: Add TEST_ONLY flag Mika Kahola
2017-01-12 13:45   ` Maarten Lankhorst
2016-12-30 12:00 ` [PATCH i-g-t 2/5] tests/kms_atomic_transition: " Mika Kahola
2016-12-30 12:00 ` [PATCH i-g-t 3/5] tests/kms_plane_scaling: " Mika Kahola
2016-12-30 12:00 ` [PATCH i-g-t 4/5] tests/kms_rotation_crc: " Mika Kahola
2016-12-30 12:00 ` [PATCH i-g-t 5/5] tests/kms_test_only: Validate TEST_ONLY correctness against full atomic commit Mika Kahola
2017-01-12 10:11   ` Maarten Lankhorst
     [not found]     ` <1484216887.9014.8.camel@intel.com>
2017-01-12 11:37       ` Maarten Lankhorst
2017-01-23 13:26         ` Mika Kahola
2017-01-23 15:35           ` Maarten Lankhorst

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.