public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t] tests/kms_plane: Make sure the crcs aren't all equal
@ 2019-05-02 20:06 Ville Syrjala
  2019-05-02 21:56 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Ville Syrjala @ 2019-05-02 20:06 UTC (permalink / raw)
  To: igt-dev

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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>
---
 tests/kms_plane.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 471bcbeb8f77..29a768d7830c 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -448,6 +448,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)
 {
@@ -520,6 +539,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;
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2019-06-12 15:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-02 20:06 [igt-dev] [PATCH i-g-t] tests/kms_plane: Make sure the crcs aren't all equal Ville Syrjala
2019-05-02 21:56 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2019-05-03  3:25 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-06-03 15:15 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_plane: Make sure the crcs aren't all equal (rev2) Patchwork
2019-06-04  0:18 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-06-12 15:16   ` Ville Syrjälä
2019-06-12 15:38 ` [igt-dev] [PATCH i-g-t] tests/kms_plane: Make sure the crcs aren't all equal Ser, Simon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox