From patchwork Wed Apr 22 15:46:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 6256841 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 7077C9F1C4 for ; Wed, 22 Apr 2015 15:47:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7F85020328 for ; Wed, 22 Apr 2015 15:47:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 844022025A for ; Wed, 22 Apr 2015 15:47:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 234716E6F7; Wed, 22 Apr 2015 08:47:06 -0700 (PDT) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D0166E6F8 for ; Wed, 22 Apr 2015 08:47:04 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 22 Apr 2015 08:47:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,624,1422950400"; d="scan'208";a="713656950" Received: from tursulin-linux.isw.intel.com ([10.102.226.59]) by fmsmga002.fm.intel.com with ESMTP; 22 Apr 2015 08:47:02 -0700 From: Tvrtko Ursulin To: Intel-gfx@lists.freedesktop.org Date: Wed, 22 Apr 2015 16:46:48 +0100 Message-Id: <1429717608-359-8-git-send-email-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1429717608-359-1-git-send-email-tvrtko.ursulin@linux.intel.com> References: <1429717608-359-1-git-send-email-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 7/7] kms_rotation_crc: Use main test for negative cases 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=-3.2 required=5.0 tests=BAYES_00,HK_RANDOM_FROM, RCVD_IN_DNSWL_MED, T_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 From: Tvrtko Ursulin Saves a good amount of code duplication by supporting expected failures from the main loop. Signed-off-by: Tvrtko Ursulin Cc: Sonika Jindal Reviewed-by: Sonika Jindal --- tests/kms_rotation_crc.c | 106 +++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 73 deletions(-) diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index 45a9284..0661b6b 100644 --- a/tests/kms_rotation_crc.c +++ b/tests/kms_rotation_crc.c @@ -41,6 +41,8 @@ typedef struct { int pos_x; int pos_y; unsigned int w, h; + uint32_t override_fmt; + uint64_t override_tiling; } data_t; static void @@ -92,8 +94,10 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, igt_display_t *display = &data->display; int fb_id, fb_modeset_id; unsigned int w, h; - uint64_t tiling = LOCAL_DRM_FORMAT_MOD_NONE; - uint32_t pixel_format = DRM_FORMAT_XRGB8888; + uint64_t tiling = data->override_tiling ? + data->override_tiling : LOCAL_DRM_FORMAT_MOD_NONE; + uint32_t pixel_format = data->override_fmt ? + data->override_fmt : DRM_FORMAT_XRGB8888; enum igt_commit_style commit = COMMIT_LEGACY; igt_plane_t *primary; @@ -132,10 +136,12 @@ static void prepare_crtc(data_t *data, igt_output_t *output, enum pipe pipe, */ if (data->rotation == IGT_ROTATION_90 || data->rotation == IGT_ROTATION_270) { - tiling = LOCAL_I915_FORMAT_MOD_Y_TILED; + tiling = data->override_tiling ? + data->override_tiling : LOCAL_I915_FORMAT_MOD_Y_TILED; w = h = mode->vdisplay; } else if (plane->is_cursor) { - pixel_format = DRM_FORMAT_ARGB8888; + pixel_format = data->override_fmt ? + data->override_fmt : DRM_FORMAT_ARGB8888; w = h = 128; } @@ -196,67 +202,6 @@ static void cleanup_crtc(data_t *data, igt_output_t *output, igt_plane_t *plane) igt_display_commit(display); } -static void test_unsupported_tiling_pixel_format(data_t *data, enum igt_plane plane_type) -{ - drmModeModeInfo *mode; - igt_display_t *display = &data->display; - igt_output_t *output; - enum pipe pipe; - int fb_tiling_id, fb_565_id; - struct igt_fb fb_565, fb_tiling; - - for_each_connected_output(display, output) { - for_each_pipe(display, pipe) { - igt_plane_t *plane; - - igt_output_set_pipe(output, pipe); - - plane = igt_output_get_plane(output, plane_type); - igt_require(igt_plane_supports_rotation(plane)); - mode = igt_output_get_mode(output); - - fb_tiling_id = igt_create_fb(data->gfx_fd, - mode->hdisplay, mode->vdisplay, - DRM_FORMAT_XRGB8888, - LOCAL_DRM_FORMAT_MOD_NONE, - &fb_tiling); - igt_assert(fb_tiling_id); - igt_plane_set_fb(plane, &fb_tiling); - /* For the first modeset with legacy commit */ - igt_display_commit(display); - igt_plane_set_rotation(plane, data->rotation); - /* Shud fail because 90/270 is only supported with Y/Yf */ - igt_assert(igt_display_try_commit2(display, COMMIT_UNIVERSAL) == -EINVAL); - - fb_565_id = igt_create_fb(data->gfx_fd, - mode->hdisplay, mode->vdisplay, - DRM_FORMAT_RGB565, - LOCAL_I915_FORMAT_MOD_Y_TILED, - &fb_565); - igt_assert(fb_565_id); - igt_plane_set_fb(plane, &fb_565); - igt_plane_set_rotation(plane, data->rotation); - /* Shud fail because 90/270 is not supported with RGB565 */ - igt_assert(igt_display_try_commit2(display, COMMIT_UNIVERSAL) == -EINVAL); - - /* - * check the rotation state has been reset when the VT - * mode is restored - */ - kmstest_restore_vt_mode(); - kmstest_set_vt_graphics_mode(); - prepare_crtc(data, output, pipe, plane); - - igt_remove_fb(data->gfx_fd, &fb_tiling); - igt_remove_fb(data->gfx_fd, &fb_565); - cleanup_crtc(data, output, plane); - - igt_display_commit(display); - - } - } -} - static void test_plane_rotation(data_t *data, enum igt_plane plane_type) { igt_display_t *display = &data->display; @@ -265,6 +210,7 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type) int valid_tests = 0; igt_crc_t crc_output, crc_unrotated; enum igt_commit_style commit = COMMIT_LEGACY; + int ret; if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) { igt_require(data->display.has_universal_planes); @@ -288,11 +234,16 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type) igt_pipe_crc_collect_crc(data->pipe_crc, &crc_unrotated); igt_plane_set_rotation(plane, data->rotation); - igt_display_commit2(display, commit); - - igt_pipe_crc_collect_crc(data->pipe_crc, &crc_output); - - igt_assert_crc_equal(&data->ref_crc, &crc_output); + ret = igt_display_try_commit2(display, commit); + if (data->override_fmt || data->override_tiling) { + igt_assert(ret == -EINVAL); + } else { + igt_assert(ret == 0); + igt_pipe_crc_collect_crc(data->pipe_crc, + &crc_output); + igt_assert_crc_equal(&data->ref_crc, + &crc_output); + } /* * check the rotation state has been reset when the VT @@ -376,12 +327,21 @@ igt_main test_plane_rotation(&data, IGT_PLANE_2); } - igt_subtest_f("90-rotation-unsupported-tiling-pixel-format") { + igt_subtest_f("bad-pixel-format") { igt_require(gen >= 9); - data.rotation = IGT_ROTATION_90; data.pos_x = 0, data.pos_y = 0; - test_unsupported_tiling_pixel_format(&data, IGT_PLANE_PRIMARY); + data.rotation = IGT_ROTATION_90; + data.override_fmt = DRM_FORMAT_RGB565; + test_plane_rotation(&data, IGT_PLANE_PRIMARY); + } + + igt_subtest_f("bad-tiling") { + igt_require(gen >= 9); + data.override_fmt = 0; + data.rotation = IGT_ROTATION_90; + data.override_tiling = LOCAL_DRM_FORMAT_MOD_NONE; + test_plane_rotation(&data, IGT_PLANE_PRIMARY); } igt_fixture {