From patchwork Mon Jul 20 15:00:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kumar, Mahesh" X-Patchwork-Id: 6828521 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A02B99F358 for ; Mon, 20 Jul 2015 14:59:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AAAD7204A7 for ; Mon, 20 Jul 2015 14:59:02 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A2C6520499 for ; Mon, 20 Jul 2015 14:59:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DF91D6E3CB; Mon, 20 Jul 2015 07:59:00 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id 979FE6E3CB for ; Mon, 20 Jul 2015 07:58:59 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP; 20 Jul 2015 07:58:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,508,1432623600"; d="scan'208";a="732117942" Received: from kumarmah-desk.iind.intel.com ([10.223.25.6]) by orsmga001.jf.intel.com with ESMTP; 20 Jul 2015 07:58:58 -0700 From: "Kumar, Mahesh" To: intel-gfx@lists.freedesktop.org Date: Mon, 20 Jul 2015 20:30:41 +0530 Message-Id: <1437404441-22268-1-git-send-email-mahesh1.kumar@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [Intel-gfx] [PATCH] kms_universal_plane: subtest for yuv pixel format in primary plane X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This test commit YUV framebuffer in primay plane. I'm using empty FB, because this fulfills the purpose of testing YUV. Increase IGT_MAX_PLANES to 5 and add enum for IGT_PLANE_4, as in Broxton we have 4Plane+1cursor plane. Signed-off-by: Kumar, Mahesh --- lib/igt_fb.c | 4 +++ lib/igt_kms.c | 1 + lib/igt_kms.h | 3 +- tests/kms_universal_plane.c | 82 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) 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/lib/igt_kms.c b/lib/igt_kms.c index 0bb16b4..781ffa5 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -213,6 +213,7 @@ const char *kmstest_plane_name(enum igt_plane plane) [IGT_PLANE_1] = "plane1", [IGT_PLANE_2] = "plane2", [IGT_PLANE_3] = "plane3", + [IGT_PLANE_4] = "plane4", [IGT_PLANE_CURSOR] = "cursor", }; diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 09c08aa..14c8b28 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -53,6 +53,7 @@ enum igt_plane { IGT_PLANE_PRIMARY = IGT_PLANE_1, IGT_PLANE_2, IGT_PLANE_3, + IGT_PLANE_4, IGT_PLANE_CURSOR, }; @@ -205,7 +206,7 @@ struct igt_pipe { igt_display_t *display; enum pipe pipe; bool enabled; -#define IGT_MAX_PLANES 4 +#define IGT_MAX_PLANES 5 int n_planes; igt_plane_t planes[IGT_MAX_PLANES]; uint64_t background; /* Background color MSB BGR 16bpc LSB */ 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;