[Intel-gfx] [PATCH 7/8] drm/i915: Use the new vm [un]bind functions

Chris Wilson chris at chris-wilson.co.uk
Sat Sep 14 17:31:06 CEST 2013


On Fri, Sep 13, 2013 at 06:08:17PM -0700, Ben Widawsky wrote:
> On Wed, Sep 11, 2013 at 11:39:30PM +0100, Chris Wilson wrote:
> > On Wed, Sep 11, 2013 at 02:57:54PM -0700, Ben Widawsky wrote:
> > > @@ -464,11 +465,12 @@ i915_gem_execbuffer_reserve_vma(struct i915_vma *vma,
> > >  				struct intel_ring_buffer *ring,
> > >  				bool *need_reloc)
> > >  {
> > > -	struct drm_i915_private *dev_priv = ring->dev->dev_private;
> > > +	struct drm_i915_gem_object *obj = vma->obj;
> > >  	struct drm_i915_gem_exec_object2 *entry = vma->exec_entry;
> > >  	bool has_fenced_gpu_access = INTEL_INFO(ring->dev)->gen < 4;
> > >  	bool need_fence, need_mappable;
> > > -	struct drm_i915_gem_object *obj = vma->obj;
> > > +	u32 flags = (entry->flags & EXEC_OBJECT_NEEDS_GTT) &&
> > > +		!vma->obj->has_global_gtt_mapping ? GLOBAL_BIND : 0;
> > >  	int ret;
> > >  
> > >  	need_fence =
> > > @@ -497,14 +499,6 @@ i915_gem_execbuffer_reserve_vma(struct i915_vma *vma,
> > >  		}
> > >  	}
> > >  
> > > -	/* Ensure ppgtt mapping exists if needed */
> > > -	if (dev_priv->mm.aliasing_ppgtt && !obj->has_aliasing_ppgtt_mapping) {
> > > -		i915_ppgtt_bind_object(dev_priv->mm.aliasing_ppgtt,
> > > -				       obj, obj->cache_level);
> > > -
> > > -		obj->has_aliasing_ppgtt_mapping = 1;
> > > -	}
> > > -
> > >  	if (entry->offset != vma->node.start) {
> > >  		entry->offset = vma->node.start;
> > >  		*need_reloc = true;
> > > @@ -515,9 +509,7 @@ i915_gem_execbuffer_reserve_vma(struct i915_vma *vma,
> > >  		obj->base.pending_write_domain = I915_GEM_DOMAIN_RENDER;
> > >  	}
> > >  
> > > -	if (entry->flags & EXEC_OBJECT_NEEDS_GTT &&
> > > -	    !obj->has_global_gtt_mapping)
> > > -		i915_gem_gtt_bind_object(obj, obj->cache_level);
> > > +	vma->vm->bind_vma(vma, obj->cache_level, flags);
> > 
> > This results in us rebinding into the vma unconditionally once/twice for
> > every object on every execbuffer, right?
> 
> Hmm, how does this suit you (untested)? I think it is addressing your concern.
> Also, I suspect squashing this patch with the previous is probably a good thing
> to do.

That looks like it should do the trick. However, would it not be cleaner
to move the vma->vm->bind_vma() into the pin()?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list