Commit 4f385599 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Ben Skeggs

drm/nouveau: do not unpin in nouveau_gem_object_del

This should no longer be required, and is harmful for framebuffer pinning.
Also add a warning if unpin causes the pin count to drop below 0.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 8dda53fc
...@@ -148,6 +148,7 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) ...@@ -148,6 +148,7 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo)
if (unlikely(nvbo->gem)) if (unlikely(nvbo->gem))
DRM_ERROR("bo %p still attached to GEM object\n", bo); DRM_ERROR("bo %p still attached to GEM object\n", bo);
WARN_ON(nvbo->pin_refcnt > 0);
nv10_bo_put_tile_region(dev, nvbo->tile, NULL); nv10_bo_put_tile_region(dev, nvbo->tile, NULL);
kfree(nvbo); kfree(nvbo);
} }
...@@ -340,13 +341,15 @@ nouveau_bo_unpin(struct nouveau_bo *nvbo) ...@@ -340,13 +341,15 @@ nouveau_bo_unpin(struct nouveau_bo *nvbo)
{ {
struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev);
struct ttm_buffer_object *bo = &nvbo->bo; struct ttm_buffer_object *bo = &nvbo->bo;
int ret; int ret, ref;
ret = ttm_bo_reserve(bo, false, false, false, 0); ret = ttm_bo_reserve(bo, false, false, false, 0);
if (ret) if (ret)
return ret; return ret;
if (--nvbo->pin_refcnt) ref = --nvbo->pin_refcnt;
WARN_ON_ONCE(ref < 0);
if (ref)
goto out; goto out;
nouveau_bo_placement_set(nvbo, bo->mem.placement, 0); nouveau_bo_placement_set(nvbo, bo->mem.placement, 0);
......
...@@ -50,12 +50,6 @@ nouveau_gem_object_del(struct drm_gem_object *gem) ...@@ -50,12 +50,6 @@ nouveau_gem_object_del(struct drm_gem_object *gem)
return; return;
nvbo->gem = NULL; nvbo->gem = NULL;
/* Lockdep hates you for doing reserve with gem object lock held */
if (WARN_ON_ONCE(nvbo->pin_refcnt)) {
nvbo->pin_refcnt = 1;
nouveau_bo_unpin(nvbo);
}
if (gem->import_attach) if (gem->import_attach)
drm_prime_gem_destroy(gem, nvbo->bo.sg); drm_prime_gem_destroy(gem, nvbo->bo.sg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment