Web lists-archives.com

Re: [PATCH] drm/v3d: Use the new shmem helpers to reduce driver boilerplate.




Eric Anholt <eric@xxxxxxxxxx> writes:

> The new shmem helpers from Noralf and Rob abstract out a bunch of our
> BO creation and mapping code.
>
> v2: Use the new sgt getter, and flag pages as dirty before freeing.
>
> Signed-off-by: Eric Anholt <eric@xxxxxxxxxx>

> @@ -185,83 +33,120 @@ void v3d_free_object(struct drm_gem_object *obj)
>  	struct v3d_dev *v3d = to_v3d_dev(obj->dev);
>  	struct v3d_bo *bo = to_v3d_bo(obj);
>  
> +	v3d_mmu_remove_ptes(bo);
> +
>  	mutex_lock(&v3d->bo_lock);
>  	v3d->bo_stats.num_allocated--;
>  	v3d->bo_stats.pages_allocated -= obj->size >> PAGE_SHIFT;
>  	mutex_unlock(&v3d->bo_lock);
>  
> -	v3d_bo_put_pages(bo);
> -
> -	if (obj->import_attach)
> -		drm_prime_gem_destroy(obj, bo->sgt);
> -
> -	v3d_mmu_remove_ptes(bo);
>  	spin_lock(&v3d->mm_lock);
>  	drm_mm_remove_node(&bo->node);
>  	spin_unlock(&v3d->mm_lock);
>  
> -	mutex_destroy(&bo->lock);
> +	drm_gem_shmem_put_pages(&bo->base);

This put_pages() should be dropped -- it generated a WARN because the
shared helpers already do a put_pages after freeing the sgt.  The CTS
had passed, so I missed it until after I'd sent the patch.

Attachment: signature.asc
Description: PGP signature