Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: igt-dev@lists.freedesktop.org
Cc: Pekka Paalanen <ppaalanen@gmail.com>, Maxime Ripard <maxime@cerno.tech>
Subject: [igt-dev] [PATCH i-g-t 6/8] tests/kms_writeback: Dump the frames if the don't match
Date: Tue,  8 Mar 2022 16:21:39 +0100	[thread overview]
Message-ID: <20220308152141.2457841-7-maxime@cerno.tech> (raw)
In-Reply-To: <20220308152141.2457841-1-maxime@cerno.tech>

The writeback tests will make sure the reference and captured frames
match. If they don't however, we don't get anything but their hash which
isn't really helpful.

Add a function similar to chamelium_assert_crc_eq_or_dump() to dump the
PNG and raw buffers of those two frames if they don't match and frame
dumping has been enabled.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 tests/kms_writeback.c | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/tests/kms_writeback.c b/tests/kms_writeback.c
index faa790cc0f72..2366692865b7 100644
--- a/tests/kms_writeback.c
+++ b/tests/kms_writeback.c
@@ -256,6 +256,39 @@ static void get_and_wait_out_fence(igt_output_t *output)
 	output->writeback_out_fence_fd = -1;
 }
 
+static void writeback_assert_crtc_eq_or_dump(igt_crc_t *reference_crc,
+					     igt_fb_t *reference_fb,
+					     igt_crc_t *capture_crc,
+					     igt_fb_t *capture_fb)
+{
+	bool eq;
+
+	eq = igt_check_crc_equal(reference_crc, capture_crc);
+	if (!eq) {
+		cairo_surface_t *reference, *capture;
+		char *reference_suffix, *capture_suffix;
+
+		reference = igt_get_cairo_surface(reference_fb->fd, reference_fb);
+		igt_assert(reference);
+
+		capture = igt_get_cairo_surface(capture_fb->fd, capture_fb);
+		igt_assert(capture);
+
+		reference_suffix = igt_crc_to_string_extended(reference_crc, '-', 2);
+		capture_suffix = igt_crc_to_string_extended(capture_crc, '-', 2);
+
+		/* Write reference and capture frames to png. */
+		igt_write_compared_frames(reference, capture,
+					  reference_suffix,
+					  capture_suffix);
+
+		free(reference_suffix);
+		free(capture_suffix);
+	}
+
+	igt_assert(eq);
+}
+
 static void writeback_sequence(igt_output_t *output, igt_plane_t *plane,
 				igt_fb_t *in_fb, igt_fb_t *out_fbs[], int n_commits)
 {
@@ -303,7 +336,8 @@ static void writeback_sequence(igt_output_t *output, igt_plane_t *plane,
 		if (out_fbs[i]) {
 			igt_crc_t out_after;
 			igt_fb_get_fnv1a_crc(out_fbs[i], &out_after);
-			igt_assert_crc_equal(&out_expected, &out_after);
+			writeback_assert_crtc_eq_or_dump(&out_expected, in_fb,
+							 &out_after, out_fbs[i]);
 
 			/* And clear it, for the next time */
 			fill_fb(out_fbs[i], clear_color);
-- 
2.35.1

  parent reply	other threads:[~2022-03-08 15:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 15:21 [igt-dev] [PATCH i-g-t 0/8] Writeback fixes and improvements Maxime Ripard
2022-03-08 15:21 ` [igt-dev] [PATCH i-g-t 1/8] lib/igt_frame: Rename summary fd variable Maxime Ripard
2022-03-08 15:21 ` [igt-dev] [PATCH i-g-t 2/8] lib/igt_frame: Move frame dump logging to function Maxime Ripard
2022-03-08 15:21 ` [igt-dev] [PATCH i-g-t 3/8] lib/igt_frame: Move frame path creation " Maxime Ripard
2022-03-08 15:21 ` [igt-dev] [PATCH i-g-t 4/8] lib/igt_frame: Add function to dump frames in RGB and raw Maxime Ripard
2022-03-08 15:21 ` [igt-dev] [PATCH i-g-t 5/8] tests/kms_writeback: Use endianness accessor to fill pixels Maxime Ripard
2022-03-08 15:21 ` Maxime Ripard [this message]
2022-03-08 15:21 ` [igt-dev] [PATCH i-g-t 7/8] lib/igt_fb: Ignore the X component when computing CRC Maxime Ripard
2022-03-08 15:21 ` [igt-dev] [PATCH i-g-t 8/8] tests/kms_writeback: Use a garbage X value to create fill our test buffer Maxime Ripard
2022-03-08 21:36 ` [igt-dev] ✓ Fi.CI.BAT: success for Writeback fixes and improvements Patchwork
2022-03-09  4:07 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20220308152141.2457841-7-maxime@cerno.tech \
    --to=maxime@cerno.tech \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=ppaalanen@gmail.com \
    /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