From patchwork Thu Jun 27 23:30:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 2796381 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BF367BF4A1 for ; Thu, 27 Jun 2013 23:47:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B74662020E for ; Thu, 27 Jun 2013 23:47:24 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9F1DA2020C for ; Thu, 27 Jun 2013 23:47:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 77714E6479 for ; Thu, 27 Jun 2013 16:47:23 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from shiva.localdomain (unknown [209.20.75.48]) by gabe.freedesktop.org (Postfix) with ESMTP id 5597FE5F3E for ; Thu, 27 Jun 2013 16:28:31 -0700 (PDT) Received: by shiva.localdomain (Postfix, from userid 99) id 2A9E5886A7; Thu, 27 Jun 2013 23:28:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lundgren.jf.intel.com (jfdmzpr02-ext.jf.intel.com [134.134.137.71]) by shiva.localdomain (Postfix) with ESMTPSA id 9C33D88652; Thu, 27 Jun 2013 23:28:28 +0000 (UTC) From: Ben Widawsky To: Intel GFX Date: Thu, 27 Jun 2013 16:30:39 -0700 Message-Id: <1372375867-1003-39-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1372375867-1003-1-git-send-email-ben@bwidawsk.net> References: <1372375867-1003-1-git-send-email-ben@bwidawsk.net> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH 38/66] drm/i915: create an object_is_active() 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 X-Virus-Scanned: ClamAV using ClamSMTP This is simply obj->active for now, but will serve a purpose when we track activity per vma. Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/i915_gem.c | 18 ++++++++++++------ drivers/gpu/drm/i915/i915_gem_context.c | 2 +- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index cc18349..b3eb067 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1709,6 +1709,7 @@ static inline void i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj) int __must_check i915_mutex_lock_interruptible(struct drm_device *dev); int i915_gem_object_sync(struct drm_i915_gem_object *obj, struct intel_ring_buffer *to); +bool i915_gem_object_is_active(struct drm_i915_gem_object *obj); void i915_gem_object_move_to_active(struct drm_i915_gem_object *obj, struct i915_address_space *vm, struct intel_ring_buffer *ring); diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 950a14b..f448804 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -134,10 +134,16 @@ int i915_mutex_lock_interruptible(struct drm_device *dev) return 0; } +/* NB: Not the same as !i915_gem_object_is_inactive */ +bool i915_gem_object_is_active(struct drm_i915_gem_object *obj) +{ + return obj->active; +} + static inline bool i915_gem_object_is_inactive(struct drm_i915_gem_object *obj) { - return i915_gem_obj_bound_any(obj) && !obj->active; + return i915_gem_obj_bound_any(obj) && !i915_gem_object_is_active(obj); } int @@ -1884,7 +1890,7 @@ i915_gem_object_move_to_active(struct drm_i915_gem_object *obj, obj->ring = ring; /* Add a reference if we're newly entering the active list. */ - if (!obj->active) { + if (!i915_gem_object_is_active(obj)) { drm_gem_object_reference(&obj->base); obj->active = 1; } @@ -1917,7 +1923,7 @@ i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj, struct i915_vma *vma; BUG_ON(obj->base.write_domain & ~I915_GEM_GPU_DOMAINS); - BUG_ON(!obj->active); + BUG_ON(!i915_gem_object_is_active(obj)); vma = i915_gem_obj_to_vma(obj, vm); list_move_tail(&vma->mm_list, &vm->inactive_list); @@ -2446,7 +2452,7 @@ i915_gem_object_flush_active(struct drm_i915_gem_object *obj) { int ret; - if (obj->active) { + if (i915_gem_object_is_active(obj)) { ret = i915_gem_check_olr(obj->ring, obj->last_read_seqno); if (ret) return ret; @@ -2511,7 +2517,7 @@ i915_gem_wait_ioctl(struct drm_device *dev, void *data, struct drm_file *file) if (ret) goto out; - if (obj->active) { + if (i915_gem_object_is_active(obj)) { seqno = obj->last_read_seqno; ring = obj->ring; } @@ -3885,7 +3891,7 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data, */ ret = i915_gem_object_flush_active(obj); - args->busy = obj->active; + args->busy = i915_gem_object_is_active(obj); if (obj->ring) { BUILD_BUG_ON(I915_NUM_RINGS > 16); args->busy |= intel_ring_flag(obj->ring) << 16; diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index 5d5a60f..988123f 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c @@ -292,7 +292,7 @@ void i915_gem_context_fini(struct drm_device *dev) WARN_ON(!dev_priv->ring[RCS].last_context); if (dev_priv->ring[RCS].last_context == dctx) { /* Fake switch to NULL context */ - WARN_ON(dctx->obj->active); + WARN_ON(i915_gem_object_is_active(dctx->obj)); i915_gem_object_unpin(dctx->obj); i915_gem_context_unreference(dctx); } diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index 620f395..7e9823f 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -251,7 +251,7 @@ i915_gem_execbuffer_relocate_entry(struct drm_i915_gem_object *obj, } /* We can't wait for rendering with pagefaults disabled */ - if (obj->active && in_atomic()) + if (i915_gem_object_is_active(obj) && in_atomic()) return -EFAULT; reloc->delta += target_offset;