[Intel-gfx] [PATCH 04/53] drm/i915: Extract ringbuffer destroy & make alloc outside accesible

Mateo Lozano, Oscar oscar.mateo at intel.com
Thu Jun 19 12:42:19 CEST 2014


> -----Original Message-----
> From: Volkin, Bradley D
> Sent: Wednesday, June 18, 2014 10:39 PM
> To: Mateo Lozano, Oscar
> Cc: intel-gfx at lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH 04/53] drm/i915: Extract ringbuffer destroy &
> make alloc outside accesible
> 
> On Fri, Jun 13, 2014 at 08:37:22AM -0700, oscar.mateo at intel.com wrote:
> > From: Oscar Mateo <oscar.mateo at intel.com>
> >
> > We are going to start creating a lot of extra ringbuffers soon, so
> > these functions are handy.
> >
> > No functional changes.
> >
> > Signed-off-by: Oscar Mateo <oscar.mateo at intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_ringbuffer.c | 26
> > ++++++++++++++++----------  drivers/gpu/drm/i915/intel_ringbuffer.h |
> > 4 ++++
> >  2 files changed, 20 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c
> > b/drivers/gpu/drm/i915/intel_ringbuffer.c
> > index 279488a..915f3d5 100644
> > --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> > +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> > @@ -1378,15 +1378,25 @@ static int init_phys_status_page(struct
> intel_engine_cs *ring)
> >  	return 0;
> >  }
> >
> > -static int allocate_ring_buffer(struct intel_engine_cs *ring)
> > +void intel_destroy_ring_buffer(struct intel_ringbuffer *ringbuf) {
> > +	if (!ringbuf->obj)
> > +		return;
> > +
> > +	iounmap(ringbuf->virtual_start);
> > +	i915_gem_object_ggtt_unpin(ringbuf->obj);
> > +	drm_gem_object_unreference(&ringbuf->obj->base);
> > +	ringbuf->obj = NULL;
> > +}
> > +
> > +int intel_allocate_ring_buffer(struct drm_device *dev,
> > +			       struct intel_ringbuffer *ringbuf)
> 
> A bikeshed, but maybe intel_alloc_ringbuffer_obj() since we're only
> allocating the backing object, and to mirror the earlier
> i915_gem_alloc_context_obj() with similar purpose. Otherwise, looks fine to
> me.
> 
> Brad

Bikeshed accepted! It does look better.

-- Oscar



More information about the Intel-gfx mailing list