diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2019-05-02 22:20:20 +0300 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2019-06-12 20:32:13 +0300 |
commit | 495287320225e7f180d384cad7b207b77154438f (patch) | |
tree | 493ff7bfe8728cb9f3ed05214a64ee5fc4a1d3fb /tests/kms_plane.c | |
parent | 1011614804818c99ac07e93d2afa5059d846ef6f (diff) |
tests/kms_plane: Make sure the crcs aren't all equal
Make sure there is at least one unique crc among the set of
reference crcs. This avoids the test succeeding when the plane
is never even on, as happened with SDR planes on icl after
I fumbled switchhing the pipe HDR and non-HDR modes.
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Simon Ser <simon.ser@intel.com>
Diffstat (limited to 'tests/kms_plane.c')
-rw-r--r-- | tests/kms_plane.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/kms_plane.c b/tests/kms_plane.c index 6f30a95e..59d5f1e8 100644 --- a/tests/kms_plane.c +++ b/tests/kms_plane.c @@ -481,6 +481,25 @@ static void test_format_plane_color(data_t *data, enum pipe pipe, igt_remove_fb(data->drm_fd, &old_fb); } +static int num_unique_crcs(const igt_crc_t crc[], int num_crc) +{ + int num_unique_crc = 0; + + for (int i = 0; i < num_crc; i++) { + int j; + + for (j = i + 1; j < num_crc; j++) { + if (igt_check_crc_equal(&crc[i], &crc[j])) + break; + } + + if (j == num_crc) + num_unique_crc++; + } + + return num_unique_crc; +} + static bool test_format_plane(data_t *data, enum pipe pipe, igt_output_t *output, igt_plane_t *plane) { @@ -553,6 +572,13 @@ static bool test_format_plane(data_t *data, enum pipe pipe, i, &ref_crc[i], &fb); } + /* + * Make sure we have some difference between the colors. This + * at least avoids claiming success when everything is just + * black all the time (eg. if the plane is never even on). + */ + igt_require(num_unique_crcs(ref_crc, ARRAY_SIZE(colors)) > 1); + for (int i = 0; i < plane->format_mod_count; i++) { int crc_mismatch_count = 0; int crc_mismatch_mask = 0; |