From patchwork Fri Jul 20 08:07:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10536189 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1475C6029B for ; Fri, 20 Jul 2018 08:08:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06DB729688 for ; Fri, 20 Jul 2018 08:08:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEAD1296A9; Fri, 20 Jul 2018 08:08:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A8932296AA for ; Fri, 20 Jul 2018 08:08:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 28BE26EEC5; Fri, 20 Jul 2018 08:08:32 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C1CF6EE65; Fri, 20 Jul 2018 08:08:30 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from haswell.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 12408743-1500050 for multiple; Fri, 20 Jul 2018 09:07:53 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 20 Jul 2018 09:07:55 +0100 Message-Id: <20180720080755.20579-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.18.0 Subject: [Intel-gfx] [PATCH i-g-t] igt/gem_mmap_gtt: Check for known incoherency before testing X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: igt-dev@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP We test map_gtt coherency (whether or not a write via the mmap_gtt is immediately visible in the backing storage to a read via mmap_cpu) but we know that several platforms are inherently incorrect and require some form of hammer to workaround internal delays. These platforms break our ABI guarantees and so we report the change in ABI via a driver getparam. If we know the platform doesn't meet the ABI guarantee, skip the test. If it is meant to work, test! Signed-off-by: Chris Wilson Cc: Joonas Lahtinen Reviewed-by: Tvrtko Ursulin --- tests/gem_mmap_gtt.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/gem_mmap_gtt.c b/tests/gem_mmap_gtt.c index c8a0bedec..f63535556 100644 --- a/tests/gem_mmap_gtt.c +++ b/tests/gem_mmap_gtt.c @@ -309,6 +309,18 @@ test_write_gtt(int fd) munmap(src, OBJECT_SIZE); } +static bool is_coherent(int i915) +{ + int val = 1; /* by default, we assume GTT is coherent, hence the test */ + struct drm_i915_getparam gp = { + gp.param = 52, /* GTT_COHERENT */ + gp.value = &val, + }; + + ioctl(i915, DRM_IOCTL_I915_GETPARAM, &gp); + return val; +} + static void test_coherency(int fd) { @@ -316,6 +328,7 @@ test_coherency(int fd) uint32_t *gtt, *cpu; int i; + igt_require(is_coherent(fd)); igt_require(igt_setup_clflush()); handle = gem_create(fd, OBJECT_SIZE);