[Intel-gfx] [PATCH i-g-t] tests/kms_rotation_crc: Switch to one-shot CRC collection

Matt Roper matthew.d.roper at intel.com
Mon Sep 9 16:31:38 UTC 2019


kms_rotation_crc manually starts and stops CRC collection and reads
single CRC values when it needs them.  Depending on how long the other
test setup and execution operations take, the CRC buffer (128 entries)
can fill up CRC values that the test never reads or uses.  Our CI system
has stumbled over several cases where the buffer fills up and overflows
due to this.  Let's switch this test over to the
igt_pipe_crc_collect_crc API which will handle the start+stop of CRC
collection when a single CRC is needed so that we won't collect a bunch
of unwanted CRC values and run the risk of overflow.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105127
Signed-off-by: Matt Roper <matthew.d.roper at intel.com>
---
 tests/kms_rotation_crc.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c
index 668c1732..8f36fd2f 100644
--- a/tests/kms_rotation_crc.c
+++ b/tests/kms_rotation_crc.c
@@ -167,7 +167,7 @@ static void cleanup_crtc(data_t *data)
 }
 
 static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
-			 igt_plane_t *plane, bool start_crc)
+			 igt_plane_t *plane)
 {
 	igt_display_t *display = &data->display;
 
@@ -181,9 +181,6 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe,
 
 	igt_display_commit2(display, COMMIT_ATOMIC);
 	data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe, INTEL_PIPE_CRC_SOURCE_AUTO);
-
-	if (start_crc)
-		igt_pipe_crc_start(data->pipe_crc);
 }
 
 enum rectangle_type {
@@ -263,7 +260,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 	igt_display_commit2(display, COMMIT_ATOMIC);
 
-	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->flip_crc);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &data->flip_crc);
 
 	/*
 	  * Prepare the non-rotated flip fb.
@@ -286,7 +283,7 @@ static void prepare_fbs(data_t *data, igt_output_t *output,
 		igt_plane_set_position(plane, data->pos_x, data->pos_y);
 	igt_display_commit2(display, COMMIT_ATOMIC);
 
-	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &data->ref_crc);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &data->ref_crc);
 
 	/*
 	 * Prepare the non-rotated reference fb.
@@ -336,7 +333,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 	igt_assert_eq(ret, 0);
 
 	/* Check CRC */
-	igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
+	igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
 	igt_assert_crc_equal(&data->ref_crc, &crc_output);
 
 	/*
@@ -359,7 +356,7 @@ static void test_single_case(data_t *data, enum pipe pipe,
 			igt_assert_eq(ret, 0);
 		}
 		kmstest_wait_for_pageflip(data->gfx_fd);
-		igt_pipe_crc_get_current(display->drm_fd, data->pipe_crc, &crc_output);
+		igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output);
 		igt_assert_crc_equal(&data->flip_crc,
 				     &crc_output);
 	}
@@ -388,7 +385,7 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 		plane = igt_output_get_plane_type(output, plane_type);
 		igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
 
-		prepare_crtc(data, output, pipe, plane, true);
+		prepare_crtc(data, output, pipe, plane);
 
 		for (i = 0; i < num_rectangle_types; i++) {
 			/* Unsupported on i915 */
@@ -416,7 +413,6 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form
 						 data->override_fmt, test_bad_format);
 			}
 		}
-		igt_pipe_crc_stop(data->pipe_crc);
 	}
 }
 
@@ -473,7 +469,7 @@ static bool get_multiplane_crc(data_t *data, igt_output_t *output,
 	ret = igt_display_try_commit2(display, COMMIT_ATOMIC);
 	igt_assert_eq(ret, 0);
 
-	igt_pipe_crc_get_current(data->gfx_fd, data->pipe_crc, crc_output);
+	igt_pipe_crc_collect_crc(data->pipe_crc, crc_output);
 
 	for (c = 0; c < numplanes && oldplanes; c++)
 		igt_remove_fb(data->gfx_fd, &oldplanes[c].fb);
@@ -564,7 +560,6 @@ static void test_multi_plane_rotation(data_t *data, enum pipe pipe)
 
 		data->pipe_crc = igt_pipe_crc_new(data->gfx_fd, pipe,
 						  INTEL_PIPE_CRC_SOURCE_AUTO);
-		igt_pipe_crc_start(data->pipe_crc);
 
 		for (i = 0; i < ARRAY_SIZE(planeconfigs); i++) {
 			p[0].planetype = DRM_PLANE_TYPE_PRIMARY;
@@ -620,7 +615,6 @@ static void test_multi_plane_rotation(data_t *data, enum pipe pipe)
 				}
 			}
 		}
-		igt_pipe_crc_stop(data->pipe_crc);
 		igt_pipe_crc_free(data->pipe_crc);
 		igt_output_set_pipe(output, PIPE_ANY);
 	}
@@ -656,7 +650,7 @@ static void test_plane_rotation_exhaust_fences(data_t *data,
 
 	igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION));
 
-	prepare_crtc(data, output, pipe, plane, false);
+	prepare_crtc(data, output, pipe, plane);
 
 	mode = igt_output_get_mode(output);
 	w = mode->hdisplay;
-- 
2.20.1



More information about the Intel-gfx mailing list