[PATCH 2/2] drm/i915: Track unbound pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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().
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux