From patchwork Mon Nov 23 11:39:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Harrison X-Patchwork-Id: 7680131 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D8209BF90C for ; Mon, 23 Nov 2015 11:40:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0A367206F9 for ; Mon, 23 Nov 2015 11:40:16 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 00204206D6 for ; Mon, 23 Nov 2015 11:40:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7CC8C6E52B; Mon, 23 Nov 2015 03:40:13 -0800 (PST) X-Original-To: Intel-GFX@lists.freedesktop.org Delivered-To: Intel-GFX@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTP id 47E646E519 for ; Mon, 23 Nov 2015 03:40:06 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 23 Nov 2015 03:40:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,336,1444719600"; d="scan'208";a="845221887" Received: from johnharr-linux.isw.intel.com ([10.102.226.93]) by fmsmga001.fm.intel.com with ESMTP; 23 Nov 2015 03:40:01 -0800 From: John.C.Harrison@Intel.com To: Intel-GFX@Lists.FreeDesktop.Org Date: Mon, 23 Nov 2015 11:39:21 +0000 Message-Id: <1448278774-31376-27-git-send-email-John.C.Harrison@Intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448278774-31376-1-git-send-email-John.C.Harrison@Intel.com> References: <1448278774-31376-1-git-send-email-John.C.Harrison@Intel.com> Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Subject: [Intel-gfx] [PATCH 26/39] drm/i915: Connecting execbuff fences to scheduler 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-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: John Harrison The scheduler now supports sync framework fences being associated with batch buffers. The execbuff IOCTL allows such fences to be passed in from user land. This patch wires the two together so that the IOCTL no longer needs to stall on the fence immediately. Instead the stall is now swallowed by the scheduler's scheduling algorithm. For: VIZ-1587 Signed-off-by: John Harrison --- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 19 ++++++++++++++++++- drivers/gpu/drm/i915/i915_scheduler.c | 3 +++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 1c249d0..a247d50 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -1529,7 +1529,9 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, /* * Without a GPU scheduler, any fence waits must be done up front. */ - if (args->flags & I915_EXEC_WAIT_FENCE) { + if ((args->flags & I915_EXEC_WAIT_FENCE) && + (i915.scheduler_override & i915_so_direct_submit)) + { ret = i915_early_fence_wait(ring, fd_fence_wait); if (ret < 0) return ret; @@ -1714,6 +1716,18 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, i915_gem_context_reference(ctx); params->ctx = ctx; + if (args->flags & I915_EXEC_WAIT_FENCE) { + if (fd_fence_wait < 0) { + DRM_ERROR("Wait fence for ring %d has invalid id %d\n", + (int) ring->id, fd_fence_wait); + } else { + params->fence_wait = sync_fence_fdget(fd_fence_wait); + if (params->fence_wait == NULL) + DRM_ERROR("Invalid wait fence %d\n", + fd_fence_wait); + } + } + if (args->flags & I915_EXEC_CREATE_FENCE) { /* * Caller has requested a sync fence. @@ -1794,6 +1808,9 @@ err: i915_gem_context_unreference(params->ctx); } + if (params->fence_wait) + sync_fence_put(params->fence_wait); + /* * If the request was created but not successfully submitted then it * must be freed again. If it was submitted then it is being tracked diff --git a/drivers/gpu/drm/i915/i915_scheduler.c b/drivers/gpu/drm/i915/i915_scheduler.c index 939dc2b..ddd21b2 100644 --- a/drivers/gpu/drm/i915/i915_scheduler.c +++ b/drivers/gpu/drm/i915/i915_scheduler.c @@ -915,6 +915,9 @@ static int i915_scheduler_pop_from_queue_locked(struct intel_engine_cs *ring, else signalled = true; + if (!signalled) + signalled = i915_safe_to_ignore_fence(ring, node->params.fence_wait); + has_local = false; has_remote = false; for (i = 0; i < node->num_deps; i++) {