From patchwork Thu Nov 22 16:40:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 10694481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B72BB13BB for ; Thu, 22 Nov 2018 16:41:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A39212CD49 for ; Thu, 22 Nov 2018 16:41:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9835D2CD4A; Thu, 22 Nov 2018 16:41:15 +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 4E8CD2CD4B for ; Thu, 22 Nov 2018 16:41:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F319C6E337; Thu, 22 Nov 2018 16:41: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 9FF3A6E47B for ; Thu, 22 Nov 2018 16:41:11 +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 14601065-1500050 for multiple; Thu, 22 Nov 2018 16:41:04 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 22 Nov 2018 16:40:59 +0000 Message-Id: <20181122164101.28788-1-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/3] drm/i915/selftests: Flush the test object on creation 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Move the flush from before emitting the gpu_fill request to the object's creation to avoid forcing a stall on each write. The only stall should now be after all the writes have been queued and we want to read the results. Signed-off-by: Chris Wilson --- .../gpu/drm/i915/selftests/i915_gem_context.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_context.c b/drivers/gpu/drm/i915/selftests/i915_gem_context.c index 7d82043aff10..625762de7743 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_context.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_context.c @@ -347,15 +347,12 @@ static int gpu_fill(struct drm_i915_gem_object *obj, if (IS_ERR(vma)) return PTR_ERR(vma); - err = i915_gem_object_set_to_gtt_domain(obj, false); - if (err) - return err; - err = i915_vma_pin(vma, 0, 0, PIN_HIGH | PIN_USER); if (err) return err; - /* Within the GTT the huge objects maps every page onto + /* + * Within the GTT the huge objects maps every page onto * its 1024 real pages (using phys_pfn = dma_pfn % 1024). * We set the nth dword within the page using the nth * mapping via the GTT - this should exercise the GTT mapping @@ -396,14 +393,15 @@ static int gpu_fill(struct drm_i915_gem_object *obj, if (err) goto skip_request; + i915_gem_chipset_flush(vm->i915); + i915_request_add(rq); + i915_gem_object_set_active_reference(batch->obj); i915_vma_unpin(batch); i915_vma_close(batch); i915_vma_unpin(vma); - i915_request_add(rq); - return 0; skip_request: @@ -531,11 +529,14 @@ create_test_object(struct i915_gem_context *ctx, err = cpu_fill(obj, STACK_MAGIC); if (err) { - pr_err("Failed to fill object with cpu, err=%d\n", - err); + pr_err("Failed to fill object with cpu, err=%d\n", err); return ERR_PTR(err); } + err = i915_gem_object_set_to_gtt_domain(obj, false); + if (err) + return ERR_PTR(err); + list_add_tail(&obj->st_link, objects); return obj; } @@ -843,11 +844,11 @@ static int write_to_scratch(struct i915_gem_context *ctx, goto skip_request; i915_gem_object_set_active_reference(obj); + i915_request_add(rq); + i915_vma_unpin(vma); i915_vma_close(vma); - i915_request_add(rq); - return 0; skip_request: