From patchwork Fri Mar 18 22:35:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 645641 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2IMb9Ul018844 for ; Fri, 18 Mar 2011 22:37:30 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D21C79ECD9 for ; Fri, 18 Mar 2011 15:37:09 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from fireflyinternet.com (server109-228-6-236.live-servers.net [109.228.6.236]) by gabe.freedesktop.org (Postfix) with ESMTP id 509F69E810 for ; Fri, 18 Mar 2011 15:35:37 -0700 (PDT) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.66.37; Received: from arrandale.alporthouse.com (unverified [78.156.66.37]) by fireflyinternet.com (Firefly Internet SMTP) with ESMTP id 29546814-1500050 for multiple; Fri, 18 Mar 2011 22:36:56 +0000 From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 18 Mar 2011 22:35:18 +0000 Message-Id: <1300487719-26578-4-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1300487719-26578-1-git-send-email-chris@chris-wilson.co.uk> References: <1300487719-26578-1-git-send-email-chris@chris-wilson.co.uk> X-Originating-IP: 78.156.66.37 Cc: Andy Whitcroft Subject: [Intel-gfx] [PATCH 3/4] drm/i915: Cleanup handling of last_fenced_seqno X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 18 Mar 2011 22:37:30 +0000 (UTC) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 5201f82..2dbf8f7 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -2461,13 +2461,15 @@ i915_gem_object_flush_fence(struct drm_i915_gem_object *obj, obj->fenced_gpu_access = false; } + if (obj->last_fenced_seqno && + ring_passed_seqno(obj->ring, obj->last_fenced_seqno)) + obj->last_fenced_seqno = 0; + if (obj->last_fenced_seqno && pipelined != obj->ring) { - if (!ring_passed_seqno(obj->ring, obj->last_fenced_seqno)) { - ret = i915_wait_request(obj->ring, - obj->last_fenced_seqno); - if (ret) - return ret; - } + ret = i915_wait_request(obj->ring, + obj->last_fenced_seqno); + if (ret) + return ret; obj->last_fenced_seqno = 0; } @@ -2586,9 +2588,6 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj, if (ret) return ret; - if (!obj->fenced_gpu_access && !obj->last_fenced_seqno) - pipelined = NULL; - goto update; } @@ -2606,9 +2605,12 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj, reg->setup_ring = NULL; } } else if (obj->last_fenced_seqno && obj->ring != pipelined) { - ret = i915_gem_object_flush_fence(obj, pipelined); + ret = i915_wait_request(obj->ring, + obj->last_fenced_seqno); if (ret) return ret; + + obj->last_fenced_seqno = 0; } return 0; @@ -2648,15 +2650,18 @@ i915_gem_object_get_fence(struct drm_i915_gem_object *obj, old->last_fenced_seqno); } + obj->last_fenced_seqno = old->last_fenced_seqno; drm_gem_object_unreference(&old->base); - } else if (obj->last_fenced_seqno == 0) - pipelined = NULL; + } reg->obj = obj; list_move_tail(®->lru_list, &dev_priv->mm.fence_list); obj->fence_reg = reg - dev_priv->fence_regs; update: + if (obj->last_fenced_seqno == 0) + pipelined = NULL; + reg->setup_seqno = pipelined ? i915_gem_next_request_seqno(pipelined) : 0; reg->setup_ring = pipelined;