From patchwork Fri Jan 2 11:03:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: akash.goel@intel.com X-Patchwork-Id: 5558561 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 D729D9F507 for ; Fri, 2 Jan 2015 10:58:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E8B6920166 for ; Fri, 2 Jan 2015 10:58:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0D8BC2017D for ; Fri, 2 Jan 2015 10:58:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9280C6E34B; Fri, 2 Jan 2015 02:58:18 -0800 (PST) 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 F3FAB6E34B for ; Fri, 2 Jan 2015 02:58:17 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 02 Jan 2015 02:58:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,684,1413270000"; d="scan'208";a="663567860" Received: from akashgoe-desktop.iind.intel.com ([10.223.82.76]) by orsmga002.jf.intel.com with ESMTP; 02 Jan 2015 02:58:16 -0800 From: akash.goel@intel.com To: intel-gfx@lists.freedesktop.org Date: Fri, 2 Jan 2015 16:33:31 +0530 Message-Id: <1420196614-13543-4-git-send-email-akash.goel@intel.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1420196614-13543-1-git-send-email-akash.goel@intel.com> References: <1420196614-13543-1-git-send-email-akash.goel@intel.com> MIME-Version: 1.0 Cc: daniel.vetter@ffwll.ch Subject: [Intel-gfx] [PATCH 3/6] igt/gem_gtt_speed: compare against WC mmaps 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: Chris Wilson Signed-off-by: Chris Wilson --- tests/gem_gtt_speed.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/tests/gem_gtt_speed.c b/tests/gem_gtt_speed.c index c68b8e4..d5e745e 100644 --- a/tests/gem_gtt_speed.c +++ b/tests/gem_gtt_speed.c @@ -206,6 +206,27 @@ int main(int argc, char **argv) igt_info("Time to read %dk through a GTT map: %7.3fµs\n", size/1024, elapsed(&start, &end, loop)); + if (gem_mmap__has_wc(fd)) { + gettimeofday(&start, NULL); + for (loop = 0; loop < 1000; loop++) { + uint32_t *base = gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); + volatile uint32_t *ptr = base; + int x = 0; + + for (i = 0; i < size/sizeof(*ptr); i++) + x += ptr[i]; + + /* force overtly clever gcc to actually compute x */ + ptr[0] = x; + + munmap(base, size); + } + gettimeofday(&end, NULL); + igt_info("Time to read %dk through a WC map: %7.3fµs\n", + size/1024, elapsed(&start, &end, loop)); + } + + /* mmap write */ gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { @@ -221,6 +242,23 @@ int main(int argc, char **argv) igt_info("Time to write %dk through a GTT map: %7.3fµs\n", size/1024, elapsed(&start, &end, loop)); + if (gem_mmap__has_wc(fd)) { + /* mmap write */ + gettimeofday(&start, NULL); + for (loop = 0; loop < 1000; loop++) { + uint32_t *base = gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); + volatile uint32_t *ptr = base; + + for (i = 0; i < size/sizeof(*ptr); i++) + ptr[i] = i; + + munmap(base, size); + } + gettimeofday(&end, NULL); + igt_info("Time to write %dk through a WC map: %7.3fµs\n", + size/1024, elapsed(&start, &end, loop)); + } + /* mmap clear */ gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { @@ -232,6 +270,19 @@ int main(int argc, char **argv) igt_info("Time to clear %dk through a GTT map: %7.3fµs\n", size/1024, elapsed(&start, &end, loop)); + if (gem_mmap__has_wc(fd)) { + /* mmap clear */ + gettimeofday(&start, NULL); + for (loop = 0; loop < 1000; loop++) { + uint32_t *base = gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); + memset(base, 0, size); + munmap(base, size); + } + gettimeofday(&end, NULL); + igt_info("Time to clear %dk through a WC map: %7.3fµs\n", + size/1024, elapsed(&start, &end, loop)); + } + gettimeofday(&start, NULL);{ uint32_t *base = gem_mmap(fd, handle, size, PROT_READ | PROT_WRITE); for (loop = 0; loop < 1000; loop++) @@ -241,6 +292,17 @@ int main(int argc, char **argv) igt_info("Time to clear %dk through a cached GTT map: %7.3fµs\n", size/1024, elapsed(&start, &end, loop)); + if (gem_mmap__has_wc(fd)) { + gettimeofday(&start, NULL);{ + uint32_t *base = gem_mmap__wc(fd, handle, 0, size, PROT_READ | PROT_WRITE); + for (loop = 0; loop < 1000; loop++) + memset(base, 0, size); + munmap(base, size); + } gettimeofday(&end, NULL); + igt_info("Time to clear %dk through a cached WC map: %7.3fµs\n", + size/1024, elapsed(&start, &end, loop)); + } + /* mmap read */ gettimeofday(&start, NULL); for (loop = 0; loop < 1000; loop++) { @@ -323,7 +385,6 @@ int main(int argc, char **argv) size *= 4; } - } gem_close(fd, handle);