lkml.org 
[lkml]   [2019]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] drm/v3d: Use the new shmem helpers to reduce driver boilerplate.
Date
Eric Anholt <eric@anholt.net> 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@anholt.net>

> @@ -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.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-03-14 17:48    [W:0.036 / U:38.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site