diff mbox

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

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

Commit Message

Tomeu Vizoso March 8, 2017, 1:30 p.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.

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

Comments

Robert Foss March 9, 2017, 9:25 p.m. UTC | #1
Reviewed-by: Robert Foss <robert.foss@collabora.com>

On 2017-03-08 08:30 AM, Tomeu Vizoso wrote:
> Some frame sources such as sinks aren't able to provide meaningful frame
> numbers, so in those cases just skip the TEST_SEQUENCE tests.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> ---
>  tests/kms_pipe_crc_basic.c | 29 +++++++++++++++++++++++------
>  1 file changed, 23 insertions(+), 6 deletions(-)
>
> diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
> index d0dc2a1b58cf..415efd90330c 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)
>  {
> @@ -163,9 +163,24 @@ 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_pipe_crc_free(pipe_crc);
> +				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_pipe_crc_free(pipe_crc);
> @@ -174,6 +189,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)
> @@ -190,8 +207,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);
>
diff mbox

Patch

diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index d0dc2a1b58cf..415efd90330c 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)
 {
@@ -163,9 +163,24 @@  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_pipe_crc_free(pipe_crc);
+				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_pipe_crc_free(pipe_crc);
@@ -174,6 +189,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)
@@ -190,8 +207,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);