[igt-dev] [PATCH i-g-t 3/9] tests/kms_plane_scaling: Test all pixel formats in pipe-*-scaler-with-rotation

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Thu Feb 1 15:39:08 UTC 2018


This will allow us to test NV12 as well, when available.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
---
 tests/kms_plane_scaling.c | 46 +++++++++++++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 17 deletions(-)

diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c
index d32f3441e8c9..18a42035fb3e 100644
--- a/tests/kms_plane_scaling.c
+++ b/tests/kms_plane_scaling.c
@@ -164,25 +164,13 @@ static const igt_rotation_t rotations[] = {
 	IGT_ROTATION_270,
 };
 
-static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
-					   igt_output_t *output)
+static bool can_rotate(unsigned format)
 {
-	igt_display_t *display = &d->display;
-	igt_plane_t *plane;
-
-	igt_output_set_pipe(output, pipe);
-	for_each_plane_on_pipe(display, pipe, plane) {
-		if (plane->type == DRM_PLANE_TYPE_CURSOR)
-			continue;
+	if (format == DRM_FORMAT_C8 ||
+	    format == DRM_FORMAT_RGB565)
+		return false;
 
-		for (int i = 0; i < ARRAY_SIZE(rotations); i++) {
-			igt_rotation_t rot = rotations[i];
-
-			check_scaling_pipe_plane_rot(d, plane, DRM_FORMAT_XRGB8888,
-						     LOCAL_I915_FORMAT_MOD_Y_TILED,
-						     pipe, output, rot);
-		}
-	}
+	return true;
 }
 
 static bool can_draw(uint32_t drm_format)
@@ -199,6 +187,30 @@ static bool can_draw(uint32_t drm_format)
 	return false;
 }
 
+static void test_scaler_with_rotation_pipe(data_t *d, enum pipe pipe,
+					   igt_output_t *output)
+{
+	igt_display_t *display = &d->display;
+	igt_plane_t *plane;
+
+	igt_output_set_pipe(output, pipe);
+	for_each_plane_on_pipe(display, pipe, plane) {
+		if (plane->type == DRM_PLANE_TYPE_CURSOR)
+			continue;
+
+		for (int i = 0; i < ARRAY_SIZE(rotations); i++) {
+			igt_rotation_t rot = rotations[i];
+			for (int j = 0; j < plane->drm_plane->count_formats; j++) {
+				unsigned format = plane->drm_plane->formats[j];
+				if (can_draw(format) && can_rotate(format))
+					check_scaling_pipe_plane_rot(d, plane, format,
+								     LOCAL_I915_FORMAT_MOD_Y_TILED,
+								     pipe, output, rot);
+			}
+		}
+	}
+}
+
 static const uint64_t tilings[] = {
 	LOCAL_DRM_FORMAT_MOD_NONE,
 	LOCAL_I915_FORMAT_MOD_X_TILED,
-- 
2.15.1



More information about the igt-dev mailing list