From patchwork Fri Mar 9 21:45:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sripada, Radhakrishna" X-Patchwork-Id: 10271993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9E55F605CE for ; Fri, 9 Mar 2018 21:43:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F7B729E04 for ; Fri, 9 Mar 2018 21:43:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73C4929F14; Fri, 9 Mar 2018 21:43:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CF8A529E04 for ; Fri, 9 Mar 2018 21:43:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EBB986E037; Fri, 9 Mar 2018 21:43:20 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id DFA366E037; Fri, 9 Mar 2018 21:43:19 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2018 13:43:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,447,1515484800"; d="scan'208";a="32678357" Received: from invictus.jf.intel.com ([10.54.75.152]) by FMSMGA003.fm.intel.com with ESMTP; 09 Mar 2018 13:43:19 -0800 From: Radhakrishna Sripada To: igt-dev@lists.freedesktop.org Date: Fri, 9 Mar 2018 13:45:15 -0800 Message-Id: <20180309214515.15660-1-radhakrishna.sripada@intel.com> X-Mailer: git-send-email 2.9.3 Subject: [Intel-gfx] [PATCH i-g-t v2] tests/kms_rotation_crc: Remove hardcoding of platforms in igt_require() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, Rodrigo Vivi , Daniel Vetter MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Anusha Srivatsa Rework the rotate and reflect subtests by checking the crtc supported properties against the ones that the test is testing. Remove the hardcoded platform names in igt_require() v2: Make use of the property enums to get the supported rotations Cc: Radhakrishna Sripada Cc: Daniel Vetter Cc: Rodrigo Vivi Cc: Maarten Lankhorst Cc: Mika Kahola Cc: Manasi Navare Signed-off-by: Anusha Srivatsa Signed-off-by: Radhakrishna Sripada --- lib/igt_kms.h | 1 + tests/kms_rotation_crc.c | 46 +++++++++++++++++++++++++++++++++++++--------- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 1c46186e8a9d..c306aa1f5b8d 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -289,6 +289,7 @@ typedef enum { #define IGT_ROTATION_MASK \ (IGT_ROTATION_0 | IGT_ROTATION_90 | IGT_ROTATION_180 | IGT_ROTATION_270) +#define IGT_REFLECT_MASK (IGT_REFLECT_X | IGT_REFLECT_Y) typedef struct { /*< private >*/ diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index 0cd5c6e52b57..8f7e5d4f2dd2 100644 --- a/tests/kms_rotation_crc.c +++ b/tests/kms_rotation_crc.c @@ -38,6 +38,7 @@ typedef struct { igt_crc_t flip_crc; igt_pipe_crc_t *pipe_crc; igt_rotation_t rotation; + int **supported_rotation; int pos_x; int pos_y; uint32_t override_fmt; @@ -373,13 +374,14 @@ static void test_plane_rotation(data_t *data, int plane_type, bool test_bad_form igt_plane_t *plane; int i, j; - if (IS_CHERRYVIEW(data->devid) && pipe != PIPE_B) - continue; - igt_output_set_pipe(output, pipe); plane = igt_output_get_plane_type(output, plane_type); igt_require(igt_plane_has_prop(plane, IGT_PLANE_ROTATION)); + igt_require(data->supported_rotation[pipe][plane->index] & data->rotation); + + if (data->rotation & IGT_REFLECT_MASK) + igt_require(data->supported_rotation[pipe][plane->index] & IGT_REFLECT_MASK); prepare_crtc(data, output, pipe, plane); @@ -460,6 +462,36 @@ static void test_plane_rotation_exhaust_fences(data_t *data, igt_remove_fb(fd, &fb[i]); } +static void igt_supported_rotation_init(data_t *data) +{ + igt_display_t *display = &data->display; + bool found; + int i, j, k, n_pipes = display->n_pipes; + int **s_rotation; + + s_rotation = calloc(sizeof(int *), n_pipes); + + for (i = 0; i < n_pipes; i++) { + s_rotation[i] = calloc(sizeof(int), (display->pipes + i)->n_planes); + + for (j = 0; j < (display->pipes + i)->n_planes; j++) { + drmModePropertyPtr prop; + found = kmstest_get_property(data->gfx_fd, display->pipes[i].planes[j].drm_plane->plane_id, + DRM_MODE_OBJECT_PLANE, "rotation", NULL, NULL, &prop); + igt_assert(found); + igt_assert(prop->flags & DRM_MODE_PROP_BITMASK); + + for (k = 0; k < prop->count_enums; k++) { + s_rotation[i][j] |= 1 << (prop->enums[k].value); + } + + drmModeFreeProperty(prop); + } + } + + data->supported_rotation = s_rotation; +} + static const char *plane_test_str(unsigned plane) { switch (plane) { @@ -552,15 +584,13 @@ igt_main igt_require_pipe_crc(data.gfx_fd); igt_display_init(&data.display, data.gfx_fd); + igt_supported_rotation_init(&data); } for (subtest = subtests; subtest->rot; subtest++) { igt_subtest_f("%s-rotation-%s", plane_test_str(subtest->plane), rot_test_str(subtest->rot)) { - igt_require(!(subtest->rot & - (IGT_ROTATION_90 | IGT_ROTATION_270)) || - gen >= 9); data.rotation = subtest->rot; test_plane_rotation(&data, subtest->plane, false); } @@ -596,9 +626,7 @@ igt_main igt_subtest_f("primary-%s-reflect-x-%s", tiling_test_str(reflect_x->tiling), rot_test_str(reflect_x->rot)) { - igt_require(gen >= 10 || - (IS_CHERRYVIEW(data.devid) && reflect_x->rot == IGT_ROTATION_0 - && reflect_x->tiling == LOCAL_I915_FORMAT_MOD_X_TILED)); + igt_require(reflect_x->rot == IGT_ROTATION_0 && reflect_x->tiling == LOCAL_I915_FORMAT_MOD_X_TILED); data.rotation = (IGT_REFLECT_X | reflect_x->rot); data.override_tiling = reflect_x->tiling; test_plane_rotation(&data, DRM_PLANE_TYPE_PRIMARY, false);