From patchwork Sun Dec 16 17:51:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 1885421 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 26E98DFAC4 for ; Sun, 16 Dec 2012 17:55:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 100CBE63D5 for ; Sun, 16 Dec 2012 09:55:41 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (server109-228-6-235.live-servers.net [109.228.6.235]) by gabe.freedesktop.org (Postfix) with ESMTP id 336B7E63EB for ; Sun, 16 Dec 2012 09:54:50 -0800 (PST) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.73.22; Received: from arrandale.alporthouse.com (unverified [78.156.73.22]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 126229240-1500050 for multiple; Sun, 16 Dec 2012 17:54:43 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Sun, 16 Dec 2012 17:51:55 +0000 Message-Id: <1355680315-25793-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.7.10.4 X-Originating-IP: 78.156.73.22 Subject: [Intel-gfx] [PATCH] drm/i915: Do an initial lockless wait for render completion before pread/pwrite X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Before performing the domain transition for pread/pwrite, and so a locked completion if still required, wait for any pending rendering locklessly. This should reduce contention when reading back results from the GPU, for example. Signed-off-by: Chris Wilson --- drivers/gpu/drm/i915/i915_gem.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index a831641..447ad9d 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -599,6 +599,10 @@ i915_gem_pread_ioctl(struct drm_device *dev, void *data, trace_i915_gem_object_pread(obj, args->offset, args->size); + ret = i915_gem_object_wait_rendering__nonblocking(obj, true); + if (ret) + goto out; + ret = i915_gem_shmem_pread(dev, obj, args, file); out: @@ -1001,6 +1005,10 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data, goto out; } + ret = i915_gem_object_wait_rendering__nonblocking(obj, false); + if (ret) + goto out; + if (obj->cache_level == I915_CACHE_NONE && obj->tiling_mode == I915_TILING_NONE && obj->base.write_domain != I915_GEM_DOMAIN_CPU) {