From patchwork Fri Oct 30 01:44:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kasireddy, Vivek" X-Patchwork-Id: 7523131 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 3D8249F399 for ; Fri, 30 Oct 2015 01:48:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 21E3D20842 for ; Fri, 30 Oct 2015 01:48:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D5E282083B for ; Fri, 30 Oct 2015 01:48:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A3BC6E0D3; Thu, 29 Oct 2015 18:48:25 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTP id 74E176E0D3 for ; Thu, 29 Oct 2015 18:48:14 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP; 29 Oct 2015 18:48:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,217,1444719600"; d="scan'208";a="838480781" Received: from orsmsx105.amr.corp.intel.com ([10.22.225.132]) by orsmga002.jf.intel.com with ESMTP; 29 Oct 2015 18:48:14 -0700 Received: from vkasired-desk2.fm.intel.com (10.22.254.140) by ORSMSX105.amr.corp.intel.com (10.22.225.132) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 29 Oct 2015 18:48:12 -0700 From: Vivek Kasireddy To: Date: Thu, 29 Oct 2015 18:44:33 -0700 Message-ID: <1446169473-20563-1-git-send-email-vivek.kasireddy@intel.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <5631F5E2.7000309@linux.intel.com> References: <5631F5E2.7000309@linux.intel.com> MIME-Version: 1.0 X-Originating-IP: [10.22.254.140] Cc: Vivek Kasireddy Subject: [Intel-gfx] [PATCH] igt/kms_rotation_crc: Add a subtest to validate Y-tiled obj + Y fb modifier (v5) 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 The main goal of this subtest is to trigger the following warning in the function i915_gem_object_get_fence(): if (WARN_ON(!obj->map_and_fenceable)) To trigger this warning, the subtest first creates a Y-tiled object and an associated framebuffer with the Y-fb modifier. Furthermore, to prevent the map_and_fenceable from being set, we make sure that the object does not have a normal VMA by refraining from rendering to the object and by setting the rotation property upfront before calling commit. v2: Do not call paint_squares and just use one output. v3: Convert an if condition to igt_require and move the plane rotation requirement further up before the fb allocation. v4: After setting rotation to 90 and committing, change the rotation to 0 and commit once more. This is to test if the i915 driver hits any warnings while pinning and unpinning an object that has both normal and rotated views. v5: - Add another subtest to toggle the order of rotation - Exhaustively test the i915 driver's pinning and unpinning code paths for any fence leaks by iterating until MAX available fences. Cc: Tvrtko Ursulin Signed-off-by: Vivek Kasireddy --- tests/kms_rotation_crc.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index cc9847e..34f8150 100644 --- a/tests/kms_rotation_crc.c +++ b/tests/kms_rotation_crc.c @@ -264,6 +264,80 @@ static void test_plane_rotation(data_t *data, enum igt_plane plane_type) igt_require_f(valid_tests, "no valid crtc/connector combinations found\n"); } +static void test_plane_rotation_ytiled_obj(data_t *data, enum igt_plane plane_type, + int toggle) +{ + igt_display_t *display = &data->display; + uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED; + uint32_t format = DRM_FORMAT_XRGB8888; + int bpp = igt_drm_format_to_bpp(format); + enum igt_commit_style commit = COMMIT_LEGACY; + int fd = data->gfx_fd; + igt_output_t *output = &display->outputs[0]; + igt_plane_t *plane; + drmModeModeInfo *mode; + unsigned int stride, size, w, h; + uint32_t gem_handle; + int num_fences = gem_available_fences(fd); + int i, ret; + + igt_require(output != NULL && output->valid == true); + + plane = igt_output_get_plane(output, plane_type); + igt_require(igt_plane_supports_rotation(plane)); + + if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) { + igt_require(data->display.has_universal_planes); + commit = COMMIT_UNIVERSAL; + } + + mode = igt_output_get_mode(output); + w = mode->hdisplay; + h = mode->vdisplay; + + for (stride = 512; stride < (w * bpp / 8); stride *= 2) + ; + for (size = 1024*1024; size < stride * h; size *= 2) + ; + + gem_handle = gem_create(fd, size); + ret = __gem_set_tiling(fd, gem_handle, I915_TILING_Y, stride); + igt_assert(ret == 0); + + do_or_die(__kms_addfb(fd, gem_handle, w, h, stride, + format, tiling, LOCAL_DRM_MODE_FB_MODIFIERS, + &data->fb.fb_id)); + data->fb.width = w; + data->fb.height = h; + data->fb.gem_handle = gem_handle; + + igt_plane_set_fb(plane, NULL); + igt_display_commit(display); + + igt_plane_set_fb(plane, &data->fb); + + for (i = 0; i < num_fences + 1; i++) { + igt_plane_set_rotation(plane, toggle ? IGT_ROTATION_0 : IGT_ROTATION_90); + drmModeObjectSetProperty(fd, plane->drm_plane->plane_id, + DRM_MODE_OBJECT_PLANE, + plane->rotation_property, + plane->rotation); + ret = igt_display_try_commit2(display, commit); + igt_assert(ret == 0); + + igt_plane_set_rotation(plane, toggle ? IGT_ROTATION_90 : IGT_ROTATION_0); + drmModeObjectSetProperty(fd, plane->drm_plane->plane_id, + DRM_MODE_OBJECT_PLANE, + plane->rotation_property, + plane->rotation); + ret = igt_display_try_commit2(display, commit); + igt_assert(ret == 0); + } + + kmstest_restore_vt_mode(); + igt_remove_fb(fd, &data->fb); +} + igt_main { data_t data = {}; @@ -345,6 +419,16 @@ igt_main test_plane_rotation(&data, IGT_PLANE_PRIMARY); } + igt_subtest_f("primary-rotation-90-to-0-Y-tiled") { + igt_require(gen >= 9); + test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY, 0); + } + + igt_subtest_f("primary-rotation-0-to-90-Y-tiled") { + igt_require(gen >= 9); + test_plane_rotation_ytiled_obj(&data, IGT_PLANE_PRIMARY, 1); + } + igt_fixture { igt_display_fini(&data.display); }