From patchwork Mon Feb 9 21:54:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 5803431 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C6A3FBF440 for ; Mon, 9 Feb 2015 21:54:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBDAD2011B for ; Mon, 9 Feb 2015 21:54:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id ADDFE2011E for ; Mon, 9 Feb 2015 21:54:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C28966E5CB; Mon, 9 Feb 2015 13:54:30 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EFA36E1B6 for ; Mon, 9 Feb 2015 13:54:27 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 09 Feb 2015 13:54:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,546,1418112000"; d="scan'208";a="683311479" Received: from statham.jf.intel.com (HELO statham.localdomain) ([10.7.198.99]) by orsmga002.jf.intel.com with ESMTP; 09 Feb 2015 13:54:26 -0800 From: Ben Widawsky To: Intel GFX Date: Mon, 9 Feb 2015 13:54:15 -0800 Message-Id: <1423518859-6199-3-git-send-email-benjamin.widawsky@intel.com> X-Mailer: git-send-email 2.3.0 In-Reply-To: <1423518859-6199-1-git-send-email-benjamin.widawsky@intel.com> References: <1423518859-6199-1-git-send-email-benjamin.widawsky@intel.com> Cc: Ben Widawsky , Ben Widawsky Subject: [Intel-gfx] [PATCH 2/6] drm/i915: Pass eb_vmas to execbuffer implementations X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY 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 The role of eb_vmas continues to grow here as it becomes the proper encapsulation for the data passed to the various execution function. Next patch makes use of it... This patch was initially part of the next patch, but got split out after I had found a bug that convinced me the two should be separate. Signed-off-by: Ben Widawsky --- drivers/gpu/drm/i915/i915_drv.h | 13 +++++++++++-- drivers/gpu/drm/i915/i915_gem_execbuffer.c | 26 ++++++++++---------------- drivers/gpu/drm/i915/intel_lrc.c | 8 +++++--- drivers/gpu/drm/i915/intel_lrc.h | 3 ++- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 4179b90..90ff6aa 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1641,6 +1641,15 @@ struct i915_workarounds { u32 count; }; +struct eb_vmas { + struct list_head vmas; + int and; + union { + struct i915_vma *lut[0]; + struct hlist_head buckets[0]; + }; +}; + struct drm_i915_private { struct drm_device *dev; struct kmem_cache *slab; @@ -1896,7 +1905,7 @@ struct drm_i915_private { struct intel_engine_cs *ring, struct intel_context *ctx, struct drm_i915_gem_execbuffer2 *args, - struct list_head *vmas, + struct eb_vmas *eb, struct drm_i915_gem_object *batch_obj, u64 exec_start, u32 flags); int (*init_rings)(struct drm_device *dev); @@ -2626,7 +2635,7 @@ int i915_gem_ringbuffer_submission(struct drm_device *dev, struct intel_engine_cs *ring, struct intel_context *ctx, struct drm_i915_gem_execbuffer2 *args, - struct list_head *vmas, + struct eb_vmas *eb, struct drm_i915_gem_object *batch_obj, u64 exec_start, u32 flags); int i915_gem_execbuffer(struct drm_device *dev, void *data, diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index b773368..13ed13e 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c @@ -41,15 +41,6 @@ #define BATCH_OFFSET_BIAS (256*1024) -struct eb_vmas { - struct list_head vmas; - int and; - union { - struct i915_vma *lut[0]; - struct hlist_head buckets[0]; - }; -}; - static struct eb_vmas * eb_create(struct drm_i915_gem_execbuffer2 *args) { @@ -617,10 +608,11 @@ eb_vma_misplaced(struct i915_vma *vma) static int i915_gem_execbuffer_reserve(struct intel_engine_cs *ring, - struct list_head *vmas, + struct eb_vmas *eb, bool *need_relocs) { struct drm_i915_gem_object *obj; + struct list_head *vmas = &eb->vmas; struct i915_vma *vma; struct i915_address_space *vm; struct list_head ordered_vmas; @@ -803,7 +795,7 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, goto err; need_relocs = (args->flags & I915_EXEC_NO_RELOC) == 0; - ret = i915_gem_execbuffer_reserve(ring, &eb->vmas, &need_relocs); + ret = i915_gem_execbuffer_reserve(ring, eb, &need_relocs); if (ret) goto err; @@ -829,8 +821,9 @@ err: static int i915_gem_execbuffer_move_to_gpu(struct intel_engine_cs *ring, - struct list_head *vmas) + struct eb_vmas *eb) { + struct list_head *vmas = &eb->vmas; struct i915_vma *vma; uint32_t flush_domains = 0; bool flush_chipset = false; @@ -1136,12 +1129,13 @@ i915_gem_ringbuffer_submission(struct drm_device *dev, struct drm_file *file, struct intel_engine_cs *ring, struct intel_context *ctx, struct drm_i915_gem_execbuffer2 *args, - struct list_head *vmas, + struct eb_vmas *eb, struct drm_i915_gem_object *batch_obj, u64 exec_start, u32 flags) { struct drm_clip_rect *cliprects = NULL; struct drm_i915_private *dev_priv = dev->dev_private; + struct list_head *vmas = &eb->vmas; u64 exec_len; int instp_mode; u32 instp_mask; @@ -1190,7 +1184,7 @@ i915_gem_ringbuffer_submission(struct drm_device *dev, struct drm_file *file, } } - ret = i915_gem_execbuffer_move_to_gpu(ring, vmas); + ret = i915_gem_execbuffer_move_to_gpu(ring, eb); if (ret) goto error; @@ -1463,7 +1457,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, /* Move the objects en-masse into the GTT, evicting if necessary. */ need_relocs = (args->flags & I915_EXEC_NO_RELOC) == 0; - ret = i915_gem_execbuffer_reserve(ring, &eb->vmas, &need_relocs); + ret = i915_gem_execbuffer_reserve(ring, eb, &need_relocs); if (ret) goto err; @@ -1527,7 +1521,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, exec_start += i915_gem_obj_offset(batch_obj, vm); ret = dev_priv->gt.do_execbuf(dev, file, ring, ctx, args, - &eb->vmas, batch_obj, exec_start, flags); + eb, batch_obj, exec_start, flags); /* * FIXME: We crucially rely upon the active tracking for the (ppgtt) diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index e727217..03741f9 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -571,9 +571,10 @@ static int logical_ring_invalidate_all_caches(struct intel_ringbuffer *ringbuf, static int execlists_move_to_gpu(struct intel_ringbuffer *ringbuf, struct intel_context *ctx, - struct list_head *vmas) + struct eb_vmas *eb) { struct intel_engine_cs *ring = ringbuf->ring; + struct list_head *vmas = &eb->vmas; struct i915_vma *vma; uint32_t flush_domains = 0; int ret; @@ -621,12 +622,13 @@ int intel_execlists_submission(struct drm_device *dev, struct drm_file *file, struct intel_engine_cs *ring, struct intel_context *ctx, struct drm_i915_gem_execbuffer2 *args, - struct list_head *vmas, + struct eb_vmas *eb, struct drm_i915_gem_object *batch_obj, u64 exec_start, u32 flags) { struct drm_i915_private *dev_priv = dev->dev_private; struct intel_ringbuffer *ringbuf = ctx->engine[ring->id].ringbuf; + struct list_head *vmas = &eb->vmas; int instp_mode; u32 instp_mask; int ret; @@ -677,7 +679,7 @@ int intel_execlists_submission(struct drm_device *dev, struct drm_file *file, return -EINVAL; } - ret = execlists_move_to_gpu(ringbuf, ctx, vmas); + ret = execlists_move_to_gpu(ringbuf, ctx, eb); if (ret) return ret; diff --git a/drivers/gpu/drm/i915/intel_lrc.h b/drivers/gpu/drm/i915/intel_lrc.h index 6f2d7da..661080bc 100644 --- a/drivers/gpu/drm/i915/intel_lrc.h +++ b/drivers/gpu/drm/i915/intel_lrc.h @@ -80,11 +80,12 @@ void intel_lr_context_unpin(struct intel_engine_cs *ring, /* Execlists */ int intel_sanitize_enable_execlists(struct drm_device *dev, int enable_execlists); +struct eb_vmas; int intel_execlists_submission(struct drm_device *dev, struct drm_file *file, struct intel_engine_cs *ring, struct intel_context *ctx, struct drm_i915_gem_execbuffer2 *args, - struct list_head *vmas, + struct eb_vmas *eb, struct drm_i915_gem_object *batch_obj, u64 exec_start, u32 flags); u32 intel_execlists_ctx_id(struct drm_i915_gem_object *ctx_obj);