From patchwork Fri Apr 24 07:38:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonas Lahtinen X-Patchwork-Id: 6266701 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 ED0159F1BE for ; Fri, 24 Apr 2015 07:39:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2CB1220265 for ; Fri, 24 Apr 2015 07:39:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EA1DF20253 for ; Fri, 24 Apr 2015 07:39:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5CD0C6E264; Fri, 24 Apr 2015 00:39:01 -0700 (PDT) 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 A34D36E264 for ; Fri, 24 Apr 2015 00:39:00 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 24 Apr 2015 00:39:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,638,1422950400"; d="scan'208";a="718553585" Received: from jmangan-mobl1.ger.corp.intel.com (HELO [10.252.3.244]) ([10.252.3.244]) by orsmga002.jf.intel.com with ESMTP; 24 Apr 2015 00:38:59 -0700 Message-ID: <1429861138.4424.0.camel@jlahtine-mobl1> From: Joonas Lahtinen To: intel-gfx Date: Fri, 24 Apr 2015 10:38:58 +0300 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) Mime-Version: 1.0 Cc: Thomas Wood Subject: [Intel-gfx] [PATCH i-g-t] tests/gem_mmap_gtt: Use PAGE_SIZE instead of hard coded value 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 Now that there is PAGE_SIZE define, use it. Signed-off-by: Joonas Lahtinen --- tests/gem_mmap_gtt.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c index e80f52e..92fa644 100644 --- a/tests/gem_mmap_gtt.c +++ b/tests/gem_mmap_gtt.c @@ -148,24 +148,25 @@ test_short(int fd) igt_assert(drmIoctl(fd, DRM_IOCTL_I915_GEM_MMAP_GTT, &mmap_arg) == 0); - for (pages = 1; pages <= OBJECT_SIZE / 4096; pages <<= 1) { + for (pages = 1; pages <= OBJECT_SIZE / PAGE_SIZE; pages <<= 1) { uint8_t *r, *w; - w = mmap64(0, pages * 4096, PROT_READ | PROT_WRITE, + w = mmap64(0, pages * PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, mmap_arg.offset); igt_assert(w != MAP_FAILED); - r = mmap64(0, pages * 4096, PROT_READ, + r = mmap64(0, pages * PAGE_SIZE, PROT_READ, MAP_SHARED, fd, mmap_arg.offset); igt_assert(r != MAP_FAILED); for (p = 0; p < pages; p++) { - w[4096*p] = r[4096*p]; - w[4096*p+4095] = r[4096*p+4095]; + w[p*PAGE_SIZE] = r[p*PAGE_SIZE]; + w[p*PAGE_SIZE+(PAGE_SIZE-1)] = + r[p*PAGE_SIZE+(PAGE_SIZE-1)]; } - munmap(r, pages * 4096); - munmap(w, pages * 4096); + munmap(r, pages * PAGE_SIZE); + munmap(w, pages * PAGE_SIZE); } gem_close(fd, mmap_arg.handle); }