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

Chris Wilson chris at chris-wilson.co.uk
Tue Sep 24 00:10:34 CEST 2013


On Mon, Sep 23, 2013 at 03:00:06PM -0700, Ben Widawsky wrote:
> > I think this interface violates Rusty's rules (API should be easy to
> > use but hard to misuse).
> > 
> >   vma = i915_gem_object_pin(batch_obj, ggtt, 0, false, false);
> >   if (IS_ERR(vm)) {
> >     ret = PTR_ERR(vm);
> >     goto err;
> >   }
> > 
> 
> You're missing a step here, I assume you mean:
> i915_gem_obj_ggtt_pin(...)
> vma = i915_gem_obj_to_ggtt(...)
> if (IS_ERR)...
> 
> Or had you something else in mind?

I was thinking of making the pin return the vma instead. Then you know
that the vma is valid until its unpin. I think it helps here, but to
cater for all use cases we would need something analagous to get_pages,
pin_pages and unpin_pages. (get_vma, pin_vma, unpin_vma).
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre



More information about the Intel-gfx mailing list