From patchwork Wed Mar 16 17:04:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew Auld X-Patchwork-Id: 8602681 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 8CBEC9F44D for ; Wed, 16 Mar 2016 17:06:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A524020222 for ; Wed, 16 Mar 2016 17:06:34 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BB81820218 for ; Wed, 16 Mar 2016 17:06:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 015326E9B7; Wed, 16 Mar 2016 17:06:29 +0000 (UTC) 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 1A9096E9B5 for ; Wed, 16 Mar 2016 17:06:27 +0000 (UTC) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 16 Mar 2016 10:04:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,345,1455004800"; d="scan'208";a="765422915" Received: from unknown (HELO localhost.isw.intel.com) ([10.237.224.39]) by orsmga003.jf.intel.com with ESMTP; 16 Mar 2016 10:04:31 -0700 From: Matthew Auld To: intel-gfx@lists.freedesktop.org Date: Wed, 16 Mar 2016 17:04:25 +0000 Message-Id: <1458147866-2816-1-git-send-email-matthew.auld@intel.com> X-Mailer: git-send-email 2.4.3 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 1/2] tests/kms_rotation_crc: exercise invalid rotations 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 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 Add expect-to-fail tests for invalid rotations on each of the plane types. v2: (Ville Syrjälä) - use igt_create_fb - y-tiled will be rejected by gen < 9 - don't hardcode all the plane rotation failure combinations v3: - use valid pixel format for cursor plane Cc: Joonas Lahtinen Signed-off-by: Matthew Auld --- tests/kms_rotation_crc.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index f94f8f1..bd9ab7b 100644 --- a/tests/kms_rotation_crc.c +++ b/tests/kms_rotation_crc.c @@ -479,6 +479,74 @@ err_commit: igt_assert(ret == 0); } +static void exhaust_invalid_plane_rotations(data_t *data, enum igt_plane plane_type) +{ + igt_display_t *display = &data->display; + int fd = data->gfx_fd, fb_id; + uint64_t tiling; + uint32_t pixel_format = DRM_FORMAT_XRGB8888; + enum igt_commit_style commit = COMMIT_LEGACY; + igt_output_t *output = &display->outputs[0]; + igt_plane_t *plane; + drmModeModeInfo *mode; + drmModePropertyPtr prop; + uint64_t supported_plane_rotations = 0, rotation = IGT_ROTATION_0; + int ret, i; + + if (intel_gen(intel_get_drm_devid(fd)) >= 9) + tiling = LOCAL_I915_FORMAT_MOD_Y_TILED; + else + tiling = LOCAL_I915_FORMAT_MOD_X_TILED; + + if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) { + igt_require(data->display.has_universal_planes); + commit = COMMIT_UNIVERSAL; + } + + if (plane_type == IGT_PLANE_CURSOR) + pixel_format = DRM_FORMAT_ARGB8888; + + igt_require(output != NULL && output->valid == true); + + plane = igt_output_get_plane(output, plane_type); + igt_require(igt_plane_supports_rotation(plane)); + + mode = igt_output_get_mode(output); + + fb_id = igt_create_fb(fd, mode->hdisplay, mode->vdisplay, pixel_format, + tiling, &data->fb); + igt_assert(fb_id); + + igt_plane_set_fb(plane, NULL); + igt_display_commit(display); + + igt_plane_set_fb(plane, &data->fb); + + kmstest_get_property(fd, plane->drm_plane->plane_id, DRM_MODE_OBJECT_PLANE, + "rotation", NULL, NULL, &prop); + + for (i = 0; i < prop->count_enums; ++i) + supported_plane_rotations |= (1ULL << prop->enums[i].value); + + for (i = 1; i <= 4; i++) { + if (!(rotation & supported_plane_rotations)) { + igt_plane_set_rotation(plane, rotation); + + ret = igt_display_try_commit2(display, commit); + if (ret != -EINVAL) + goto err_commit; + + } + rotation <<= 1; + } + +err_commit: + igt_remove_fb(fd, &data->fb); + kmstest_restore_vt_mode(); + + igt_assert_eq(ret, -EINVAL); +} + igt_main { data_t data = {}; @@ -579,6 +647,18 @@ igt_main test_plane_rotation_exhaust_fences(&data, IGT_PLANE_PRIMARY); } + igt_subtest_f("primary-rotations-invalid") { + exhaust_invalid_plane_rotations(&data, IGT_PLANE_PRIMARY); + } + + igt_subtest_f("sprite-rotations-invalid") { + exhaust_invalid_plane_rotations(&data, IGT_PLANE_2); + } + + igt_subtest_f("cursor-rotations-invalid") { + exhaust_invalid_plane_rotations(&data, IGT_PLANE_CURSOR); + } + igt_fixture { igt_display_fini(&data.display); }