Message ID | 20130917054428.GA2585@bwidawsk.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Sep 16, 2013 at 10:44:29PM -0700, Ben Widawsky wrote: > I'm sorry. After reading my comments again, you're absolutely right. > > How's this? I'm liking it better, since it gives some insight into why GLOBAL_BIND is required. > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c > index 2a71a29..fcf36ae 100644 > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c > @@ -658,10 +658,17 @@ static void gen6_ggtt_bind_vma(struct i915_vma *vma, > struct drm_i915_gem_object *obj = vma->obj; > const unsigned long entry = vma->node.start >> PAGE_SHIFT; > > - /* If there is an aliasing PPGTT, and the user didn't explicitly ask for > - * the global, just use aliasing */ > + /* If there is no aliasing PPGTT, or the caller needs a global mapping, > + * or we have a global mapping already but the cacheability flags have > + * changed, set the global PTES. > + * > + * If there is an aliasing PPGTT it is anecdotally faster, so use that > + * instead if none of the above hold true. > + * > + * NB: A global mapping should only be needed for special regions like > + * "gtt mappable", SNB errata, or if specified via special execbuf flags + At all other times, the GPU will use the aliasing ppgtt. Just adds that extra bit of stress that the predominant access is through the aliasing ppgtt. -Chris
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 2a71a29..fcf36ae 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -658,10 +658,17 @@ static void gen6_ggtt_bind_vma(struct i915_vma *vma, struct drm_i915_gem_object *obj = vma->obj; const unsigned long entry = vma->node.start >> PAGE_SHIFT; - /* If there is an aliasing PPGTT, and the user didn't explicitly ask for - * the global, just use aliasing */ + /* If there is no aliasing PPGTT, or the caller needs a global mapping, + * or we have a global mapping already but the cacheability flags have + * changed, set the global PTES. + * + * If there is an aliasing PPGTT it is anecdotally faster, so use that + * instead if none of the above hold true. + * + * NB: A global mapping should only be needed for special regions like + * "gtt mappable", SNB errata, or if specified via special execbuf flags + */ if (!dev_priv->mm.aliasing_ppgtt || flags & GLOBAL_BIND) { - /* If the object is unbound, or we're change the cache bits */ if (!obj->has_global_gtt_mapping || (cache_level != obj->cache_level)) { gen6_ggtt_insert_entries(vma->vm, obj->pages, entry, @@ -670,8 +677,6 @@ static void gen6_ggtt_bind_vma(struct i915_vma *vma, } } - /* If put the mapping in the aliasing PPGTT as well as Global if we have - * aliasing, but the user requested global. */ if (dev_priv->mm.aliasing_ppgtt && (!obj->has_aliasing_ppgtt_mapping || (cache_level != obj->cache_level))) {