From patchwork Mon Oct 6 14:15:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Harrison X-Patchwork-Id: 5037521 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EB31D9FB83 for ; Mon, 6 Oct 2014 14:15:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D8F06201F5 for ; Mon, 6 Oct 2014 14:15:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 59080201C8 for ; Mon, 6 Oct 2014 14:15:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A9B656E3A6; Mon, 6 Oct 2014 07:15:48 -0700 (PDT) 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 C67C56E3AA for ; Mon, 6 Oct 2014 07:15:46 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 06 Oct 2014 07:15:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,664,1406617200"; d="scan'208";a="610270176" Received: from johnharr-linux.isw.intel.com ([10.102.226.51]) by fmsmga002.fm.intel.com with ESMTP; 06 Oct 2014 07:15:45 -0700 From: John.C.Harrison@Intel.com To: Intel-GFX@Lists.FreeDesktop.Org Date: Mon, 6 Oct 2014 15:15:23 +0100 Message-Id: <1412604925-11290-20-git-send-email-John.C.Harrison@Intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1412604925-11290-19-git-send-email-John.C.Harrison@Intel.com> References: <1412604925-11290-1-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-2-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-3-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-4-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-5-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-6-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-7-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-8-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-9-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-10-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-11-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-12-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-13-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-14-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-15-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-16-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-17-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-18-git-send-email-John.C.Harrison@Intel.com> <1412604925-11290-19-git-send-email-John.C.Harrison@Intel.com> Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Subject: [Intel-gfx] [RFC 19/21] drm/i915: Convert semaphores to handle requests not seqnos X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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=-2.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_RHS_DOB 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 For: VIZ-4377 Signed-off-by: John.C.Harrison@Intel.com --- drivers/gpu/drm/i915/i915_debugfs.c | 3 ++- drivers/gpu/drm/i915/i915_gem.c | 14 ++++++-------- drivers/gpu/drm/i915/i915_gpu_error.c | 12 ++++++++---- drivers/gpu/drm/i915/intel_ringbuffer.c | 10 ++++++---- drivers/gpu/drm/i915/intel_ringbuffer.h | 4 ++-- 5 files changed, 24 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index e764af9..df53515 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -2604,7 +2604,8 @@ static int i915_semaphore_status(struct seq_file *m, void *unused) seq_puts(m, "\nSync seqno:\n"); for_each_ring(ring, dev_priv, i) { for (j = 0; j < num_rings; j++) { - seq_printf(m, " 0x%08x ", ring->semaphore.sync_seqno[j]); + seq_printf(m, " 0x%08x ", + i915_gem_request_get_seqno(ring->semaphore.sync_req[j])); } seq_putc(m, '\n'); } diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 2e1ebad..d40dad7 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2275,8 +2275,8 @@ i915_gem_init_seqno(struct drm_device *dev, u32 seqno) for_each_ring(ring, dev_priv, i) { intel_ring_init_seqno(ring, seqno); - for (j = 0; j < ARRAY_SIZE(ring->semaphore.sync_seqno); j++) - ring->semaphore.sync_seqno[j] = 0; + for (j = 0; j < ARRAY_SIZE(ring->semaphore.sync_req); j++) + ring->semaphore.sync_req[j] = NULL; } return 0; @@ -2877,7 +2877,6 @@ i915_gem_object_sync(struct drm_i915_gem_object *obj, struct intel_engine_cs *to) { struct intel_engine_cs *from = obj->ring; - u32 seqno; int ret, idx; if (from == NULL || to == from) @@ -2888,10 +2887,10 @@ i915_gem_object_sync(struct drm_i915_gem_object *obj, idx = intel_ring_sync_index(from, to); - seqno = i915_gem_request_get_seqno(obj->last_read_req); /* Optimization: Avoid semaphore sync when we are sure we already * waited for an object with higher seqno */ - if (seqno <= from->semaphore.sync_seqno[idx]) /* <--- broken?! needs to use i915_seqno_passed()??? */ + if (i915_gem_request_get_seqno(obj->last_read_req) <= + i915_gem_request_get_seqno(from->semaphore.sync_req[idx])) /* <--- broken?! needs to use i915_seqno_passed()??? */ return 0; ret = i915_gem_check_olr(obj->last_read_req); @@ -2899,14 +2898,13 @@ i915_gem_object_sync(struct drm_i915_gem_object *obj, return ret; trace_i915_gem_ring_sync_to(from, to, obj->last_read_req); - ret = to->semaphore.sync_to(to, from, seqno); + ret = to->semaphore.sync_to(to, from, obj->last_read_req); if (!ret) /* We use last_read_req because sync_to() * might have just caused seqno wrap under * the radar. */ - from->semaphore.sync_seqno[idx] = - i915_gem_request_get_seqno(obj->last_read_req); + from->semaphore.sync_req[idx] = obj->last_read_req; return ret; } diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index 1b58390..9545d96 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -822,7 +822,8 @@ static void gen8_record_semaphore_state(struct drm_i915_private *dev_priv, idx = intel_ring_sync_index(ring, to); ering->semaphore_mboxes[idx] = tmp[signal_offset]; - ering->semaphore_seqno[idx] = ring->semaphore.sync_seqno[idx]; + ering->semaphore_seqno[idx] = + i915_gem_request_get_seqno(ring->semaphore.sync_req[idx]); } } @@ -832,13 +833,16 @@ static void gen6_record_semaphore_state(struct drm_i915_private *dev_priv, { ering->semaphore_mboxes[0] = I915_READ(RING_SYNC_0(ring->mmio_base)); ering->semaphore_mboxes[1] = I915_READ(RING_SYNC_1(ring->mmio_base)); - ering->semaphore_seqno[0] = ring->semaphore.sync_seqno[0]; - ering->semaphore_seqno[1] = ring->semaphore.sync_seqno[1]; + ering->semaphore_seqno[0] = + i915_gem_request_get_seqno(ring->semaphore.sync_req[0]); + ering->semaphore_seqno[1] = + i915_gem_request_get_seqno(ring->semaphore.sync_req[1]); if (HAS_VEBOX(dev_priv->dev)) { ering->semaphore_mboxes[2] = I915_READ(RING_SYNC_2(ring->mmio_base)); - ering->semaphore_seqno[2] = ring->semaphore.sync_seqno[2]; + ering->semaphore_seqno[2] = + i915_gem_request_get_seqno(ring->semaphore.sync_req[2]); } } diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index c8ec78c..0a3c24a 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -1042,7 +1042,7 @@ static inline bool i915_gem_has_seqno_wrapped(struct drm_device *dev, static int gen8_ring_sync(struct intel_engine_cs *waiter, struct intel_engine_cs *signaller, - u32 seqno) + struct drm_i915_gem_request *req) { struct drm_i915_private *dev_priv = waiter->dev->dev_private; int ret; @@ -1055,7 +1055,7 @@ gen8_ring_sync(struct intel_engine_cs *waiter, MI_SEMAPHORE_GLOBAL_GTT | MI_SEMAPHORE_POLL | MI_SEMAPHORE_SAD_GTE_SDD); - intel_ring_emit(waiter, seqno); + intel_ring_emit(waiter, i915_gem_request_get_seqno(req)); intel_ring_emit(waiter, lower_32_bits(GEN8_WAIT_OFFSET(waiter, signaller->id))); intel_ring_emit(waiter, @@ -1067,18 +1067,20 @@ gen8_ring_sync(struct intel_engine_cs *waiter, static int gen6_ring_sync(struct intel_engine_cs *waiter, struct intel_engine_cs *signaller, - u32 seqno) + struct drm_i915_gem_request *req) { u32 dw1 = MI_SEMAPHORE_MBOX | MI_SEMAPHORE_COMPARE | MI_SEMAPHORE_REGISTER; u32 wait_mbox = signaller->semaphore.mbox.wait[waiter->id]; int ret; + u32 seqno; /* Throughout all of the GEM code, seqno passed implies our current * seqno is >= the last seqno executed. However for hardware the * comparison is strictly greater than. */ + seqno = i915_gem_request_get_seqno(req); seqno -= 1; WARN_ON(wait_mbox == MI_SEMAPHORE_SYNC_INVALID); @@ -1794,7 +1796,7 @@ static int intel_init_ring_buffer(struct drm_device *dev, INIT_LIST_HEAD(&ring->execlist_queue); ringbuf->size = 32 * PAGE_SIZE; ringbuf->ring = ring; - memset(ring->semaphore.sync_seqno, 0, sizeof(ring->semaphore.sync_seqno)); + memset(ring->semaphore.sync_req, 0, sizeof(ring->semaphore.sync_req)); init_waitqueue_head(&ring->irq_queue); diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 5475046..64a4346 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h @@ -211,7 +211,7 @@ struct intel_engine_cs { * ie. transpose of f(x, y) */ struct { - u32 sync_seqno[I915_NUM_RINGS-1]; + struct drm_i915_gem_request *sync_req[I915_NUM_RINGS-1]; union { struct { @@ -226,7 +226,7 @@ struct intel_engine_cs { /* AKA wait() */ int (*sync_to)(struct intel_engine_cs *ring, struct intel_engine_cs *to, - u32 seqno); + struct drm_i915_gem_request *req); int (*signal)(struct intel_engine_cs *signaller, /* num_dwords needed by caller */ unsigned int num_dwords);