From patchwork Wed Apr 12 12:48:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9677463 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 59E4760384 for ; Wed, 12 Apr 2017 12:48:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4AC1D285FE for ; Wed, 12 Apr 2017 12:48:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F5FC2866A; Wed, 12 Apr 2017 12:48:33 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 F36232863A for ; Wed, 12 Apr 2017 12:48:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 310796E6E7; Wed, 12 Apr 2017 12:48:32 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8BC3C6E6E6 for ; Wed, 12 Apr 2017 12:48:30 +0000 (UTC) Received: by mail-wr0-x242.google.com with SMTP id l28so4052286wre.0 for ; Wed, 12 Apr 2017 05:48:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=vZC6st7mWZZN8/sqakpWJQ0D6FIXh/HVXnHmAvQUrI0=; b=bT8ruQcAE+6CLDJOFk6pMM5Q0bk9gqK7pG/QRmKy52YAtg8eovaKOYCIQB4mFo7Wx3 tx1y05hi+cRtOhMqgF3r+Ua5hDLBT1EhN2dM8Mx+Mxt2WGBfU7viNRAms8qYDHCEi5jx Z2d1wEjaHu2iN40vbhKoqgj5R8eIZyt2TyAFVFE4dWRMwdONvfTJ62yPYF3GaoKUGsAu fOW0al+sNMfokatYl+Ug0UBpRc1mA+h78ARGjof547sBr7U1NU88DM82azcXIT4EulHu J9rCQwQLyyeCfRpu+mfv1miIQTJvuKll6kwjcQ2TQup9Hc++zf4guR5gIa9tB+gI6mJH zN6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=vZC6st7mWZZN8/sqakpWJQ0D6FIXh/HVXnHmAvQUrI0=; b=hOcKBN55c5YiwgN2HleXVRpYAqcbkTqTrRmFv43vm5iL2wdLzj3ix5cq3MpbaUwXrB X0/sgllYp1+rwZlWKuVO0tWPVwN+2gLSuzMXz3amYRQfUjfmrG0FjCl7NEt1wVJTOQba iPLxUVR1tKyLO4jQIPTPYf79r5fYxujNK0YH2/YkenPuHcDSM4qL6Qc1OLGoen5Yvhih mwoOu5hlmhyZ69mEdLY6eRympemOeaWc19moPMlkfcIfhfaEHS+9n/IwTIy/QDIMXEfu iwruOgUfFc5HaR7FOmOIb/iNBIOpNW5I55Jb5t8LRWDue9haq+GOnmRSQ0YiAsBa5fVn jIsw== X-Gm-Message-State: AN3rC/619JvjkqI1SFRFOSN+hvFKyB0EbJfRy5AYiirTjB2Xezi4Y13xAWw0iZh6ZIetwg== X-Received: by 10.223.130.150 with SMTP id 22mr2902662wrc.89.1492001309233; Wed, 12 Apr 2017 05:48:29 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id a10sm25621345wra.17.2017.04.12.05.48.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Apr 2017 05:48:28 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Wed, 12 Apr 2017 13:48:18 +0100 Message-Id: <20170412124825.21741-2-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170412124825.21741-1-chris@chris-wilson.co.uk> References: <20170412124825.21741-1-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [PATCH v2 2/9] drm/i915: Lift timeline ordering to await_dma_fence 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 Currently we filter out repeated use of the same timeline in the low level i915_gem_request_await_request(), after having added the dependency on the old request. However, we can lift this to i915_gem_request_await_dma_fence() (before the dependency is added) using the observation that requests along the same timeline are explicitly ordered via i915_add_request (along with the dependencies). Signed-off-by: Chris Wilson Cc: Joonas Lahtinen Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_gem_request.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_request.c b/drivers/gpu/drm/i915/i915_gem_request.c index 313cdff7c6dd..31874a38752e 100644 --- a/drivers/gpu/drm/i915/i915_gem_request.c +++ b/drivers/gpu/drm/i915/i915_gem_request.c @@ -663,6 +663,7 @@ i915_gem_request_await_request(struct drm_i915_gem_request *to, int ret; GEM_BUG_ON(to == from); + GEM_BUG_ON(to->timeline == from->timeline); if (to->engine->schedule) { ret = i915_priotree_add_dependency(to->i915, @@ -672,9 +673,6 @@ i915_gem_request_await_request(struct drm_i915_gem_request *to, return ret; } - if (to->timeline == from->timeline) - return 0; - if (to->engine == from->engine) { ret = i915_sw_fence_await_sw_fence_gfp(&to->submit, &from->submit, @@ -723,6 +721,13 @@ i915_gem_request_await_dma_fence(struct drm_i915_gem_request *req, if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) return 0; + /* Requests on the same timeline are explicitly ordered, along with + * their dependencies, by i915_add_request() which ensures that requests + * are submitted in-order through each ring. + */ + if (fence->context == req->fence.context) + return 0; + if (dma_fence_is_i915(fence)) return i915_gem_request_await_request(req, to_request(fence));