[PATCH i-g-t] DO_NOT_MERGE: Sanity check for CRC mismatch

Bhanuprakash Modem bhanuprakash.modem at intel.com
Wed Jul 29 17:31:52 UTC 2020


Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
 tests/kms_pipe_crc_basic.c | 67 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/tests/kms_pipe_crc_basic.c b/tests/kms_pipe_crc_basic.c
index cb93c1ad..420d4d4a 100644
--- a/tests/kms_pipe_crc_basic.c
+++ b/tests/kms_pipe_crc_basic.c
@@ -154,6 +154,70 @@ static void test_read_crc(data_t *data, enum pipe pipe, unsigned flags)
 	}
 }
 
+static void test_check_crc(data_t *data)
+{
+	igt_display_t *display = &data->display;
+	igt_output_t *output;
+	enum pipe pipe;
+	drmModeModeInfo *mode;
+	struct igt_fb fb0, fb1;
+	igt_crc_t ref_crc, crc;
+	igt_pipe_crc_t *pipe_crc;
+	igt_plane_t *primary;
+
+	for_each_pipe_with_valid_output(display, pipe, output) {
+		igt_output_set_pipe(output, pipe);
+		mode = igt_output_get_mode(output);
+
+		igt_create_color_fb(data->drm_fd,
+				mode->hdisplay, mode->vdisplay,
+				DRM_FORMAT_XRGB8888,
+				LOCAL_DRM_FORMAT_MOD_NONE,
+				1.0, 1.0, 1.0,
+				&fb0);
+
+		igt_create_color_fb(data->drm_fd,
+				mode->hdisplay, mode->vdisplay,
+				DRM_FORMAT_XRGB8888,
+				LOCAL_DRM_FORMAT_MOD_NONE,
+				1.0, 1.0, 1.0,
+				&fb1);
+
+		primary = igt_output_get_plane_type(output, DRM_PLANE_TYPE_PRIMARY);
+
+		igt_plane_set_fb(primary, &fb0);
+		igt_display_commit(display);
+
+		if (pipe_crc)
+			igt_pipe_crc_free(pipe_crc);
+
+		pipe_crc = igt_pipe_crc_new(data->drm_fd, pipe,
+				INTEL_PIPE_CRC_SOURCE_AUTO);
+
+		igt_pipe_crc_collect_crc(pipe_crc, &ref_crc);
+
+		igt_plane_set_fb(primary, &fb1);
+		igt_display_commit(display);
+
+		igt_pipe_crc_collect_crc(pipe_crc, &crc);
+		igt_assert_crc_equal(&crc, &ref_crc);
+
+		igt_pipe_crc_free(pipe_crc);
+		pipe_crc = NULL;
+		igt_plane_set_fb(primary, NULL);
+		igt_output_set_pipe(output, PIPE_ANY);
+		igt_display_commit(display);
+
+		igt_remove_fb(data->drm_fd, &fb0);
+		igt_remove_fb(data->drm_fd, &fb1);
+
+		/* once is enough */
+		return;
+	}
+
+	igt_skip("no valid crtc/connector combinations found\n");
+}
+
 data_t data = {0, };
 
 igt_main
@@ -211,6 +275,9 @@ igt_main
 		}
 	}
 
+	igt_subtest("compare-crc")
+                test_check_crc(&data);
+
 	igt_fixture {
 		igt_display_fini(&data.display);
 	}
-- 
2.20.1



More information about the Intel-gfx-trybot mailing list