[igt-dev] [PATCH i-g-t] tests/kms_plane: Reduce execution time by reducing source size and performing upscaling.

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Thu Mar 7 11:55:57 UTC 2019


Execution time is way too high because of all the various conversion
routines and inefficient accesses done by pixman on uncached memory.
Fix it by reducing the source fb siaze, and using scaling to increase
to span the entire crtc.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 tests/kms_plane.c | 44 ++++++++++++++++++++++++++++++++++----------
 1 file changed, 34 insertions(+), 10 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 91de46948a3a..3a2dd3e3f1f9 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -407,14 +407,15 @@ static void set_legacy_lut(data_t *data, enum pipe pipe,
 
 static void test_format_plane_color(data_t *data, enum pipe pipe,
 				    igt_plane_t *plane,
-				    uint32_t format, int width, int height,
+				    uint32_t format, int src_w, int src_h,
+				    int dst_w, int dst_h,
 				    int color, igt_crc_t *crc, struct igt_fb *fb)
 {
 	const color_t *c = &colors[color];
 	struct igt_fb old_fb = *fb;
 
 	if (data->crop == 0 || format == DRM_FORMAT_XRGB8888) {
-		igt_create_color_fb(data->drm_fd, width, height, format,
+		igt_create_color_fb(data->drm_fd, src_w, src_h, format,
 				    LOCAL_DRM_FORMAT_MOD_NONE,
 				    c->red, c->green, c->blue, fb);
 	} else {
@@ -424,22 +425,22 @@ static void test_format_plane_color(data_t *data, enum pipe pipe,
 	 */
 		cairo_t *cr;
 
-		igt_create_fb(data->drm_fd, width + data->crop * 2,
-				    height + data->crop * 2, format,
+		igt_create_fb(data->drm_fd, src_w + data->crop * 2,
+				    src_h + data->crop * 2, format,
 				    LOCAL_DRM_FORMAT_MOD_NONE,
 				    fb);
 
 		cr = igt_get_cairo_ctx(data->drm_fd, fb);
 
 		igt_paint_color(cr, 0, 0,
-				width+data->crop * 2,
-				height+data->crop * 2,
+				src_w+data->crop * 2,
+				src_h+data->crop * 2,
 				1.0f - c->red,
 				1.0f - c->green,
 				1.0f - c->blue);
 
 		igt_paint_color(cr, data->crop, data->crop,
-				width, height,
+				src_w, src_h,
 				c->red, c->green, c->blue);
 
 		igt_put_cairo_ctx(data->drm_fd, fb, cr);
@@ -451,10 +452,10 @@ static void test_format_plane_color(data_t *data, enum pipe pipe,
 	 * if clamping test. DRM_FORMAT_XRGB8888 is used for reference color.
 	 */
 	if (data->crop != 0  && format != DRM_FORMAT_XRGB8888) {
-		igt_plane_set_size(plane, width, height);
 		igt_fb_set_position(fb, plane, data->crop, data->crop);
-		igt_fb_set_size(fb, plane, width, height);
+		igt_fb_set_size(fb, plane, src_w, src_h);
 	}
+	igt_plane_set_size(plane, dst_w, dst_h);
 
 	igt_display_commit2(&data->display, data->display.is_atomic ? COMMIT_ATOMIC : COMMIT_UNIVERSAL);
 	igt_pipe_crc_get_current(data->display.drm_fd, data->pipe_crc, crc);
@@ -470,7 +471,7 @@ static void test_format_plane(data_t *data, enum pipe pipe,
 	struct igt_fb fb = {};
 	drmModeModeInfo *mode;
 	uint32_t format, ref_format;
-	uint64_t width, height;
+	uint64_t width, height, dst_w, dst_h;
 	igt_crc_t ref_crc[ARRAY_SIZE(colors)];
 
 	/*
@@ -493,6 +494,8 @@ static void test_format_plane(data_t *data, enum pipe pipe,
 		do_or_die(drmGetCap(data->drm_fd, DRM_CAP_CURSOR_HEIGHT, &height));
 		ref_format = format = DRM_FORMAT_ARGB8888;
 	}
+	dst_w = width;
+	dst_h = height;
 
 	igt_debug("Testing connector %s on %s plane %s.%u\n",
 		  igt_output_name(output), kmstest_plane_type_name(plane->type),
@@ -516,9 +519,29 @@ static void test_format_plane(data_t *data, enum pipe pipe,
 		 IGT_FORMAT_ARGS(format),
 		 kmstest_pipe_name(pipe), plane->index);
 
+	if (plane->type != DRM_PLANE_TYPE_CURSOR && data->display.is_atomic) {
+		int ret;
+
+		igt_create_fb(data->drm_fd, 256, 256, format,
+				    LOCAL_DRM_FORMAT_MOD_NONE, &fb);
+
+		igt_plane_set_fb(plane, &fb);
+		/* Upscale to max size */
+		igt_plane_set_size(plane, dst_w, dst_h);
+
+		ret = igt_display_try_commit_atomic(&data->display, DRM_MODE_ATOMIC_TEST_ONLY, NULL);
+		igt_remove_fb(data->drm_fd, &fb);
+
+		if (!ret)
+			width = height = 256;
+
+		igt_plane_set_fb(plane, NULL);
+	}
+
 	for (int i = 0; i < ARRAY_SIZE(colors); i++) {
 		test_format_plane_color(data, pipe, plane,
 					format, width, height,
+					dst_w, dst_h,
 					i, &ref_crc[i], &fb);
 	}
 
@@ -550,6 +573,7 @@ static void test_format_plane(data_t *data, enum pipe pipe,
 		for (int j = 0; j < ARRAY_SIZE(colors); j++) {
 			test_format_plane_color(data, pipe, plane,
 						format, width, height,
+						dst_w, dst_h,
 						j, &crc, &fb);
 
 			igt_assert_crc_equal(&crc, &ref_crc[j]);
-- 
2.20.1



More information about the igt-dev mailing list