[Intel-gfx] [PATCH v99 2/4] drm/i915: Refactor duplicate object vmap functions
Chris Wilson
chris at chris-wilson.co.uk
Wed Oct 21 03:13:23 PDT 2015
On Wed, Oct 21, 2015 at 11:44:02AM +0200, Daniel Vetter wrote:
> On Wed, Oct 21, 2015 at 10:21:19AM +0100, Chris Wilson wrote:
> > We now have two implementations for vmapping a whole object, one for
> > dma-buf and one for the ringbuffer. If we couple the vmapping into the
> > obj->pages lifetime, then we can reuse an obj->vmapping for both and at
> > the same time couple it into the shrinker.
> >
> > v2: Mark the failable kmalloc() as __GFP_NOWARN (vsyrjala)
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > ---
> > drivers/gpu/drm/i915/i915_drv.h | 12 ++++---
> > drivers/gpu/drm/i915/i915_gem.c | 41 ++++++++++++++++++++++++
> > drivers/gpu/drm/i915/i915_gem_dmabuf.c | 55 +++++----------------------------
> > drivers/gpu/drm/i915/intel_ringbuffer.c | 53 ++++++++++---------------------
> > 4 files changed, 72 insertions(+), 89 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index 4093eedfd664..343a0a723d2c 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -2089,10 +2089,7 @@ struct drm_i915_gem_object {
> > struct scatterlist *sg;
> > int last;
> > } get_page;
> > -
> > - /* prime dma-buf support */
> > - void *dma_buf_vmapping;
> > - int vmapping_count;
> > + void *vmapping;
> >
> > /** Breadcrumb of last rendering to the buffer.
> > * There can only be one writer, but we allow for multiple readers.
> > @@ -2840,12 +2837,19 @@ static inline void i915_gem_object_pin_pages(struct drm_i915_gem_object *obj)
> > BUG_ON(obj->pages == NULL);
> > obj->pages_pin_count++;
> > }
> > +
> > static inline void i915_gem_object_unpin_pages(struct drm_i915_gem_object *obj)
> > {
> > BUG_ON(obj->pages_pin_count == 0);
> > obj->pages_pin_count--;
> > }
> >
> > +void *__must_check i915_gem_object_pin_vmap(struct drm_i915_gem_object *obj);
>
> erm, that should be in a header.
It is.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list