From patchwork Tue Jul 9 06:08:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 2825100 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 22398C0AB2 for ; Tue, 9 Jul 2013 06:10:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 245E22015F for ; Tue, 9 Jul 2013 06:10:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 360F620121 for ; Tue, 9 Jul 2013 06:10:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1B039E6220 for ; Mon, 8 Jul 2013 23:10:49 -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 7731DE6209 for ; Mon, 8 Jul 2013 23:05:42 -0700 (PDT) Received: by shiva.localdomain (Postfix, from userid 99) id 4166D8862F; Tue, 9 Jul 2013 06:05:42 +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=-4.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.kumite (c-24-21-100-90.hsd1.or.comcast.net [24.21.100.90]) by shiva.localdomain (Postfix) with ESMTPSA id 6F0658864E; Tue, 9 Jul 2013 06:05:41 +0000 (UTC) From: Ben Widawsky To: Intel GFX Date: Mon, 8 Jul 2013 23:08:41 -0700 Message-Id: <1373350122-5118-11-git-send-email-ben@bwidawsk.net> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1373350122-5118-1-git-send-email-ben@bwidawsk.net> References: <1373350122-5118-1-git-send-email-ben@bwidawsk.net> Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH 10/11] 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_execbuffer.c | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index b98ad82..38d07f2 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1716,6 +1716,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 9a58363..c2ecb78 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 @@ -1894,7 +1900,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; } @@ -1927,7 +1933,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); @@ -2437,7 +2443,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; @@ -2502,7 +2508,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; } @@ -3872,7 +3878,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_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index e90182d..725dd7f 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;