public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] tests/kms_plane: Make sure the crcs aren't all equal
Date: Thu,  2 May 2019 23:06:48 +0300	[thread overview]
Message-ID: <20190502200648.14693-1-ville.syrjala@linux.intel.com> (raw)

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

             reply	other threads:[~2019-05-02 20:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-02 20:06 Ville Syrjala [this message]
2019-05-02 21:56 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/kms_plane: Make sure the crcs aren't all equal 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190502200648.14693-1-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox