From patchwork Fri Oct 16 01:10:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kasireddy, Vivek" X-Patchwork-Id: 7410371 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 26E02BEEA4 for ; Fri, 16 Oct 2015 01:14:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1077E2086C for ; Fri, 16 Oct 2015 01:14:49 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CEA45206E2 for ; Fri, 16 Oct 2015 01:14:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9CA36ECC0; Thu, 15 Oct 2015 18:14:45 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 7CD246ECC0 for ; Thu, 15 Oct 2015 18:14:44 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 15 Oct 2015 18:14:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,687,1437462000"; d="scan'208";a="581798889" Received: from orsmsx110.amr.corp.intel.com ([10.22.240.8]) by FMSMGA003.fm.intel.com with ESMTP; 15 Oct 2015 18:14:43 -0700 Received: from vkasired-desk2.amr.corp.intel.com (10.22.254.139) by ORSMSX110.amr.corp.intel.com (10.22.240.8) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 15 Oct 2015 18:14:42 -0700 Date: Thu, 15 Oct 2015 18:10:46 -0700 From: Vivek Kasireddy To: Tvrtko Ursulin Message-ID: <20151015181046.719adb12@vkasired-desk2.amr.corp.intel.com> In-Reply-To: <56177C11.9080509@linux.intel.com> References: <1444185331-25751-1-git-send-email-vivek.kasireddy@intel.com> <56152722.60208@linux.intel.com> <20151007140720.01abdff1@vkasired-desk2.amr.corp.intel.com> <56162F8B.5010504@linux.intel.com> <56177C11.9080509@linux.intel.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-Originating-IP: [10.22.254.139] Cc: intel-gfx@lists.freedesktop.org Subject: Re: [Intel-gfx] [PATCH] igt/kms_addfb_basic: New subtest to check for fb modifier and tiling mode mismatch 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, 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 Hi Tvrtko, On Fri, 9 Oct 2015 09:34:25 +0100 Tvrtko Ursulin wrote: > > > On 08/10/15 09:55, Tvrtko Ursulin wrote: > > On 07/10/15 22:07, Vivek Kasireddy wrote: > >> > >> Hi Tvrtko, > >> > >> On Wed, 7 Oct 2015 15:07:30 +0100 > >> Tvrtko Ursulin wrote: > >> > >>> > >>> Hi, > >>> > >>> On 07/10/15 03:35, Vivek Kasireddy wrote: > >>>> This new subtest will validate a Y-tiled object's tiling mode > >>>> against its associated fb modifier. > >>>> > >>>> Cc: Tvrtko Ursulin > >>>> Signed-off-by: Vivek Kasireddy > >>>> --- > >>>> tests/kms_addfb_basic.c | 9 +++++++++ > >>>> 1 file changed, 9 insertions(+) > >>>> > >>>> diff --git a/tests/kms_addfb_basic.c b/tests/kms_addfb_basic.c > >>>> index d466e4d..7ca1add 100644 > >>>> --- a/tests/kms_addfb_basic.c > >>>> +++ b/tests/kms_addfb_basic.c > >>>> @@ -373,6 +373,15 @@ static void addfb25_ytile(int fd, int gen) > >>>> f.handles[0] = gem_bo; > >>>> } > >>>> > >>>> + igt_subtest("addfb25-Y-tiled-X-modifier-mismatch") { > >>>> + igt_require(gen >= 9); > >>>> + igt_require_fb_modifiers(fd); > >>>> + gem_set_tiling(fd, gem_bo, I915_TILING_Y, 1024*4); > >>>> + > >>>> + f.modifier[0] = LOCAL_I915_FORMAT_MOD_X_TILED; > >>>> + igt_assert(drmIoctl(fd, > >>>> LOCAL_DRM_IOCTL_MODE_ADDFB2, &f) < 0 && errno == EINVAL); > >>>> + } > >>>> + > >>>> igt_subtest("addfb25-Y-tiled") { > >>>> igt_require_fb_modifiers(fd); > >>>> > >>> > >>> Wasn't the original WARN triggered by Y tiled object and Y fb > >>> modifier? > >> > >> Creating a new fb using a Y-tiled object and Y/X fb modifier will > >> not trigger the original WARN. It'll be triggered only if the fb > >> is going to be pinned -- and flipped. I am not sure how to get > >> that WARN to be triggered with the existing suite of igt tests. > > > > Ah yes, you would need to attempt display it, not even necessarily > > flip it. I am sure there are tests which do that. :) I know from > > recent activity kms_rotation_crc for example creates a Y tiled FB > > and displays it. So maybe borrow some code to start with from there. > > Even better, kms_flip_tiling does the majority of what is needed here > already. Just drop in a subtest which will do set_tiling and that > should be good. I have realized that I cannot get the the map_and_fenceable WARN to be triggered with any of the IGT tests. This is because the WARN is triggered only when pinning/fencing a Y-tiled fb that has a rotated view (90/270 degree rotation) that none of the IGT tests can do. I looked at and wrote a subtest in kms_rotation_crc but the WARN was not triggered because IGT does not support atomic flip/commit yet. Currently, since it does a SetPlane first, the object has a normal view and its map_and-fenceable bit is set, however, when the rotation property is applied, the object though has a rotated view, its map_and-fenceable bit never gets updated and stays 1 and hence the warning doesn't get triggered. I am copying the subtest code below for reference. From 5d7f6920663b2fd264aca6085170811276948a5b Mon Sep 17 00:00:00 2001 From: Vivek Kasireddy Date: Thu, 15 Oct 2015 17:48:50 -0700 Subject: [PATCH] igt/kms_rotation_crc: Add a new subtest to flip Y-tiled rotated fb --- tests/kms_rotation_crc.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/tests/kms_rotation_crc.c b/tests/kms_rotation_crc.c index cc9847e..f10a770 100644 --- a/tests/kms_rotation_crc.c +++ b/tests/kms_rotation_crc.c @@ -264,6 +264,70 @@ 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(data_t *data, enum igt_plane plane_type) +{ + igt_display_t *display = &data->display; + igt_output_t *output; + enum igt_commit_style commit = COMMIT_LEGACY; + drmModeModeInfo *mode; + unsigned int w, h; + igt_plane_t *plane; + int ret; + uint64_t tiling = LOCAL_I915_FORMAT_MOD_Y_TILED; + uint32_t format = DRM_FORMAT_XRGB8888; + int bpp = igt_drm_format_to_bpp(format); + + if (plane_type == IGT_PLANE_PRIMARY || plane_type == IGT_PLANE_CURSOR) { + igt_require(data->display.has_universal_planes); + commit = COMMIT_UNIVERSAL; + } + + for_each_connected_output(display, output) { + mode = igt_output_get_mode(output); + + w = mode->hdisplay; + h = mode->vdisplay; + + for (data->fb.stride = 512; data->fb.stride < (w * bpp / 8); data->fb.stride *= 2); + + for (data->fb.size = 1024*1024; data->fb.size < data->fb.stride * h; data->fb.size *= 2); + + data->fb.gem_handle = gem_create(data->gfx_fd, data->fb.size); + ret = __gem_set_tiling(data->gfx_fd, data->fb.gem_handle, I915_TILING_Y, data->fb.stride); + igt_assert(ret == 0); + + do_or_die(__kms_addfb(data->gfx_fd, data->fb.gem_handle, w, h, + data->fb.stride, format, tiling, + LOCAL_DRM_MODE_FB_MODIFIERS, &data->fb.fb_id)); + + data->fb.width = w; + data->fb.height = h; + data->fb.tiling = tiling; + data->fb.drm_format = format; + + plane = igt_output_get_plane(output, plane_type); + igt_require(igt_plane_supports_rotation(plane)); + + igt_plane_set_rotation(plane, data->rotation); + paint_squares(data, mode, IGT_ROTATION_0, plane); + igt_plane_set_fb(plane, &data->fb); + + drmModeObjectSetProperty(data->gfx_fd, plane->drm_plane->plane_id, + DRM_MODE_OBJECT_PLANE, plane->rotation_property, plane->rotation); + igt_display_commit2(display, commit); + + kmstest_restore_vt_mode(); + kmstest_set_vt_graphics_mode(); + commit_crtc(data, output, plane); + + igt_remove_fb(data->gfx_fd, &data->fb); + igt_plane_set_fb(plane, NULL); + igt_output_set_pipe(output, PIPE_ANY); + + igt_display_commit(display); + } +} + igt_main { data_t data = {}; @@ -345,6 +409,12 @@ igt_main test_plane_rotation(&data, IGT_PLANE_PRIMARY); } + igt_subtest_f("primary-rotation-90-Y-tiled") { + igt_require(gen >= 9); + data.rotation = IGT_ROTATION_90; + test_plane_rotation_ytiled(&data, IGT_PLANE_PRIMARY); + } + igt_fixture { igt_display_fini(&data.display); }