public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option
       [not found] <20190221002857.5007-1-matthew.d.roper@intel.com>
@ 2019-02-21  0:34 ` Matt Roper
  2019-02-21  0:34   ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_crtc_background_color: overhaul to match upstream ABI (v5) Matt Roper
                     ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Matt Roper @ 2019-02-21  0:34 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev

When using --interactive-debug, it's sometimes desirable to ignore CRC
mismatches and let the test proceed as if they passed so that the
on-screen outcome can be inspected.  Let's add a debug option to allow
this.

Cc: igt-dev@lists.freedesktop.org
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 lib/igt_core.c    | 7 +++++++
 lib/igt_core.h    | 1 +
 lib/igt_debugfs.c | 8 +++++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 71b05d3b..5523950f 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -256,6 +256,7 @@
 
 static unsigned int exit_handler_count;
 const char *igt_interactive_debug;
+bool igt_skip_crc_compare;
 
 /* subtests helpers */
 static bool list_subtests = false;
@@ -285,6 +286,7 @@ enum {
  OPT_DESCRIPTION,
  OPT_DEBUG,
  OPT_INTERACTIVE_DEBUG,
+ OPT_SKIP_CRC,
  OPT_HELP = 'h'
 };
 
@@ -552,6 +554,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
 		   "  --run-subtest <pattern>\n"
 		   "  --debug[=log-domain]\n"
 		   "  --interactive-debug[=domain]\n"
+		   "  --skip-crc-compare\n"
 		   "  --help-description\n"
 		   "  --help\n");
 	if (help_str)
@@ -668,6 +671,7 @@ static int common_init(int *argc, char **argv,
 		{"help-description", 0, 0, OPT_DESCRIPTION},
 		{"debug", optional_argument, 0, OPT_DEBUG},
 		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
+		{"skip-crc-compare", 0, 0, OPT_SKIP_CRC},
 		{"help", 0, 0, OPT_HELP},
 		{0, 0, 0, 0}
 	};
@@ -768,6 +772,9 @@ static int common_init(int *argc, char **argv,
 			print_test_description();
 			ret = -1;
 			goto out;
+		case OPT_SKIP_CRC:
+			igt_skip_crc_compare = true;
+			goto out;
 		case OPT_HELP:
 			print_usage(help_str, false);
 			ret = -1;
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 47ffd9e7..f12fc5cb 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -843,6 +843,7 @@ bool igt_run_in_simulation(void);
 void igt_skip_on_simulation(void);
 
 extern const char *igt_interactive_debug;
+extern bool igt_skip_crc_compare;
 
 /**
  * igt_log_level:
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 640c78e9..04d1648b 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -405,6 +405,12 @@ static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b,
  * assert that CRCs match, never that they are different. Otherwise there might
  * be random testcase failures when different screen contents end up with the
  * same CRC by chance.
+ *
+ * Passing --skip-crc-compare on the command line will force this function
+ * to always pass, which can be useful in interactive debugging where you
+ * might know the test will fail, but still want the test to keep going as if
+ * it had succeeded so that you can see the on-screen behavior.
+ *
  */
 void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
 {
@@ -416,7 +422,7 @@ void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
 		igt_debug("CRC mismatch at index %d: 0x%x != 0x%x\n", index,
 			  a->crc[index], b->crc[index]);
 
-	igt_assert(!mismatch);
+	igt_assert(!mismatch || igt_skip_crc_compare);
 }
 
 /**
-- 
2.14.5

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

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

* [igt-dev] [PATCH i-g-t 2/2] tests/kms_crtc_background_color: overhaul to match upstream ABI (v5)
  2019-02-21  0:34 ` [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option Matt Roper
@ 2019-02-21  0:34   ` Matt Roper
  2019-02-21  0:41     ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_crtc_background_color: overhaul to match upstream ABI (v5.1) Matt Roper
  2019-02-21  9:33   ` [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option Daniel Vetter
  2019-02-22 14:32   ` [Intel-gfx] " Daniel Vetter
  2 siblings, 1 reply; 9+ messages in thread
From: Matt Roper @ 2019-02-21  0:34 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev, Heiko Stuebner, Daniel Vetter

CRTC background color kernel patches were written about 2.5 years ago
and floated on the upstream mailing list, but since no opensource
userspace materialized, we never actually merged them.  However the
corresponding IGT test did get merged and has basically been dead code
ever since.

A couple years later we finally have an open source userspace
(ChromeOS), so lets update the IGT test to match the ABI that's actually
going upstream and to remove some of the cruft from the original test
that wouldn't actually work.

It's worth noting that we don't seem to be able to test this feature
with CRC's, at least on Intel gen9.  Originally we wanted to draw a
color into a plane's FB (with Cairo) and then compare the CRC to turning
off all planes and just setting the CRTC background to the same color.
However the precision and rounding of the color components causes the
CRC's to come out differently, even though the end result is visually
identical.  So at the moment this test is mainly useful for visual
inspection in interactive mode.

v2:
 - Swap red and blue ordering in property value to reflect change
   in v2 of kernel series.

v3:
 - Minor updates to proposed uapi helpers (s/rgba/argb/).

v4:
 - General restructuring into pipe/color subtests.
 - Use RGB2101010 framebuffers for comparison so that we match the bits
   of precision that Intel hardware background color accepts

v5:
 - Re-enable CRC comparisons; just because these don't work on Intel
   doesn't mean we shouldn't use them on other vendors' platforms
   (Daniel).
 - Use DRIVER_ANY rather than DRIVER_INTEL. (Heiko Stuebner)

Cc: igt-dev@lists.freedesktop.org
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 lib/igt_kms.c                     |   2 +-
 tests/kms_crtc_background_color.c | 263 ++++++++++++++++++--------------------
 2 files changed, 127 insertions(+), 138 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 080f90ae..c52ec5e6 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -180,7 +180,7 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
 };
 
 const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
-	[IGT_CRTC_BACKGROUND] = "background_color",
+	[IGT_CRTC_BACKGROUND] = "BACKGROUND_COLOR",
 	[IGT_CRTC_CTM] = "CTM",
 	[IGT_CRTC_GAMMA_LUT] = "GAMMA_LUT",
 	[IGT_CRTC_GAMMA_LUT_SIZE] = "GAMMA_LUT_SIZE",
diff --git a/tests/kms_crtc_background_color.c b/tests/kms_crtc_background_color.c
index 3df3401f..58cdd7a9 100644
--- a/tests/kms_crtc_background_color.c
+++ b/tests/kms_crtc_background_color.c
@@ -25,164 +25,153 @@
 #include "igt.h"
 #include <math.h>
 
-
 IGT_TEST_DESCRIPTION("Test crtc background color feature");
 
+/*
+ * Paints a desired color into a full-screen primary plane and then compares
+ * that CRC with turning off all planes and setting the CRTC background to the
+ * same color.
+ *
+ * At least on current Intel platforms, the CRC tests appear to always fail,
+ * even though the resulting pipe output seems to be the same.  The bspec tells
+ * us that we must have at least one plane turned on when taking a pipe-level
+ * CRC, so the fact that we're violating that may explain the failures.  If
+ * your platform gives failures for all tests, you may want to run with
+ * --interactive-debug=bgcolor --skip-crc-compare to visually inspect that the
+ * background color matches the equivalent solid plane.
+ */
+
 typedef struct {
-	int gfx_fd;
 	igt_display_t display;
-	struct igt_fb fb;
-	igt_crc_t ref_crc;
+	int gfx_fd;
+	igt_output_t *output;
 	igt_pipe_crc_t *pipe_crc;
+	drmModeModeInfo *mode;
 } data_t;
 
-#define BLACK      0x000000           /* BGR 8bpc */
-#define CYAN       0xFFFF00           /* BGR 8bpc */
-#define PURPLE     0xFF00FF           /* BGR 8bpc */
-#define WHITE      0xFFFFFF           /* BGR 8bpc */
-
-#define BLACK64    0x000000000000     /* BGR 16bpc */
-#define CYAN64     0xFFFFFFFF0000     /* BGR 16bpc */
-#define PURPLE64   0xFFFF0000FFFF     /* BGR 16bpc */
-#define YELLOW64   0x0000FFFFFFFF     /* BGR 16bpc */
-#define WHITE64    0xFFFFFFFFFFFF     /* BGR 16bpc */
-#define RED64      0x00000000FFFF     /* BGR 16bpc */
-#define GREEN64    0x0000FFFF0000     /* BGR 16bpc */
-#define BLUE64     0xFFFF00000000     /* BGR 16bpc */
-
-static void
-paint_background(data_t *data, struct igt_fb *fb, drmModeModeInfo *mode,
-		uint32_t background, double alpha)
+/*
+ * Local copy of kernel uapi
+ */
+static inline __u64
+local_argb(__u8 bpc, __u16 alpha, __u16 red, __u16 green, __u16 blue)
 {
-	cairo_t *cr;
-	int w, h;
-	double r, g, b;
-
-	w = mode->hdisplay;
-	h = mode->vdisplay;
-
-	cr = igt_get_cairo_ctx(data->gfx_fd, &data->fb);
+       int msb_shift = 16 - bpc;
 
-	/* Paint with background color */
-	r = (double) (background & 0xFF) / 255.0;
-	g = (double) ((background & 0xFF00) >> 8) / 255.0;
-	b = (double) ((background & 0xFF0000) >> 16) / 255.0;
-	igt_paint_color_alpha(cr, 0, 0, w, h, r, g, b, alpha);
-
-	igt_put_cairo_ctx(data->gfx_fd, &data->fb, cr);
+       return (__u64)alpha << msb_shift << 48 |
+              (__u64)red   << msb_shift << 32 |
+              (__u64)green << msb_shift << 16 |
+              (__u64)blue  << msb_shift;
 }
 
-static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
-			igt_plane_t *plane, int opaque_buffer, int plane_color,
-			uint64_t pipe_background_color)
+static void test_background(data_t *data, enum pipe pipe, int w, int h,
+			    __u64 r, __u64 g, __u64 b)
 {
-	drmModeModeInfo *mode;
-	igt_display_t *display = &data->display;
-	int fb_id;
-	double alpha;
-
-	igt_output_set_pipe(output, pipe);
-
-	/* create the pipe_crc object for this pipe */
-	igt_pipe_crc_free(data->pipe_crc);
-	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
-
-	mode = igt_output_get_mode(output);
-
-	fb_id = igt_create_fb(data->gfx_fd,
-			mode->hdisplay, mode->vdisplay,
-			DRM_FORMAT_XRGB8888,
-			LOCAL_DRM_FORMAT_MOD_NONE, /* tiled */
-			&data->fb);
-	igt_assert(fb_id);
-
-	/* To make FB pixel win with background color, set alpha as full opaque */
-	igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, pipe_background_color);
-	if (opaque_buffer)
-		alpha = 1.0;    /* alpha 1 is fully opque */
-	else
-		alpha = 0.0;    /* alpha 0 is fully transparent */
-	paint_background(data, &data->fb, mode, plane_color, alpha);
-
-	igt_plane_set_fb(plane, &data->fb);
-	igt_display_commit2(display, COMMIT_UNIVERSAL);
-}
-
-static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
-{
-	igt_display_t *display = &data->display;
-
-	igt_pipe_crc_free(data->pipe_crc);
-	data->pipe_crc = NULL;
-
-	igt_remove_fb(data->gfx_fd, &data->fb);
-
-	igt_pipe_obj_set_prop_value(plane->pipe, IGT_CRTC_BACKGROUND, BLACK64);
+	igt_crc_t plane_crc, bg_crc;
+	struct igt_fb colorfb;
+	igt_plane_t *plane = igt_output_get_plane_type(data->output,
+						       DRM_PLANE_TYPE_PRIMARY);
+
+
+	/* Fill the primary plane and set the background to the same color */
+	igt_create_color_fb(data->gfx_fd, w, h, DRM_FORMAT_XRGB2101010,
+			    LOCAL_DRM_FORMAT_MOD_NONE,
+			    (double)r / 0xFFFF,
+			    (double)g / 0xFFFF,
+			    (double)b / 0xFFFF,
+			    &colorfb);
+	igt_plane_set_fb(plane, &colorfb);
+	igt_pipe_set_prop_value(&data->display, pipe, IGT_CRTC_BACKGROUND,
+				local_argb(16, 0xffff, r, g, b));
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &plane_crc);
+	igt_debug_wait_for_keypress("bgcolor");
+
+	/* Turn off the primary plane so only bg shows */
 	igt_plane_set_fb(plane, NULL);
-	igt_output_set_pipe(output, PIPE_ANY);
-
-	igt_display_commit2(display, COMMIT_UNIVERSAL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &bg_crc);
+	igt_debug_wait_for_keypress("bgcolor");
+
+	/*
+	 * The following test relies on hardware that generates valid CRCs
+	 * even when no planes are on.  Sadly, this doesn't appear to be the
+	 * case for current Intel platforms; pipe CRC's never match bgcolor
+	 * CRC's, likely because we're violating the bspec's guidance that there
+	 * must always be at least one real plane turned on when taking the
+	 * pipe-level ("dmux") CRC.
+	 */
+	igt_assert_crc_equal(&plane_crc, &bg_crc);
 }
 
-static void test_crtc_background(data_t *data)
+igt_main
 {
-	igt_display_t *display = &data->display;
+	data_t data = {};
 	igt_output_t *output;
+	drmModeModeInfo *mode;
+	int w, h;
 	enum pipe pipe;
-	int valid_tests = 0;
-
-	for_each_pipe_with_valid_output(display, pipe, output) {
-		igt_plane_t *plane;
-
-		igt_output_set_pipe(output, pipe);
-
-		plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
-		igt_require(igt_pipe_has_prop(display, pipe, IGT_CRTC_BACKGROUND));
-
-		prepare_crtc(data, output, pipe, plane, 1, PURPLE, BLACK64);
-
-		/* Now set background without using a plane, i.e.,
-		 * Disable the plane to let hw background color win blend. */
-		igt_plane_set_fb(plane, NULL);
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, PURPLE64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
-
-		/* Try few other background colors */
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, CYAN64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
-
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, YELLOW64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
 
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, RED64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
+	igt_fixture {
+		data.gfx_fd = drm_open_driver_master(DRIVER_ANY);
+		kmstest_set_vt_graphics_mode();
 
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, GREEN64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
-
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, BLUE64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
-
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, WHITE64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
-
-		valid_tests++;
-		cleanup_crtc(data, output, plane);
+		igt_require_pipe_crc(data.gfx_fd);
+		igt_display_require(&data.display, data.gfx_fd);
 	}
-	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
-}
 
-igt_simple_main
-{
-	data_t data = {};
-
-	igt_skip_on_simulation();
-
-	data.gfx_fd = drm_open_driver(DRIVER_INTEL);
-	igt_require_pipe_crc(data.gfx_fd);
-	igt_display_require(&data.display, data.gfx_fd);
-
-	test_crtc_background(&data);
+	for_each_pipe_static(pipe) igt_subtest_group {
+		igt_fixture {
+			igt_display_require_output_on_pipe(&data.display, pipe);
+			igt_require(igt_pipe_has_prop(&data.display, pipe,
+						      IGT_CRTC_BACKGROUND));
+
+			output = igt_get_single_output_for_pipe(&data.display,
+								pipe);
+			igt_output_set_pipe(output, pipe);
+			data.output = output;
+
+			mode = igt_output_get_mode(output);
+			w = mode->hdisplay;
+			h = mode->vdisplay;
+
+			data.pipe_crc = igt_pipe_crc_new(data.gfx_fd, pipe,
+							  INTEL_PIPE_CRC_SOURCE_AUTO);
+		}
+
+		igt_subtest_f("background-color-pipe-%s-black",
+			      kmstest_pipe_name(pipe))
+			test_background(&data, pipe, w, h,
+					0, 0, 0);
+
+		igt_subtest_f("background-color-pipe-%s-white",
+			      kmstest_pipe_name(pipe))
+			test_background(&data, pipe, w, h,
+					0xFFFF, 0xFFFF, 0xFFFF);
+
+		igt_subtest_f("background-color-pipe-%s-red",
+			      kmstest_pipe_name(pipe))
+			test_background(&data, pipe, w, h,
+					0xFFFF, 0, 0);
+
+		igt_subtest_f("background-color-pipe-%s-green",
+			      kmstest_pipe_name(pipe))
+
+			test_background(&data, pipe, w, h,
+					0, 0xFFFF, 0);
+
+		igt_subtest_f("background-color-pipe-%s-blue",
+			      kmstest_pipe_name(pipe))
+			test_background(&data, pipe, w, h,
+					0, 0, 0xFFFF);
+
+		igt_fixture {
+			igt_display_reset(&data.display);
+			igt_pipe_crc_free(data.pipe_crc);
+			data.pipe_crc = NULL;
+		}
+	}
 
-	igt_display_fini(&data.display);
+	igt_fixture {
+		igt_display_fini(&data.display);
+	}
 }
-- 
2.14.5

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

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

* [igt-dev] [PATCH i-g-t 2/2] tests/kms_crtc_background_color: overhaul to match upstream ABI (v5.1)
  2019-02-21  0:34   ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_crtc_background_color: overhaul to match upstream ABI (v5) Matt Roper
@ 2019-02-21  0:41     ` Matt Roper
  0 siblings, 0 replies; 9+ messages in thread
From: Matt Roper @ 2019-02-21  0:41 UTC (permalink / raw)
  To: intel-gfx; +Cc: igt-dev, Heiko Stuebner, Daniel Vetter

CRTC background color kernel patches were written about 2.5 years ago
and floated on the upstream mailing list, but since no opensource
userspace materialized, we never actually merged them.  However the
corresponding IGT test did get merged and has basically been dead code
ever since.

A couple years later we finally have an open source userspace
(ChromeOS), so lets update the IGT test to match the ABI that's actually
going upstream and to remove some of the cruft from the original test
that wouldn't actually work.

It's worth noting that CRC's don't seem to work properly on Intel gen9.
The bspec does tell us that we must have one plane enabled before taking
a pipe-level ("dmux") CRC, so this test is violating that by disabling
all planes; it's quite possible that this is the source of the CRC
mismatch.  If running on an Intel platform, you may want to run in
interactive mode ("--interactive-debug=bgcolor --skip-crc-compare") to
ensure that the colors being generated actually do match visually since
the CRC's can't be trusted.

v2:
 - Swap red and blue ordering in property value to reflect change
   in v2 of kernel series.

v3:
 - Minor updates to proposed uapi helpers (s/rgba/argb/).

v4:
 - General restructuring into pipe/color subtests.
 - Use RGB2101010 framebuffers for comparison so that we match the bits
   of precision that Intel hardware background color accepts

v5:
 - Re-enable CRC comparisons; just because these don't work on Intel
   doesn't mean we shouldn't use them on other vendors' platforms
   (Daniel).
 - Use DRIVER_ANY rather than DRIVER_INTEL. (Heiko Stuebner)

v5.1:
 - Update commit message body discussion of CRC issues.

Cc: igt-dev@lists.freedesktop.org
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
---
 lib/igt_kms.c                     |   2 +-
 tests/kms_crtc_background_color.c | 263 ++++++++++++++++++--------------------
 2 files changed, 127 insertions(+), 138 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 080f90ae..c52ec5e6 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -180,7 +180,7 @@ const char * const igt_plane_prop_names[IGT_NUM_PLANE_PROPS] = {
 };
 
 const char * const igt_crtc_prop_names[IGT_NUM_CRTC_PROPS] = {
-	[IGT_CRTC_BACKGROUND] = "background_color",
+	[IGT_CRTC_BACKGROUND] = "BACKGROUND_COLOR",
 	[IGT_CRTC_CTM] = "CTM",
 	[IGT_CRTC_GAMMA_LUT] = "GAMMA_LUT",
 	[IGT_CRTC_GAMMA_LUT_SIZE] = "GAMMA_LUT_SIZE",
diff --git a/tests/kms_crtc_background_color.c b/tests/kms_crtc_background_color.c
index 3df3401f..58cdd7a9 100644
--- a/tests/kms_crtc_background_color.c
+++ b/tests/kms_crtc_background_color.c
@@ -25,164 +25,153 @@
 #include "igt.h"
 #include <math.h>
 
-
 IGT_TEST_DESCRIPTION("Test crtc background color feature");
 
+/*
+ * Paints a desired color into a full-screen primary plane and then compares
+ * that CRC with turning off all planes and setting the CRTC background to the
+ * same color.
+ *
+ * At least on current Intel platforms, the CRC tests appear to always fail,
+ * even though the resulting pipe output seems to be the same.  The bspec tells
+ * us that we must have at least one plane turned on when taking a pipe-level
+ * CRC, so the fact that we're violating that may explain the failures.  If
+ * your platform gives failures for all tests, you may want to run with
+ * --interactive-debug=bgcolor --skip-crc-compare to visually inspect that the
+ * background color matches the equivalent solid plane.
+ */
+
 typedef struct {
-	int gfx_fd;
 	igt_display_t display;
-	struct igt_fb fb;
-	igt_crc_t ref_crc;
+	int gfx_fd;
+	igt_output_t *output;
 	igt_pipe_crc_t *pipe_crc;
+	drmModeModeInfo *mode;
 } data_t;
 
-#define BLACK      0x000000           /* BGR 8bpc */
-#define CYAN       0xFFFF00           /* BGR 8bpc */
-#define PURPLE     0xFF00FF           /* BGR 8bpc */
-#define WHITE      0xFFFFFF           /* BGR 8bpc */
-
-#define BLACK64    0x000000000000     /* BGR 16bpc */
-#define CYAN64     0xFFFFFFFF0000     /* BGR 16bpc */
-#define PURPLE64   0xFFFF0000FFFF     /* BGR 16bpc */
-#define YELLOW64   0x0000FFFFFFFF     /* BGR 16bpc */
-#define WHITE64    0xFFFFFFFFFFFF     /* BGR 16bpc */
-#define RED64      0x00000000FFFF     /* BGR 16bpc */
-#define GREEN64    0x0000FFFF0000     /* BGR 16bpc */
-#define BLUE64     0xFFFF00000000     /* BGR 16bpc */
-
-static void
-paint_background(data_t *data, struct igt_fb *fb, drmModeModeInfo *mode,
-		uint32_t background, double alpha)
+/*
+ * Local copy of kernel uapi
+ */
+static inline __u64
+local_argb(__u8 bpc, __u16 alpha, __u16 red, __u16 green, __u16 blue)
 {
-	cairo_t *cr;
-	int w, h;
-	double r, g, b;
-
-	w = mode->hdisplay;
-	h = mode->vdisplay;
-
-	cr = igt_get_cairo_ctx(data->gfx_fd, &data->fb);
+       int msb_shift = 16 - bpc;
 
-	/* Paint with background color */
-	r = (double) (background & 0xFF) / 255.0;
-	g = (double) ((background & 0xFF00) >> 8) / 255.0;
-	b = (double) ((background & 0xFF0000) >> 16) / 255.0;
-	igt_paint_color_alpha(cr, 0, 0, w, h, r, g, b, alpha);
-
-	igt_put_cairo_ctx(data->gfx_fd, &data->fb, cr);
+       return (__u64)alpha << msb_shift << 48 |
+              (__u64)red   << msb_shift << 32 |
+              (__u64)green << msb_shift << 16 |
+              (__u64)blue  << msb_shift;
 }
 
-static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
-			igt_plane_t *plane, int opaque_buffer, int plane_color,
-			uint64_t pipe_background_color)
+static void test_background(data_t *data, enum pipe pipe, int w, int h,
+			    __u64 r, __u64 g, __u64 b)
 {
-	drmModeModeInfo *mode;
-	igt_display_t *display = &data->display;
-	int fb_id;
-	double alpha;
-
-	igt_output_set_pipe(output, pipe);
-
-	/* create the pipe_crc object for this pipe */
-	igt_pipe_crc_free(data->pipe_crc);
-	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
-
-	mode = igt_output_get_mode(output);
-
-	fb_id = igt_create_fb(data->gfx_fd,
-			mode->hdisplay, mode->vdisplay,
-			DRM_FORMAT_XRGB8888,
-			LOCAL_DRM_FORMAT_MOD_NONE, /* tiled */
-			&data->fb);
-	igt_assert(fb_id);
-
-	/* To make FB pixel win with background color, set alpha as full opaque */
-	igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, pipe_background_color);
-	if (opaque_buffer)
-		alpha = 1.0;    /* alpha 1 is fully opque */
-	else
-		alpha = 0.0;    /* alpha 0 is fully transparent */
-	paint_background(data, &data->fb, mode, plane_color, alpha);
-
-	igt_plane_set_fb(plane, &data->fb);
-	igt_display_commit2(display, COMMIT_UNIVERSAL);
-}
-
-static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane)
-{
-	igt_display_t *display = &data->display;
-
-	igt_pipe_crc_free(data->pipe_crc);
-	data->pipe_crc = NULL;
-
-	igt_remove_fb(data->gfx_fd, &data->fb);
-
-	igt_pipe_obj_set_prop_value(plane->pipe, IGT_CRTC_BACKGROUND, BLACK64);
+	igt_crc_t plane_crc, bg_crc;
+	struct igt_fb colorfb;
+	igt_plane_t *plane = igt_output_get_plane_type(data->output,
+						       DRM_PLANE_TYPE_PRIMARY);
+
+
+	/* Fill the primary plane and set the background to the same color */
+	igt_create_color_fb(data->gfx_fd, w, h, DRM_FORMAT_XRGB2101010,
+			    LOCAL_DRM_FORMAT_MOD_NONE,
+			    (double)r / 0xFFFF,
+			    (double)g / 0xFFFF,
+			    (double)b / 0xFFFF,
+			    &colorfb);
+	igt_plane_set_fb(plane, &colorfb);
+	igt_pipe_set_prop_value(&data->display, pipe, IGT_CRTC_BACKGROUND,
+				local_argb(16, 0xffff, r, g, b));
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &plane_crc);
+	igt_debug_wait_for_keypress("bgcolor");
+
+	/* Turn off the primary plane so only bg shows */
 	igt_plane_set_fb(plane, NULL);
