From patchwork Thu Dec 6 14:12:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 1844941 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 703323FCA5 for ; Thu, 6 Dec 2012 14:14:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 66F17E5C3B for ; Thu, 6 Dec 2012 06:14:28 -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 2843CE63C4 for ; Thu, 6 Dec 2012 06:14:18 -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 SMTP) with ESMTP id 125533952-1500050 for multiple; Thu, 06 Dec 2012 14:14:12 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Thu, 6 Dec 2012 14:12:30 +0000 Message-Id: <1354803150-29502-1-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1354626725-8521-4-git-send-email-mika.kuoppala@intel.com> References: <1354626725-8521-4-git-send-email-mika.kuoppala@intel.com> X-Originating-IP: 78.156.73.22 Subject: [Intel-gfx] [PATCH] Detect wraparound using next-seqno rather than waiter->olr 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 As the olr may have been allocated long in advance for a much earlier write to the ring, waiter->olr may genuinely be less than the semaphore seqno. So use the global next_seqno for wraparound detection instead. --- drivers/gpu/drm/i915/intel_ringbuffer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c index d5d5177..29f9e2c 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.c +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c @@ -595,6 +595,12 @@ gen6_add_request(struct intel_ring_buffer *ring) return 0; } +static inline u32 i915_gem_next_seqno(struct drm_device *dev) +{ + struct drm_i915_private *dev_priv = dev->dev_private; + return dev_priv->next_seqno; +} + /** * intel_ring_sync - sync the waiter to the signaller on seqno * @@ -628,7 +634,7 @@ gen6_ring_sync(struct intel_ring_buffer *waiter, BUG_ON(!waiter->outstanding_lazy_request); /* If seqno wrap happened, omit the wait with no-ops */ - if (likely(waiter->outstanding_lazy_request > seqno)) { + if (likely(i915_gem_next_seqno(waiter->dev) > seqno)) { intel_ring_emit(waiter, dw1 | signaller->semaphore_register[waiter->id]);