On Mon, Aug 08, 2016 at 12:01:07PM +0300, Joonas Lahtinen wrote:
> On su, 2016-08-07 at 15:45 +0100, Chris Wilson wrote:
> > In many places, we wish to store the VMA in preference to the object
> > itself and so being able to create the persistent VMA is useful.
> > 
> > Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h     |  2 ++
> >  drivers/gpu/drm/i915/i915_gem_gtt.c | 10 ++++++++++
> >  drivers/gpu/drm/i915/i915_gem_gtt.h |  5 +++++
> >  3 files changed, 17 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h 
> > b/drivers/gpu/drm/i915/i915_drv.h
> > index 826486d03e8e..2d8f32cd726d 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -3903,4 +3903,6 @@ static inline bool __i915_request_irq_complete(struct 
> > drm_i915_gem_request *req)
> >     return false;
> >  }
> >  
> > +#define nullify(ptr) ({typeof(*ptr) T = *(ptr); *(ptr) = NULL; T;})
> > +
> 
> Random lost hunk here.

In the next patches where I use i915_vma_create() I also use this
helper. It was just conveience.

> >  #endif
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
> > b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > index 18c7c9644761..ce53f08186fa 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > @@ -3388,6 +3388,16 @@ __i915_gem_vma_create(struct drm_i915_gem_object 
> > *obj,
> >  }
> >  
> >  struct i915_vma *
> > +i915_vma_create(struct drm_i915_gem_object *obj,
> > +           struct i915_address_space *vm,
> > +           const struct i915_ggtt_view *view)
> > +{
> > +   GEM_BUG_ON(view ? i915_gem_obj_to_ggtt_view(obj, view) : 
> > i915_gem_obj_to_vma(obj, vm));
> 
> GEM_BUG_ON(view && !i915_is_ggtt(vm)) ?

We have that as a WARN_ON inside create(), I suspose it doesn't hurt
here either and documents the interface.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to