This test commit YUV framebuffer in primay plane. I'm using empty FB, because this fulfills the purpose of testing YUV. V2: Revert chnages for MAX_PLANE count as per nabendu's comment. These changes are already floating for review. Signed-off-by: Kumar, Mahesh <mahesh1.kumar@xxxxxxxxx> --- lib/igt_fb.c | 4 +++ tests/kms_universal_plane.c | 82 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+) diff --git a/lib/igt_fb.c b/lib/igt_fb.c index 134dbd2..e570bfa 100644 --- a/lib/igt_fb.c +++ b/lib/igt_fb.c @@ -66,6 +66,10 @@ static struct format_desc_struct { DF(XRGB8888, RGB24, 32, 24), DF(XRGB2101010, RGB30, 32, 30), DF(ARGB8888, ARGB32, 32, 32), + DF(YUYV, INVALID, 16, 16), + DF(YVYU, INVALID, 16, 16), + DF(UYVY, INVALID, 16, 16), + DF(VYUY, INVALID, 16, 16), }; #undef DF diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c index 635cc79..ed4b134 100644 --- a/tests/kms_universal_plane.c +++ b/tests/kms_universal_plane.c @@ -57,6 +57,12 @@ typedef struct { struct igt_fb red_fb, blue_fb; } pageflip_test_t; +typedef struct { + data_t *data; + struct igt_fb fullsize_fb, undersize_fb; +} primary_yuv_test_t; + + static void functional_test_init(functional_test_t *test, igt_output_t *output, enum pipe pipe) { @@ -430,6 +436,77 @@ sanity_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output) } static void +primary_yuv_test_init(primary_yuv_test_t *test, igt_output_t *output, enum pipe pipe) +{ + data_t *data = test->data; + drmModeModeInfo *mode; + + igt_output_set_pipe(output, pipe); + + mode = igt_output_get_mode(output); + igt_create_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, + DRM_FORMAT_YUYV, + LOCAL_DRM_FORMAT_MOD_NONE, + &test->fullsize_fb); + igt_create_fb(data->drm_fd, 300, 300, + DRM_FORMAT_YVYU, + LOCAL_DRM_FORMAT_MOD_NONE, + &test->undersize_fb); +} + +static void +primary_yuv_test_fini(primary_yuv_test_t *test, igt_output_t *output) +{ + igt_remove_fb(test->data->drm_fd, &test->fullsize_fb); + igt_remove_fb(test->data->drm_fd, &test->undersize_fb); + + igt_output_set_pipe(output, PIPE_ANY); + igt_display_commit2(&test->data->display, COMMIT_LEGACY); +} + +/* + * YUV pixel format test for primary plane + * Display Full frame in primay then 300x300 frame + */ + +static void +primary_yuv_test_pipe(data_t *data, enum pipe pipe, igt_output_t *output) +{ + primary_yuv_test_t test = { .data = data }; + igt_plane_t *primary; + + igt_skip_on(pipe >= data->display.n_pipes); + + igt_output_set_pipe(output, pipe); + + primary_yuv_test_init(&test, output, pipe); + + primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY); + + /* Use legacy API to set a mode with a Fullsize FB */ + igt_plane_set_fb(primary, &test.fullsize_fb); + igt_display_commit2(&data->display, COMMIT_LEGACY); + + /* Disable the primary plane */ + igt_plane_set_fb(primary, NULL); + igt_display_commit2(&data->display, COMMIT_UNIVERSAL); + + /* Use Universal API to set a mode with a Fullsize FB */ + igt_plane_set_fb(primary, &test.fullsize_fb); + igt_display_commit2(&data->display, COMMIT_UNIVERSAL); + + /* Use Universal API to set a mode with a Undersize FB */ + igt_plane_set_fb(primary, &test.undersize_fb); + igt_display_commit2(&data->display, COMMIT_UNIVERSAL); + + /* Disable the primary plane */ + igt_plane_set_fb(primary, NULL); + + primary_yuv_test_fini(&test, output); + +} + +static void pageflip_test_init(pageflip_test_t *test, igt_output_t *output, enum pipe pipe) { data_t *data = test->data; @@ -663,6 +740,11 @@ run_tests_for_pipe(data_t *data, enum pipe pipe) kmstest_pipe_name(pipe)) for_each_connected_output(&data->display, output) cursor_leak_test_pipe(data, pipe, output); + + igt_subtest_f("primary-plane-pipe-%s-yuv", + kmstest_pipe_name(pipe)) + for_each_connected_output(&data->display, output) + primary_yuv_test_pipe(data, pipe, output); } static data_t data; -- 1.9.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/intel-gfx