diff mbox

[i-g-t,2/2] kms_pipe_crc_basic: Skip sequence tests if the source doesn't provide frame numbers

Message ID 20170320075404.22453-2-tomeu.vizoso@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomeu Vizoso March 20, 2017, 7:54 a.m. UTC
Some frame sources such as sinks aren't able to provide meaningful frame
numbers, so in those cases just skip the TEST_SEQUENCE tests.

v2: Rebased

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
 tests/kms_pipe_crc_basic.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index 49e856abbf4c..5a01fc6c2777 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -89,7 +89,7 @@  static void test_bad_source(data_t *data)
 #define TEST_SEQUENCE (1<<0)
 #define TEST_NONBLOCK (1<<1)
 
-static void
+static bool
 test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
 			 unsigned flags)
 {
@@ -167,9 +167,23 @@  test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
 		for (j = 0; j < (n_crcs - 1); j++)
 			igt_assert_crc_equal(&crcs[j], &crcs[j + 1]);
 
-		if (flags & TEST_SEQUENCE)
-			for (j = 0; j < (n_crcs - 1); j++)
-				igt_assert_eq(crcs[j].frame + 1, crcs[j + 1].frame);
+		if (flags & TEST_SEQUENCE) {
+			if (!crcs[0].has_valid_frame) {
+				igt_info("Skipping connector, its 'auto' source doesn't give us frame numbers.\n");
+
+				free(crcs);
+				igt_remove_fb(data->drm_fd, &data->fb);
+				igt_plane_set_fb(primary, NULL);
+
+				igt_output_set_pipe(output, PIPE_ANY);
+
+				return false;
+			} else {
+				for (j = 0; j < (n_crcs - 1); j++)
+					igt_assert_eq(crcs[j].frame + 1,
+				crcs[j + 1].frame);
+			}
+		}
 
 		free(crcs);
 		igt_remove_fb(data->drm_fd, &data->fb);
@@ -177,6 +191,8 @@  test_read_crc_for_output(data_t *data, int pipe, igt_output_t *output,
 
 		igt_output_set_pipe(output, PIPE_ANY);
 	}
+
+	return true;
 }
 
 static void test_read_crc(data_t *data, int pipe, unsigned flags)
@@ -193,8 +209,8 @@  static void test_read_crc(data_t *data, int pipe, unsigned flags)
 			 igt_subtest_name(), igt_output_name(output),
 			 kmstest_pipe_name(pipe));
 
-		test_read_crc_for_output(data, pipe, output, flags);
-		valid_connectors ++;
+		if (test_read_crc_for_output(data, pipe, output, flags))
+			valid_connectors ++;
 	}
 
 	igt_require_f(valid_connectors, "No connector found for pipe %i\n", pipe);