igt/tests/kms_chamelium: Add some more verbosity, to understand what is the actual issue with frame mismatch.

Submitted by Stanislav Lisovskiy on May 8, 2019, 8:41 a.m.

Details

Message ID 20190508084132.8345-1-stanislav.lisovskiy@intel.com
State New
Headers show
Series "igt/tests/kms_chamelium: Add some more verbosity, to understand what is the actual issue with frame mismatch." ( rev: 1 ) in IGT - Trybot

Not browsing as part of any series.

Commit Message

Stanislav Lisovskiy May 8, 2019, 8:41 a.m.
---
 lib/igt_chamelium.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/igt_chamelium.c b/lib/igt_chamelium.c
index ffc68f35..fec85407 100644
--- a/lib/igt_chamelium.c
+++ b/lib/igt_chamelium.c
@@ -1181,7 +1181,8 @@  void chamelium_assert_frame_eq(const struct chamelium *chamelium,
 	cairo_surface_t *fb_surface;
 	pixman_image_t *reference_src, *reference_bgr;
 	int w = dump->width, h = dump->height;
-	bool eq;
+	bool eq = 0;
+	int i;
 
 	/* Get the cairo surface for the framebuffer */
 	fb_surface = igt_get_cairo_surface(chamelium->drm_fd, fb);
@@ -1198,8 +1199,16 @@  void chamelium_assert_frame_eq(const struct chamelium *chamelium,
 	pixman_image_unref(reference_src);
 
 	/* Now do the actual comparison */
-	eq = memcmp(dump->bgr, pixman_image_get_data(reference_bgr),
-		    dump->size) == 0;
+	for (i = 0; i < dump->size; i++) {
+		uint8_t * reference_ptr = (uint8_t *)pixman_image_get_data(reference_bgr);
+		uint8_t * bgr_ptr = (uint8_t *)dump->bgr;
+		if (reference_ptr[i] != bgr_ptr[i]) {
+			eq = 1;
+			igt_info("Wrong frame dump at offset %d(size %d): %x should be %x\n", i,
+					dump->size, bgr_ptr[i], reference_ptr[i]);
+			break;
+		}
+	}
 
 	pixman_image_unref(reference_bgr);