From: Daniel Vetter Subject: [PATCH 5/7] drm/i915/gtt: group legacy global gtt code together Date: Thu, 26 Sep 2013 22:31:31 +0200 Message-ID: <1380227493-31124-6-git-send-email-daniel.vetter@ffwll.ch> References: <1380227493-31124-1-git-send-email-daniel.vetter@ffwll.ch> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ea0-f172.google.com (mail-ea0-f172.google.com [209.85.215.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 72B33E7E21 for ; Thu, 26 Sep 2013 14:49:22 -0700 (PDT) Received: by mail-ea0-f172.google.com with SMTP id r16so839815ead.17 for ; Thu, 26 Sep 2013 14:49:21 -0700 (PDT) In-Reply-To: <1380227493-31124-1-git-send-email-daniel.vetter@ffwll.ch> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Intel Graphics Development Cc: Daniel Vetter List-Id: intel-gfx@lists.freedesktop.org No functional change in here, just code movement. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_gem_gtt.c | 77 +++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 560f24c..095d902 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -459,28 +459,6 @@ static int i915_gem_init_aliasing_ppgtt(struct drm_device *dev) return ret; } -extern int intel_iommu_gfx_mapped; -/* Certain Gen5 chipsets require require idling the GPU before - * unmapping anything from the GTT when VT-d is enabled. - */ -static inline bool needs_idle_maps(struct drm_device *dev) -{ -#ifdef CONFIG_INTEL_IOMMU - /* Query intel_iommu to see if we need the workaround. Presumably that - * was loaded first. - */ - if (IS_GEN5(dev) && IS_MOBILE(dev) && intel_iommu_gfx_mapped) - return true; -#endif - return false; -} - -/* - * Binds an object into the global gtt with the specified cache level. The object - * will be accessible to the GPU via commands whose operands reference offsets - * within the global GTT as well as accessible by the GPU through the GMADR - * mapped BAR (dev_priv->mm.gtt->gtt). - */ static void gen6_ggtt_insert_entries(struct i915_address_space *vm, struct sg_table *st, unsigned int first_entry, @@ -539,25 +517,6 @@ static void gen6_ggtt_clear_range(struct i915_address_space *vm, } -static void i915_ggtt_insert_entries(struct i915_address_space *vm, - struct sg_table *st, - unsigned int pg_start, - enum i915_cache_level cache_level) -{ - unsigned int flags = (cache_level == I915_CACHE_NONE) ? - AGP_USER_MEMORY : AGP_USER_CACHED_MEMORY; - - intel_gtt_insert_sg_entries(st, pg_start, flags); - -} - -static void i915_ggtt_clear_range(struct i915_address_space *vm, - unsigned int first_entry, - unsigned int num_entries) -{ - intel_gtt_clear_range(first_entry, num_entries); -} - static void gen6_ggtt_bind_vma(struct i915_vma *vma, enum i915_cache_level cache_level, u32 flags) @@ -858,6 +817,42 @@ static void gen6_gmch_remove(struct i915_address_space *vm) } +/* Legacy GTT support (using intel-gtt.c) */ +static void i915_ggtt_insert_entries(struct i915_address_space *vm, + struct sg_table *st, + unsigned int pg_start, + enum i915_cache_level cache_level) +{ + unsigned int flags = (cache_level == I915_CACHE_NONE) ? + AGP_USER_MEMORY : AGP_USER_CACHED_MEMORY; + + intel_gtt_insert_sg_entries(st, pg_start, flags); + +} + +static void i915_ggtt_clear_range(struct i915_address_space *vm, + unsigned int first_entry, + unsigned int num_entries) +{ + intel_gtt_clear_range(first_entry, num_entries); +} + +extern int intel_iommu_gfx_mapped; +/* Certain Gen5 chipsets require require idling the GPU before + * unmapping anything from the GTT when VT-d is enabled. + */ +static inline bool needs_idle_maps(struct drm_device *dev) +{ +#ifdef CONFIG_INTEL_IOMMU + /* Query intel_iommu to see if we need the workaround. Presumably that + * was loaded first. + */ + if (IS_GEN5(dev) && IS_MOBILE(dev) && intel_iommu_gfx_mapped) + return true; +#endif + return false; +} + static int i915_gmch_probe(struct drm_device *dev, size_t *gtt_total, size_t *stolen, -- 1.8.1.4