From patchwork Mon Dec 14 20:15:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 7847971 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 EFF7C9F387 for ; Mon, 14 Dec 2015 20:16:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1787D20361 for ; Mon, 14 Dec 2015 20:16:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 35942202E6 for ; Mon, 14 Dec 2015 20:16:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C6E6D6E11B; Mon, 14 Dec 2015 12:16:05 -0800 (PST) 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 3E2826E11B for ; Mon, 14 Dec 2015 12:16:04 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP; 14 Dec 2015 12:16:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,428,1444719600"; d="scan'208";a="860604975" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by fmsmga001.fm.intel.com with SMTP; 14 Dec 2015 12:16:00 -0800 Received: by stinkbox (sSMTP sendmail emulation); Mon, 14 Dec 2015 22:15:58 +0200 From: ville.syrjala@linux.intel.com To: intel-gfx@lists.freedesktop.org Date: Mon, 14 Dec 2015 22:15:51 +0200 Message-Id: <1450124156-12679-2-git-send-email-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.4.10 In-Reply-To: <1450124156-12679-1-git-send-email-ville.syrjala@linux.intel.com> References: <1450124156-12679-1-git-send-email-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 2/7] tests/gem_mmap_gtt: Deal with tile sizes on gen2/3 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 From: Ville Syrjälä Gen2/3 platforms have some unusual tile dimensions. Account for them to make the test work correctly. Signed-off-by: Ville Syrjälä --- tests/gem_mmap_gtt.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c index 4d146426535b..b9c413b6160b 100644 --- a/tests/gem_mmap_gtt.c +++ b/tests/gem_mmap_gtt.c @@ -253,6 +253,18 @@ test_write_gtt(int fd) munmap(src, OBJECT_SIZE); } +static int tile_width(uint32_t devid, int tiling) +{ + if (intel_gen(devid) == 2) + return 128; + else if (tiling == I915_TILING_X) + return 512; + else if (IS_915(devid)) + return 512; + else + return 128; +} + static void test_huge_bo(int fd, int huge, int tiling) { @@ -261,7 +273,8 @@ test_huge_bo(int fd, int huge, int tiling) char *tiled_pattern; char *linear_pattern; uint64_t size, last_offset; - int pitch = tiling == I915_TILING_Y ? 128 : 512; + uint32_t devid = intel_get_drm_devid(fd); + int pitch = tile_width(devid, tiling); int i; switch (huge) { @@ -327,6 +340,7 @@ test_huge_bo(int fd, int huge, int tiling) static void test_huge_copy(int fd, int huge, int tiling_a, int tiling_b) { + uint32_t devid = intel_get_drm_devid(fd); uint64_t huge_object_size, i; uint32_t bo, *pattern_a, *pattern_b; char *a, *b; @@ -357,7 +371,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b) bo = gem_create(fd, huge_object_size); if (tiling_a) - igt_require(__gem_set_tiling(fd, bo, tiling_a, tiling_a == I915_TILING_Y ? 128 : 512) == 0); + igt_require(__gem_set_tiling(fd, bo, tiling_a, tile_width(devid, tiling_a)) == 0); a = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE); igt_require(a); gem_close(fd, bo); @@ -367,7 +381,7 @@ test_huge_copy(int fd, int huge, int tiling_a, int tiling_b) bo = gem_create(fd, huge_object_size); if (tiling_b) - igt_require(__gem_set_tiling(fd, bo, tiling_b, tiling_b == I915_TILING_Y ? 128 : 512) == 0); + igt_require(__gem_set_tiling(fd, bo, tiling_b, tile_width(devid, tiling_b)) == 0); b = __gem_mmap__gtt(fd, bo, huge_object_size, PROT_READ | PROT_WRITE); igt_require(b); gem_close(fd, bo);