From patchwork Fri Sep 29 15:26:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9978287 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 DC26760329 for ; Fri, 29 Sep 2017 15:27:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDBCC29879 for ; Fri, 29 Sep 2017 15:27:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C28F62987F; Fri, 29 Sep 2017 15:27:12 +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=-4.2 required=2.0 tests=BAYES_00, 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 40D1A29879 for ; Fri, 29 Sep 2017 15:27:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0036D6EBC5; Fri, 29 Sep 2017 15:27:12 +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 CDA446EBC7 for ; Fri, 29 Sep 2017 15:27:05 +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 8936554-1500050 for multiple; Fri, 29 Sep 2017 16:27:00 +0100 Received: by haswell.alporthouse.com (sSMTP sendmail emulation); Fri, 29 Sep 2017 16:27:00 +0100 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 29 Sep 2017 16:26:42 +0100 Message-Id: <20170929152642.24764-7-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20170929152642.24764-1-chris@chris-wilson.co.uk> References: <20170929152642.24764-1-chris@chris-wilson.co.uk> X-Originating-IP: 78.156.65.138 X-Country: code=GB country="United Kingdom" ip=78.156.65.138 Subject: [Intel-gfx] [PATCH igt 7/7] lib: Ask the kernel to quiescent the GPU 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: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Since the introduction of debugfs/i915_drop_caches, we have offered the ability to wait upon all outstanding batches. This is more efficient and less error prone (one example is the use of context priorities, we have to idle at the lowest in order not to jump over any low priority tasks we want to wait upon) than trying to do it all in userspace. Though we could if we wanted to, it's just easier to use the existing facility designed for the purpose -- that we were already partially using! Signed-off-by: Chris Wilson Reviewed-by: Joonas Lahtinen --- lib/drmtest.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index 8a07152c..4ae023d7 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -159,35 +159,9 @@ static bool has_known_intel_chipset(int fd) */ void gem_quiescent_gpu(int fd) { - uint32_t bbe = MI_BATCH_BUFFER_END; - struct drm_i915_gem_execbuffer2 execbuf; - struct drm_i915_gem_exec_object2 obj; - unsigned ring; - igt_terminate_spin_batches(); - memset(&obj, 0, sizeof(obj)); - obj.handle = gem_create(fd, 4096); - gem_write(fd, obj.handle, 0, &bbe, sizeof(&bbe)); - - memset(&execbuf, 0, sizeof(execbuf)); - execbuf.buffers_ptr = to_user_pointer(&obj); - execbuf.buffer_count = 1; - - for (ring = 0; ring < 1<<6; ring++) { - execbuf.flags = ring; - __gem_execbuf(fd, &execbuf); - } - - if (gem_has_bsd2(fd)) { - execbuf.flags = I915_EXEC_BSD | (2 << 13); - __gem_execbuf(fd, &execbuf); - } - - gem_sync(fd, obj.handle); - gem_close(fd, obj.handle); - - igt_drop_caches_set(fd, DROP_RETIRE | DROP_FREED); + igt_drop_caches_set(fd, DROP_ACTIVE | DROP_RETIRE | DROP_FREED); } /**