From 48d9da5636d54d37261b3fd2fa25aec70746b999 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Tue, 30 Jan 2018 16:11:08 +0100 Subject: tests/kms_plane_scaling: Test all pixel formats in pipe-*-scaler-with-rotation This will allow us to test NV12 as well, when available. Signed-off-by: Maarten Lankhorst Reviewed-by: Mika Kahola --- tests/kms_plane_scaling.c | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) (limited to 'tests/kms_plane_scaling.c') diff --git a/tests/kms_plane_scaling.c b/tests/kms_plane_scaling.c index d32f3441..18a42035 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, -- cgit v1.2.3