[PATCH i-g-t 2/3] tests/kms_async_flips: Split test_init()

Arun R Murthy arun.r.murthy at intel.com
Thu May 18 03:34:35 UTC 2023


Split the test_init() into two parts: one sets up the mode, the
other the framebuffers. Will be useful for testing different
modifiers.

Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Arun R Murthy <arun.r.murthy at intel.com>
Reviewed-by: Karthik B S <karthik.b.s at intel.com>
---
 tests/kms_async_flips.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/tests/kms_async_flips.c b/tests/kms_async_flips.c
index fe27a9ec..1e96d7fc 100644
--- a/tests/kms_async_flips.c
+++ b/tests/kms_async_flips.c
@@ -148,23 +148,31 @@ static void require_monotonic_timestamp(int fd)
 
 static void test_init(data_t *data)
 {
-	int i;
-	uint32_t width, height;
-	igt_plane_t *plane;
-	static uint32_t prev_output_id;
 	drmModeModeInfo *mode;
 
 	igt_display_reset(&data->display);
 	igt_display_commit(&data->display);
 
 	mode = igt_output_get_mode(data->output);
-	width = mode->hdisplay;
-	height = mode->vdisplay;
 
 	data->crtc_id = data->display.pipes[data->pipe].crtc_id;
 	data->refresh_rate = mode->vrefresh;
 
 	igt_output_set_pipe(data->output, data->pipe);
+}
+
+static void test_init_fbs(data_t *data)
+{
+	int i;
+	uint32_t width, height;
+	igt_plane_t *plane;
+	static uint32_t prev_output_id;
+	drmModeModeInfo *mode;
+
+	mode = igt_output_get_mode(data->output);
+	width = mode->hdisplay;
+	height = mode->vdisplay;
+
 	plane = igt_output_get_plane_type(data->output, DRM_PLANE_TYPE_PRIMARY);
 
 	if (prev_output_id != data->output->id) {
@@ -191,8 +199,6 @@ static void test_async_flip(data_t *data)
 	long long int fps;
 	struct timeval start, end, diff;
 
-	test_init(data);
-
 	gettimeofday(&start, NULL);
 	frame = 1;
 	do {
@@ -287,8 +293,6 @@ static void test_timestamp(data_t *data)
 	unsigned int seq, seq1;
 	int ret;
 
-	test_init(data);
-
 	/*
 	 * In older platforms(<= gen10), async address update bit is double buffered.
 	 * So flip timestamp can be verified only from the second flip.
@@ -346,8 +350,6 @@ static void test_cursor(data_t *data)
 	do_or_die(drmGetCap(data->drm_fd, DRM_CAP_CURSOR_WIDTH, &width));
 	do_or_die(drmGetCap(data->drm_fd, DRM_CAP_CURSOR_WIDTH, &height));
 
-	test_init(data);
-
 	igt_create_color_fb(data->drm_fd, width, height, DRM_FORMAT_ARGB8888,
 			    DRM_FORMAT_MOD_LINEAR, 1., 1., 1., &cursor_fb);
 
@@ -388,8 +390,6 @@ static void test_invalid(data_t *data)
 	width = mode->hdisplay;
 	height = mode->vdisplay;
 
-	test_init(data);
-
 	igt_create_fb(data->drm_fd, width, height, DRM_FORMAT_XRGB8888,
 		      I915_FORMAT_MOD_Y_TILED, &fb);
 
@@ -493,8 +493,6 @@ static void test_crc(data_t *data)
 	data->frame_count = 0;
 	data->flip_pending = false;
 
-	test_init(data);
-
 	cr = igt_get_cairo_ctx(data->drm_fd, &data->bufs[frame]);
 	igt_paint_color(cr, 0, 0, data->bufs[frame].width, data->bufs[frame].height, 1.0, 0.0, 0.0);
 	igt_put_cairo_ctx(cr);
@@ -560,9 +558,11 @@ static void run_test(data_t *data, void (*test)(data_t *))
 			if (!i915_pipe_output_combo_valid(display))
 				continue;
 
+			test_init(data);
 			igt_dynamic_f("pipe-%s-%s", kmstest_pipe_name(pipe), output->name) {
 				data->output = output;
 				data->pipe = pipe;
+				test_init_fbs(data);
 				test(data);
 			}
 
-- 
2.25.1



More information about the Intel-gfx-trybot mailing list