-	igt_output_set_pipe(output, PIPE_ANY);
-
-	igt_display_commit2(display, COMMIT_UNIVERSAL);
+	igt_display_commit2(&data->display, COMMIT_ATOMIC);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &bg_crc);
+	igt_debug_wait_for_keypress("bgcolor");
+
+	/*
+	 * The following test relies on hardware that generates valid CRCs
+	 * even when no planes are on.  Sadly, this doesn't appear to be the
+	 * case for current Intel platforms; pipe CRC's never match bgcolor
+	 * CRC's, likely because we're violating the bspec's guidance that there
+	 * must always be at least one real plane turned on when taking the
+	 * pipe-level ("dmux") CRC.
+	 */
+	igt_assert_crc_equal(&plane_crc, &bg_crc);
 }
 
-static void test_crtc_background(data_t *data)
+igt_main
 {
-	igt_display_t *display = &data->display;
+	data_t data = {};
 	igt_output_t *output;
+	drmModeModeInfo *mode;
+	int w, h;
 	enum pipe pipe;
-	int valid_tests = 0;
-
-	for_each_pipe_with_valid_output(display, pipe, output) {
-		igt_plane_t *plane;
-
-		igt_output_set_pipe(output, pipe);
-
-		plane = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
-		igt_require(igt_pipe_has_prop(display, pipe, IGT_CRTC_BACKGROUND));
-
-		prepare_crtc(data, output, pipe, plane, 1, PURPLE, BLACK64);
-
-		/* Now set background without using a plane, i.e.,
-		 * Disable the plane to let hw background color win blend. */
-		igt_plane_set_fb(plane, NULL);
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, PURPLE64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
-
-		/* Try few other background colors */
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, CYAN64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
-
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, YELLOW64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
 
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, RED64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
+	igt_fixture {
+		data.gfx_fd = drm_open_driver_master(DRIVER_ANY);
+		kmstest_set_vt_graphics_mode();
 
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, GREEN64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
-
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, BLUE64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
-
-		igt_pipe_set_prop_value(display, pipe, IGT_CRTC_BACKGROUND, WHITE64);
-		igt_display_commit2(display, COMMIT_UNIVERSAL);
-
-		valid_tests++;
-		cleanup_crtc(data, output, plane);
+		igt_require_pipe_crc(data.gfx_fd);
+		igt_display_require(&data.display, data.gfx_fd);
 	}
-	igt_require_f(valid_tests, "no valid crtc/connector combinations found\n");
-}
 
-igt_simple_main
-{
-	data_t data = {};
-
-	igt_skip_on_simulation();
-
-	data.gfx_fd = drm_open_driver(DRIVER_INTEL);
-	igt_require_pipe_crc(data.gfx_fd);
-	igt_display_require(&data.display, data.gfx_fd);
-
-	test_crtc_background(&data);
+	for_each_pipe_static(pipe) igt_subtest_group {
+		igt_fixture {
+			igt_display_require_output_on_pipe(&data.display, pipe);
+			igt_require(igt_pipe_has_prop(&data.display, pipe,
+						      IGT_CRTC_BACKGROUND));
+
+			output = igt_get_single_output_for_pipe(&data.display,
+								pipe);
+			igt_output_set_pipe(output, pipe);
+			data.output = output;
+
+			mode = igt_output_get_mode(output);
+			w = mode->hdisplay;
+			h = mode->vdisplay;
+
+			data.pipe_crc = igt_pipe_crc_new(data.gfx_fd, pipe,
+							  INTEL_PIPE_CRC_SOURCE_AUTO);
+		}
+
+		igt_subtest_f("background-color-pipe-%s-black",
+			      kmstest_pipe_name(pipe))
+			test_background(&data, pipe, w, h,
+					0, 0, 0);
+
+		igt_subtest_f("background-color-pipe-%s-white",
+			      kmstest_pipe_name(pipe))
+			test_background(&data, pipe, w, h,
+					0xFFFF, 0xFFFF, 0xFFFF);
+
+		igt_subtest_f("background-color-pipe-%s-red",
+			      kmstest_pipe_name(pipe))
+			test_background(&data, pipe, w, h,
+					0xFFFF, 0, 0);
+
+		igt_subtest_f("background-color-pipe-%s-green",
+			      kmstest_pipe_name(pipe))
+
+			test_background(&data, pipe, w, h,
+					0, 0xFFFF, 0);
+
+		igt_subtest_f("background-color-pipe-%s-blue",
+			      kmstest_pipe_name(pipe))
+			test_background(&data, pipe, w, h,
+					0, 0, 0xFFFF);
+
+		igt_fixture {
+			igt_display_reset(&data.display);
+			igt_pipe_crc_free(data.pipe_crc);
+			data.pipe_crc = NULL;
+		}
+	}
 
-	igt_display_fini(&data.display);
+	igt_fixture {
+		igt_display_fini(&data.display);
+	}
 }
-- 
2.14.5

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

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

* Re: [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option
  2019-02-21  0:34 ` [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option Matt Roper
  2019-02-21  0:34   ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_crtc_background_color: overhaul to match upstream ABI (v5) Matt Roper
@ 2019-02-21  9:33   ` Daniel Vetter
  2019-02-21 18:00     ` Ville Syrjälä
  2019-02-22 14:32   ` [Intel-gfx] " Daniel Vetter
  2 siblings, 1 reply; 9+ messages in thread
From: Daniel Vetter @ 2019-02-21  9:33 UTC (permalink / raw)
  To: Matt Roper; +Cc: igt-dev, intel-gfx

On Wed, Feb 20, 2019 at 04:34:21PM -0800, Matt Roper wrote:
> When using --interactive-debug, it's sometimes desirable to ignore CRC
> mismatches and let the test proceed as if they passed so that the
> on-screen outcome can be inspected.  Let's add a debug option to allow
> this.
> 
> Cc: igt-dev@lists.freedesktop.org
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>

I'm wondering whether we shouldn't tie this into an --interactive-debug
mode, since you'll need both for the manual run to be actually useful.
E.g. anytime any --interactive-debug is set we skip all crc checks.
-Daniel

> ---
>  lib/igt_core.c    | 7 +++++++
>  lib/igt_core.h    | 1 +
>  lib/igt_debugfs.c | 8 +++++++-
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 71b05d3b..5523950f 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -256,6 +256,7 @@
>  
>  static unsigned int exit_handler_count;
>  const char *igt_interactive_debug;
> +bool igt_skip_crc_compare;
>  
>  /* subtests helpers */
>  static bool list_subtests = false;
> @@ -285,6 +286,7 @@ enum {
>   OPT_DESCRIPTION,
>   OPT_DEBUG,
>   OPT_INTERACTIVE_DEBUG,
> + OPT_SKIP_CRC,
>   OPT_HELP = 'h'
>  };
>  
> @@ -552,6 +554,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
>  		   "  --run-subtest <pattern>\n"
>  		   "  --debug[=log-domain]\n"
>  		   "  --interactive-debug[=domain]\n"
> +		   "  --skip-crc-compare\n"
>  		   "  --help-description\n"
>  		   "  --help\n");
>  	if (help_str)
> @@ -668,6 +671,7 @@ static int common_init(int *argc, char **argv,
>  		{"help-description", 0, 0, OPT_DESCRIPTION},
>  		{"debug", optional_argument, 0, OPT_DEBUG},
>  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> +		{"skip-crc-compare", 0, 0, OPT_SKIP_CRC},
>  		{"help", 0, 0, OPT_HELP},
>  		{0, 0, 0, 0}
>  	};
> @@ -768,6 +772,9 @@ static int common_init(int *argc, char **argv,
>  			print_test_description();
>  			ret = -1;
>  			goto out;
> +		case OPT_SKIP_CRC:
> +			igt_skip_crc_compare = true;
> +			goto out;
>  		case OPT_HELP:
>  			print_usage(help_str, false);
>  			ret = -1;
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index 47ffd9e7..f12fc5cb 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -843,6 +843,7 @@ bool igt_run_in_simulation(void);
>  void igt_skip_on_simulation(void);
>  
>  extern const char *igt_interactive_debug;
> +extern bool igt_skip_crc_compare;
>  
>  /**
>   * igt_log_level:
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index 640c78e9..04d1648b 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -405,6 +405,12 @@ static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b,
>   * assert that CRCs match, never that they are different. Otherwise there might
>   * be random testcase failures when different screen contents end up with the
>   * same CRC by chance.
> + *
> + * Passing --skip-crc-compare on the command line will force this function
> + * to always pass, which can be useful in interactive debugging where you
> + * might know the test will fail, but still want the test to keep going as if
> + * it had succeeded so that you can see the on-screen behavior.
> + *
>   */
>  void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
>  {
> @@ -416,7 +422,7 @@ void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
>  		igt_debug("CRC mismatch at index %d: 0x%x != 0x%x\n", index,
>  			  a->crc[index], b->crc[index]);
>  
> -	igt_assert(!mismatch);
> +	igt_assert(!mismatch || igt_skip_crc_compare);
>  }
>  
>  /**
> -- 
> 2.14.5
> 
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option
  2019-02-21  9:33   ` [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option Daniel Vetter
@ 2019-02-21 18:00     ` Ville Syrjälä
  0 siblings, 0 replies; 9+ messages in thread
From: Ville Syrjälä @ 2019-02-21 18:00 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: igt-dev, intel-gfx

On Thu, Feb 21, 2019 at 10:33:25AM +0100, Daniel Vetter wrote:
> On Wed, Feb 20, 2019 at 04:34:21PM -0800, Matt Roper wrote:
> > When using --interactive-debug, it's sometimes desirable to ignore CRC
> > mismatches and let the test proceed as if they passed so that the
> > on-screen outcome can be inspected.  Let's add a debug option to allow
> > this.
> > 
> > Cc: igt-dev@lists.freedesktop.org
> > Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> 
> I'm wondering whether we shouldn't tie this into an --interactive-debug
> mode, since you'll need both for the manual run to be actually useful.
> E.g. anytime any --interactive-debug is set we skip all crc checks.

That might make sense, but I'd like to still have the option to disable
the crc checks without interactive debug as well. Good for observing
tearing and whatnot. When looking at failures I seem to end up patching
the crc checks out most of the time and relying on the tracepoints
to get me the data I need. This knob could save me a step.

So
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> -Daniel
> 
> > ---
> >  lib/igt_core.c    | 7 +++++++
> >  lib/igt_core.h    | 1 +
> >  lib/igt_debugfs.c | 8 +++++++-
> >  3 files changed, 15 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > index 71b05d3b..5523950f 100644
> > --- a/lib/igt_core.c
> > +++ b/lib/igt_core.c
> > @@ -256,6 +256,7 @@
> >  
> >  static unsigned int exit_handler_count;
> >  const char *igt_interactive_debug;
> > +bool igt_skip_crc_compare;
> >  
> >  /* subtests helpers */
> >  static bool list_subtests = false;
> > @@ -285,6 +286,7 @@ enum {
> >   OPT_DESCRIPTION,
> >   OPT_DEBUG,
> >   OPT_INTERACTIVE_DEBUG,
> > + OPT_SKIP_CRC,
> >   OPT_HELP = 'h'
> >  };
> >  
> > @@ -552,6 +554,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
> >  		   "  --run-subtest <pattern>\n"
> >  		   "  --debug[=log-domain]\n"
> >  		   "  --interactive-debug[=domain]\n"
> > +		   "  --skip-crc-compare\n"
> >  		   "  --help-description\n"
> >  		   "  --help\n");
> >  	if (help_str)
> > @@ -668,6 +671,7 @@ static int common_init(int *argc, char **argv,
> >  		{"help-description", 0, 0, OPT_DESCRIPTION},
> >  		{"debug", optional_argument, 0, OPT_DEBUG},
> >  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> > +		{"skip-crc-compare", 0, 0, OPT_SKIP_CRC},
> >  		{"help", 0, 0, OPT_HELP},
> >  		{0, 0, 0, 0}
> >  	};
> > @@ -768,6 +772,9 @@ static int common_init(int *argc, char **argv,
> >  			print_test_description();
> >  			ret = -1;
> >  			goto out;
> > +		case OPT_SKIP_CRC:
> > +			igt_skip_crc_compare = true;
> > +			goto out;
> >  		case OPT_HELP:
> >  			print_usage(help_str, false);
> >  			ret = -1;
> > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > index 47ffd9e7..f12fc5cb 100644
> > --- a/lib/igt_core.h
> > +++ b/lib/igt_core.h
> > @@ -843,6 +843,7 @@ bool igt_run_in_simulation(void);
> >  void igt_skip_on_simulation(void);
> >  
> >  extern const char *igt_interactive_debug;
> > +extern bool igt_skip_crc_compare;
> >  
> >  /**
> >   * igt_log_level:
> > diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> > index 640c78e9..04d1648b 100644
> > --- a/lib/igt_debugfs.c
> > +++ b/lib/igt_debugfs.c
> > @@ -405,6 +405,12 @@ static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b,
> >   * assert that CRCs match, never that they are different. Otherwise there might
> >   * be random testcase failures when different screen contents end up with the
> >   * same CRC by chance.
> > + *
> > + * Passing --skip-crc-compare on the command line will force this function
> > + * to always pass, which can be useful in interactive debugging where you
> > + * might know the test will fail, but still want the test to keep going as if
> > + * it had succeeded so that you can see the on-screen behavior.
> > + *
> >   */
> >  void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
> >  {
> > @@ -416,7 +422,7 @@ void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
> >  		igt_debug("CRC mismatch at index %d: 0x%x != 0x%x\n", index,
> >  			  a->crc[index], b->crc[index]);
> >  
> > -	igt_assert(!mismatch);
> > +	igt_assert(!mismatch || igt_skip_crc_compare);
> >  }
> >  
> >  /**
> > -- 
> > 2.14.5
> > 
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option
  2019-02-21  0:34 ` [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option Matt Roper
  2019-02-21  0:34   ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_crtc_background_color: overhaul to match upstream ABI (v5) Matt Roper
  2019-02-21  9:33   ` [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option Daniel Vetter
@ 2019-02-22 14:32   ` Daniel Vetter
  2019-06-27 16:05     ` [igt-dev] [Intel-gfx] " Ville Syrjälä
  2 siblings, 1 reply; 9+ messages in thread
From: Daniel Vetter @ 2019-02-22 14:32 UTC (permalink / raw)
  To: Matt Roper; +Cc: igt-dev, intel-gfx

On Wed, Feb 20, 2019 at 04:34:21PM -0800, Matt Roper wrote:
> When using --interactive-debug, it's sometimes desirable to ignore CRC
> mismatches and let the test proceed as if they passed so that the
> on-screen outcome can be inspected.  Let's add a debug option to allow
> this.
> 
> Cc: igt-dev@lists.freedesktop.org
> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> ---
>  lib/igt_core.c    | 7 +++++++
>  lib/igt_core.h    | 1 +
>  lib/igt_debugfs.c | 8 +++++++-
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 71b05d3b..5523950f 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -256,6 +256,7 @@
>  
>  static unsigned int exit_handler_count;
>  const char *igt_interactive_debug;
> +bool igt_skip_crc_compare;
>  
>  /* subtests helpers */
>  static bool list_subtests = false;
> @@ -285,6 +286,7 @@ enum {
>   OPT_DESCRIPTION,
>   OPT_DEBUG,
>   OPT_INTERACTIVE_DEBUG,
> + OPT_SKIP_CRC,
>   OPT_HELP = 'h'
>  };
>  
> @@ -552,6 +554,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
>  		   "  --run-subtest <pattern>\n"
>  		   "  --debug[=log-domain]\n"
>  		   "  --interactive-debug[=domain]\n"
> +		   "  --skip-crc-compare\n"
>  		   "  --help-description\n"
>  		   "  --help\n");
>  	if (help_str)
> @@ -668,6 +671,7 @@ static int common_init(int *argc, char **argv,
>  		{"help-description", 0, 0, OPT_DESCRIPTION},
>  		{"debug", optional_argument, 0, OPT_DEBUG},
>  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> +		{"skip-crc-compare", 0, 0, OPT_SKIP_CRC},
>  		{"help", 0, 0, OPT_HELP},
>  		{0, 0, 0, 0}
>  	};
> @@ -768,6 +772,9 @@ static int common_init(int *argc, char **argv,
>  			print_test_description();
>  			ret = -1;
>  			goto out;
> +		case OPT_SKIP_CRC:
> +			igt_skip_crc_compare = true;
> +			goto out;
>  		case OPT_HELP:
>  			print_usage(help_str, false);
>  			ret = -1;
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index 47ffd9e7..f12fc5cb 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -843,6 +843,7 @@ bool igt_run_in_simulation(void);
>  void igt_skip_on_simulation(void);
>  
>  extern const char *igt_interactive_debug;
> +extern bool igt_skip_crc_compare;
>  
>  /**
>   * igt_log_level:
> diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> index 640c78e9..04d1648b 100644
> --- a/lib/igt_debugfs.c
> +++ b/lib/igt_debugfs.c
> @@ -405,6 +405,12 @@ static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b,
>   * assert that CRCs match, never that they are different. Otherwise there might
>   * be random testcase failures when different screen contents end up with the
>   * same CRC by chance.
> + *
> + * Passing --skip-crc-compare on the command line will force this function
> + * to always pass, which can be useful in interactive debugging where you
> + * might know the test will fail, but still want the test to keep going as if
> + * it had succeeded so that you can see the on-screen behavior.
> + *
>   */
>  void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
>  {
> @@ -416,7 +422,7 @@ void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
>  		igt_debug("CRC mismatch at index %d: 0x%x != 0x%x\n", index,
>  			  a->crc[index], b->crc[index]);
>  
> -	igt_assert(!mismatch);
> +	igt_assert(!mismatch || igt_skip_crc_compare);

I think an igt_debug line here could be useful when we skip the assert.
With that

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

aka Ville convinced me.
-Daniel

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

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option
  2019-02-22 14:32   ` [Intel-gfx] " Daniel Vetter
@ 2019-06-27 16:05     ` Ville Syrjälä
  2019-07-03 10:36       ` Daniel Vetter
  0 siblings, 1 reply; 9+ messages in thread
From: Ville Syrjälä @ 2019-06-27 16:05 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: igt-dev, intel-gfx

On Fri, Feb 22, 2019 at 03:32:50PM +0100, Daniel Vetter wrote:
> On Wed, Feb 20, 2019 at 04:34:21PM -0800, Matt Roper wrote:
> > When using --interactive-debug, it's sometimes desirable to ignore CRC
> > mismatches and let the test proceed as if they passed so that the
> > on-screen outcome can be inspected.  Let's add a debug option to allow
> > this.
> > 
> > Cc: igt-dev@lists.freedesktop.org
> > Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> > ---
> >  lib/igt_core.c    | 7 +++++++
> >  lib/igt_core.h    | 1 +
> >  lib/igt_debugfs.c | 8 +++++++-
> >  3 files changed, 15 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > index 71b05d3b..5523950f 100644
> > --- a/lib/igt_core.c
> > +++ b/lib/igt_core.c
> > @@ -256,6 +256,7 @@
> >  
> >  static unsigned int exit_handler_count;
> >  const char *igt_interactive_debug;
> > +bool igt_skip_crc_compare;
> >  
> >  /* subtests helpers */
> >  static bool list_subtests = false;
> > @@ -285,6 +286,7 @@ enum {
> >   OPT_DESCRIPTION,
> >   OPT_DEBUG,
> >   OPT_INTERACTIVE_DEBUG,
> > + OPT_SKIP_CRC,
> >   OPT_HELP = 'h'
> >  };
> >  
> > @@ -552,6 +554,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
> >  		   "  --run-subtest <pattern>\n"
> >  		   "  --debug[=log-domain]\n"
> >  		   "  --interactive-debug[=domain]\n"
> > +		   "  --skip-crc-compare\n"
> >  		   "  --help-description\n"
> >  		   "  --help\n");
> >  	if (help_str)
> > @@ -668,6 +671,7 @@ static int common_init(int *argc, char **argv,
> >  		{"help-description", 0, 0, OPT_DESCRIPTION},
> >  		{"debug", optional_argument, 0, OPT_DEBUG},
> >  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> > +		{"skip-crc-compare", 0, 0, OPT_SKIP_CRC},
> >  		{"help", 0, 0, OPT_HELP},
> >  		{0, 0, 0, 0}
> >  	};
> > @@ -768,6 +772,9 @@ static int common_init(int *argc, char **argv,
> >  			print_test_description();
> >  			ret = -1;
> >  			goto out;
> > +		case OPT_SKIP_CRC:
> > +			igt_skip_crc_compare = true;
> > +			goto out;
> >  		case OPT_HELP:
> >  			print_usage(help_str, false);
> >  			ret = -1;
> > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > index 47ffd9e7..f12fc5cb 100644
> > --- a/lib/igt_core.h
> > +++ b/lib/igt_core.h
> > @@ -843,6 +843,7 @@ bool igt_run_in_simulation(void);
> >  void igt_skip_on_simulation(void);
> >  
> >  extern const char *igt_interactive_debug;
> > +extern bool igt_skip_crc_compare;
> >  
> >  /**
> >   * igt_log_level:
> > diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> > index 640c78e9..04d1648b 100644
> > --- a/lib/igt_debugfs.c
> > +++ b/lib/igt_debugfs.c
> > @@ -405,6 +405,12 @@ static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b,
> >   * assert that CRCs match, never that they are different. Otherwise there might
> >   * be random testcase failures when different screen contents end up with the
> >   * same CRC by chance.
> > + *
> > + * Passing --skip-crc-compare on the command line will force this function
> > + * to always pass, which can be useful in interactive debugging where you
> > + * might know the test will fail, but still want the test to keep going as if
> > + * it had succeeded so that you can see the on-screen behavior.
> > + *
> >   */
> >  void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
> >  {
> > @@ -416,7 +422,7 @@ void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
> >  		igt_debug("CRC mismatch at index %d: 0x%x != 0x%x\n", index,
> >  			  a->crc[index], b->crc[index]);
> >  
> > -	igt_assert(!mismatch);
> > +	igt_assert(!mismatch || igt_skip_crc_compare);
> 
> I think an igt_debug line here could be useful when we skip the assert.
> With that

Daniel, is the debug print just above not sufficient? Or would you like
a more explicit indication that we skipped the assert even though there
was mismatch?

I guess we could do something like:

if (mismatch)
 igt_debug("CRC mismatch%s at index %d: 0x%x != 0x%x\n",
           skip_crc_compare ? " (ignored)" : "",
	   index, a->crc[index], b->crc[index]);

to avoid spamming the log with two lines per mismatch?

I was just looking for this knob until I realized we never applied this
patch :/

> 
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> aka Ville convinced me.
> -Daniel
> 
> >  }
> >  
> >  /**
> > -- 
> > 2.14.5
> > 
> > _______________________________________________
> > igt-dev mailing list
> > igt-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option
  2019-06-27 16:05     ` [igt-dev] [Intel-gfx] " Ville Syrjälä
@ 2019-07-03 10:36       ` Daniel Vetter
  2019-07-03 12:54         ` Ville Syrjälä
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Vetter @ 2019-07-03 10:36 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: igt-dev, intel-gfx, Daniel Vetter

On Thu, Jun 27, 2019 at 07:05:17PM +0300, Ville Syrjälä wrote:
> On Fri, Feb 22, 2019 at 03:32:50PM +0100, Daniel Vetter wrote:
> > On Wed, Feb 20, 2019 at 04:34:21PM -0800, Matt Roper wrote:
> > > When using --interactive-debug, it's sometimes desirable to ignore CRC
> > > mismatches and let the test proceed as if they passed so that the
> > > on-screen outcome can be inspected.  Let's add a debug option to allow
> > > this.
> > > 
> > > Cc: igt-dev@lists.freedesktop.org
> > > Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> > > ---
> > >  lib/igt_core.c    | 7 +++++++
> > >  lib/igt_core.h    | 1 +
> > >  lib/igt_debugfs.c | 8 +++++++-
> > >  3 files changed, 15 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > > index 71b05d3b..5523950f 100644
> > > --- a/lib/igt_core.c
> > > +++ b/lib/igt_core.c
> > > @@ -256,6 +256,7 @@
> > >  
> > >  static unsigned int exit_handler_count;
> > >  const char *igt_interactive_debug;
> > > +bool igt_skip_crc_compare;
> > >  
> > >  /* subtests helpers */
> > >  static bool list_subtests = false;
> > > @@ -285,6 +286,7 @@ enum {
> > >   OPT_DESCRIPTION,
> > >   OPT_DEBUG,
> > >   OPT_INTERACTIVE_DEBUG,
> > > + OPT_SKIP_CRC,
> > >   OPT_HELP = 'h'
> > >  };
> > >  
> > > @@ -552,6 +554,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
> > >  		   "  --run-subtest <pattern>\n"
> > >  		   "  --debug[=log-domain]\n"
> > >  		   "  --interactive-debug[=domain]\n"
> > > +		   "  --skip-crc-compare\n"
> > >  		   "  --help-description\n"
> > >  		   "  --help\n");
> > >  	if (help_str)
> > > @@ -668,6 +671,7 @@ static int common_init(int *argc, char **argv,
> > >  		{"help-description", 0, 0, OPT_DESCRIPTION},
> > >  		{"debug", optional_argument, 0, OPT_DEBUG},
> > >  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> > > +		{"skip-crc-compare", 0, 0, OPT_SKIP_CRC},
> > >  		{"help", 0, 0, OPT_HELP},
> > >  		{0, 0, 0, 0}
> > >  	};
> > > @@ -768,6 +772,9 @@ static int common_init(int *argc, char **argv,
> > >  			print_test_description();
> > >  			ret = -1;
> > >  			goto out;
> > > +		case OPT_SKIP_CRC:
> > > +			igt_skip_crc_compare = true;
> > > +			goto out;
> > >  		case OPT_HELP:
> > >  			print_usage(help_str, false);
> > >  			ret = -1;
> > > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > > index 47ffd9e7..f12fc5cb 100644
> > > --- a/lib/igt_core.h
> > > +++ b/lib/igt_core.h
> > > @@ -843,6 +843,7 @@ bool igt_run_in_simulation(void);
> > >  void igt_skip_on_simulation(void);
> > >  
> > >  extern const char *igt_interactive_debug;
> > > +extern bool igt_skip_crc_compare;
> > >  
> > >  /**
> > >   * igt_log_level:
> > > diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> > > index 640c78e9..04d1648b 100644
> > > --- a/lib/igt_debugfs.c
> > > +++ b/lib/igt_debugfs.c
> > > @@ -405,6 +405,12 @@ static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b,
> > >   * assert that CRCs match, never that they are different. Otherwise there might
> > >   * be random testcase failures when different screen contents end up with the
> > >   * same CRC by chance.
> > > + *
> > > + * Passing --skip-crc-compare on the command line will force this function
> > > + * to always pass, which can be useful in interactive debugging where you
> > > + * might know the test will fail, but still want the test to keep going as if
> > > + * it had succeeded so that you can see the on-screen behavior.
> > > + *
> > >   */
> > >  void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
> > >  {
> > > @@ -416,7 +422,7 @@ void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
> > >  		igt_debug("CRC mismatch at index %d: 0x%x != 0x%x\n", index,
> > >  			  a->crc[index], b->crc[index]);
> > >  
> > > -	igt_assert(!mismatch);
> > > +	igt_assert(!mismatch || igt_skip_crc_compare);
> > 
> > I think an igt_debug line here could be useful when we skip the assert.
> > With that
> 
> Daniel, is the debug print just above not sufficient? Or would you like
> a more explicit indication that we skipped the assert even though there
> was mismatch?
> 
> I guess we could do something like:
> 
> if (mismatch)
>  igt_debug("CRC mismatch%s at index %d: 0x%x != 0x%x\n",
>            skip_crc_compare ? " (ignored)" : "",
> 	   index, a->crc[index], b->crc[index]);
> 
> to avoid spamming the log with two lines per mismatch?
> 
> I was just looking for this knob until I realized we never applied this
> patch :/

Hm yeah I missed that debug line, I think that's good enough.
-Daniel

> 
> > 
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > 
> > aka Ville convinced me.
> > -Daniel
> > 
> > >  }
> > >  
> > >  /**
> > > -- 
> > > 2.14.5
> > > 
> > > _______________________________________________
> > > igt-dev mailing list
> > > igt-dev@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> > 
> > -- 
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > http://blog.ffwll.ch
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Ville Syrjälä
> Intel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option
  2019-07-03 10:36       ` Daniel Vetter
@ 2019-07-03 12:54         ` Ville Syrjälä
  0 siblings, 0 replies; 9+ messages in thread
From: Ville Syrjälä @ 2019-07-03 12:54 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: igt-dev, intel-gfx

On Wed, Jul 03, 2019 at 12:36:27PM +0200, Daniel Vetter wrote:
> On Thu, Jun 27, 2019 at 07:05:17PM +0300, Ville Syrjälä wrote:
> > On Fri, Feb 22, 2019 at 03:32:50PM +0100, Daniel Vetter wrote:
> > > On Wed, Feb 20, 2019 at 04:34:21PM -0800, Matt Roper wrote:
> > > > When using --interactive-debug, it's sometimes desirable to ignore CRC
> > > > mismatches and let the test proceed as if they passed so that the
> > > > on-screen outcome can be inspected.  Let's add a debug option to allow
> > > > this.
> > > > 
> > > > Cc: igt-dev@lists.freedesktop.org
> > > > Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
> > > > ---
> > > >  lib/igt_core.c    | 7 +++++++
> > > >  lib/igt_core.h    | 1 +
> > > >  lib/igt_debugfs.c | 8 +++++++-
> > > >  3 files changed, 15 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > > > index 71b05d3b..5523950f 100644
> > > > --- a/lib/igt_core.c
> > > > +++ b/lib/igt_core.c
> > > > @@ -256,6 +256,7 @@
> > > >  
> > > >  static unsigned int exit_handler_count;
> > > >  const char *igt_interactive_debug;
> > > > +bool igt_skip_crc_compare;
> > > >  
> > > >  /* subtests helpers */
> > > >  static bool list_subtests = false;
> > > > @@ -285,6 +286,7 @@ enum {
> > > >   OPT_DESCRIPTION,
> > > >   OPT_DEBUG,
> > > >   OPT_INTERACTIVE_DEBUG,
> > > > + OPT_SKIP_CRC,
> > > >   OPT_HELP = 'h'
> > > >  };
> > > >  
> > > > @@ -552,6 +554,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
> > > >  		   "  --run-subtest <pattern>\n"
> > > >  		   "  --debug[=log-domain]\n"
> > > >  		   "  --interactive-debug[=domain]\n"
> > > > +		   "  --skip-crc-compare\n"
> > > >  		   "  --help-description\n"
> > > >  		   "  --help\n");
> > > >  	if (help_str)
> > > > @@ -668,6 +671,7 @@ static int common_init(int *argc, char **argv,
> > > >  		{"help-description", 0, 0, OPT_DESCRIPTION},
> > > >  		{"debug", optional_argument, 0, OPT_DEBUG},
> > > >  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> > > > +		{"skip-crc-compare", 0, 0, OPT_SKIP_CRC},
> > > >  		{"help", 0, 0, OPT_HELP},
> > > >  		{0, 0, 0, 0}
> > > >  	};
> > > > @@ -768,6 +772,9 @@ static int common_init(int *argc, char **argv,
> > > >  			print_test_description();
> > > >  			ret = -1;
> > > >  			goto out;
> > > > +		case OPT_SKIP_CRC:
> > > > +			igt_skip_crc_compare = true;
> > > > +			goto out;
> > > >  		case OPT_HELP:
> > > >  			print_usage(help_str, false);
> > > >  			ret = -1;
> > > > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > > > index 47ffd9e7..f12fc5cb 100644
> > > > --- a/lib/igt_core.h
> > > > +++ b/lib/igt_core.h
> > > > @@ -843,6 +843,7 @@ bool igt_run_in_simulation(void);
> > > >  void igt_skip_on_simulation(void);
> > > >  
> > > >  extern const char *igt_interactive_debug;
> > > > +extern bool igt_skip_crc_compare;
> > > >  
> > > >  /**
> > > >   * igt_log_level:
> > > > diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
> > > > index 640c78e9..04d1648b 100644
> > > > --- a/lib/igt_debugfs.c
> > > > +++ b/lib/igt_debugfs.c
> > > > @@ -405,6 +405,12 @@ static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b,
> > > >   * assert that CRCs match, never that they are different. Otherwise there might
> > > >   * be random testcase failures when different screen contents end up with the
> > > >   * same CRC by chance.
> > > > + *
> > > > + * Passing --skip-crc-compare on the command line will force this function
> > > > + * to always pass, which can be useful in interactive debugging where you
> > > > + * might know the test will fail, but still want the test to keep going as if
> > > > + * it had succeeded so that you can see the on-screen behavior.
> > > > + *
> > > >   */
> > > >  void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
> > > >  {
> > > > @@ -416,7 +422,7 @@ void igt_assert_crc_equal(const igt_crc_t *a, const igt_crc_t *b)
> > > >  		igt_debug("CRC mismatch at index %d: 0x%x != 0x%x\n", index,
> > > >  			  a->crc[index], b->crc[index]);
> > > >  
> > > > -	igt_assert(!mismatch);
> > > > +	igt_assert(!mismatch || igt_skip_crc_compare);
> > > 
> > > I think an igt_debug line here could be useful when we skip the assert.
> > > With that
> > 
> > Daniel, is the debug print just above not sufficient? Or would you like
> > a more explicit indication that we skipped the assert even though there
> > was mismatch?
> > 
> > I guess we could do something like:
> > 
> > if (mismatch)
> >  igt_debug("CRC mismatch%s at index %d: 0x%x != 0x%x\n",
> >            skip_crc_compare ? " (ignored)" : "",
> > 	   index, a->crc[index], b->crc[index]);
> > 
> > to avoid spamming the log with two lines per mismatch?
> > 
> > I was just looking for this knob until I realized we never applied this
> > patch :/
> 
> Hm yeah I missed that debug line, I think that's good enough.

Cool. Pimped the debug message as above and pushed.

-- 
Ville Syrjälä
Intel
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2019-07-03 12:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20190221002857.5007-1-matthew.d.roper@intel.com>
2019-02-21  0:34 ` [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option Matt Roper
2019-02-21  0:34   ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_crtc_background_color: overhaul to match upstream ABI (v5) Matt Roper
2019-02-21  0:41     ` [igt-dev] [PATCH i-g-t 2/2] tests/kms_crtc_background_color: overhaul to match upstream ABI (v5.1) Matt Roper
2019-02-21  9:33   ` [igt-dev] [PATCH i-g-t 1/2] lib: Add --skip-crc-compare option Daniel Vetter
2019-02-21 18:00     ` Ville Syrjälä
2019-02-22 14:32   ` [Intel-gfx] " Daniel Vetter
2019-06-27 16:05     ` [igt-dev] [Intel-gfx] " Ville Syrjälä
2019-07-03 10:36       ` Daniel Vetter
2019-07-03 12:54         ` Ville Syrjälä

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