[Intel-gfx] [PATCH 2/2] drm/i915: Track unbound pages

Daniel Vetter daniel at ffwll.ch
Mon Aug 20 11:42:55 CEST 2012


On Mon, Aug 20, 2012 at 10:36:09AM +0100, Chris Wilson wrote:
> On Mon, 20 Aug 2012 11:00:39 +0200, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> >  int
> > -i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj,
> > -			      gfp_t gfpmask)
> > +i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
> >  {
> > +	struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
> >  	int page_count, i;
> >  	struct address_space *mapping;
> > -	struct inode *inode;
> >  	struct page *page;
> > +	gfp_t gfp;
> >  
> >  	if (obj->pages || obj->sg_table)
> >  		return 0;
> >  
> > +	/* Assert that the object is not currently in any GPU domain. As it
> > +	 * wasn't in the GTT, there shouldn't be any way it could have been in
> > +	 * a GPU cache
> > +	 */
> > +	BUG_ON(obj->base.read_domains & I915_GEM_GPU_DOMAINS);
> > +	BUG_ON(obj->base.write_domain & I915_GEM_GPU_DOMAINS);
> > +
> >  	/* Get the list of pages out of our struct file.  They'll be pinned
> >  	 * at this point until we release them.
> >  	 */
> >  	page_count = obj->base.size / PAGE_SIZE;
> > -	BUG_ON(obj->pages != NULL);
> > -	obj->pages = drm_malloc_ab(page_count, sizeof(struct page *));
> > +	obj->pages = kmalloc(page_count*sizeof(struct page *), GFP_KERNEL);
> 
> This is a silly one (by me). At one point the patch introduced
> i915_malloc() and replaced drm_malloc_ab() with it and then I reverted
> that after transitioning to using the sg_table everywhere.
> 
> It needs to still be drm_malloc_ab() in this and the follow-on patches
> until it is replaced by sg_alloc_table().

Ok, history fixed. Can you please check whether I haven't fumbled it?

Thanks, Daniel
-- 
Daniel Vetter
Mail: daniel at ffwll.ch
Mobile: +41 (0)79 365 57 48



More information about the Intel-gfx mailing list