[igt-dev] [PATCH i-g-t] tests/kms_plane: add source clamping test

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Thu Nov 15 15:51:06 UTC 2018


Add test which create fb bigger than plane and clamp fb from all sides.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 tests/kms_plane.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/tests/kms_plane.c b/tests/kms_plane.c
index 45e0a30..d79c22e 100644
--- a/tests/kms_plane.c
+++ b/tests/kms_plane.c
@@ -41,6 +41,7 @@ typedef struct {
 	int drm_fd;
 	igt_display_t display;
 	igt_pipe_crc_t *pipe_crc;
+	uint32_t crop;
 } data_t;
 
 static color_t red   = { 1.0f, 0.0f, 0.0f };
@@ -412,12 +413,22 @@ static void test_format_plane_color(data_t *data, enum pipe pipe,
 	const color_t *c = &colors[color];
 	struct igt_fb old_fb = *fb;
 
-	igt_create_color_fb(data->drm_fd, width, height,
-			    format, LOCAL_DRM_FORMAT_MOD_NONE,
+	igt_create_color_fb(data->drm_fd, width+data->crop*2,
+			    height+data->crop*2, format,
+			    LOCAL_DRM_FORMAT_MOD_NONE,
 			    c->red, c->green, c->blue, fb);
 
 	igt_plane_set_fb(plane, fb);
 
+	/*
+	 * if clamping test
+	 */
+	if (width-data->crop != 0) {
+		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_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);
 
@@ -435,6 +446,12 @@ static void test_format_plane(data_t *data, enum pipe pipe,
 	uint64_t width, height;
 	igt_crc_t ref_crc[ARRAY_SIZE(colors)];
 
+	/*
+	 * No clamping test for cursor plane
+	 */
+	if (data->crop != 0 && plane->type == DRM_PLANE_TYPE_CURSOR)
+		return;
+
 	mode = igt_output_get_mode(output);
 	if (plane->type != DRM_PLANE_TYPE_CURSOR) {
 		width = mode->hdisplay;
@@ -554,6 +571,13 @@ run_tests_for_pipe_plane(data_t *data, enum pipe pipe)
 		      kmstest_pipe_name(pipe))
 		test_pixel_formats(data, pipe);
 
+	igt_subtest_f("pixel-format-pipe-%s-planes-source-clamping",
+		      kmstest_pipe_name(pipe)) {
+		data->crop = 4;
+		test_pixel_formats(data, pipe);
+	}
+
+	data->crop = 0;
 	igt_subtest_f("plane-position-covered-pipe-%s-planes",
 		      kmstest_pipe_name(pipe))
 		test_plane_position(data, pipe, TEST_POSITION_FULLY_COVERED);
-- 
2.7.4



More information about the igt-dev mailing list