[Intel-gfx] [PATCH 5/6] [v3] drm/i915: Use the new vm [un]bind functions

Chris Wilson chris at chris-wilson.co.uk
Wed Sep 18 01:33:32 CEST 2013


On Tue, Sep 17, 2013 at 04:14:43PM -0700, Ben Widawsky wrote:
> On Tue, Sep 17, 2013 at 09:55:35PM +0100, Chris Wilson wrote:
> > On Tue, Sep 17, 2013 at 10:01:33AM -0700, Ben Widawsky wrote:
> > > @@ -1117,8 +1109,13 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
> > >  	 * batch" bit. Hence we need to pin secure batches into the global gtt.
> > >  	 * hsw should have this fixed, but let's be paranoid and do it
> > >  	 * unconditionally for now. */
> > > -	if (flags & I915_DISPATCH_SECURE && !batch_obj->has_global_gtt_mapping)
> > > -		i915_gem_gtt_bind_object(batch_obj, batch_obj->cache_level);
> > > +	if (flags & I915_DISPATCH_SECURE &&
> > > +	    !batch_obj->has_global_gtt_mapping) {
> > > +		const struct i915_address_space *ggtt = obj_to_ggtt(batch_obj);
> > > +		struct i915_vma *vma = i915_gem_obj_to_ggtt(batch_obj);
> > > +		BUG_ON(!vma);
> > > +		ggtt->bind_vma(vma, batch_obj->cache_level, GLOBAL_BIND);
> > > +	}
> > 
> > The issue here is that if we don't set the USE_PPGTT/USE_SECURE flag in
> > the dispatch, the CS will use the GGTT (hence our binding) but so we
> > then need to use the GGTT offset for the dispatch as well.
> > 
> > Is that as concisely as we can write bind_to_ggtt? :(
> > -Chris
> > 
> 
> Resuming the conversation started on irc... what do you want from me?

I think we need to pass the ggtt offset to dispatch for
I915_DISPATCH_SECURE -- which offset to use might even depend upon the
implementation and hw generation in intel_ringbuffer.c. But at the very
least, I think SNB/IVB will be executing the wrong address come full
ppgtt.

dev_priv->ggtt.base.bind_vma(i915_gem_obj_to_ggtt(batch_obj),
                             batch_obj->cache_level,
			     GLOBAL_BIND);

#define i915_vm_bind(vm__, vma__, cache_level__, flags__) \
 (vm__)->bind_vma((vma__), (cache_level__), (flags__))

i915_vm_bind(&dev_priv->ggtt.base,
             i915_gem_obj_to_ggtt(batch_obj),
	     batch_obj->cache_level,
	     GLOBAL_BIND);
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list