diff options
author | Maarten Lankhorst <maarten.lankhorst@canonical.com> | 2013-07-07 04:37:35 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2013-07-09 20:47:49 -0400 |
commit | 4f3855997c5d2bf6443853800eb1a03f61ad9140 (patch) | |
tree | 49eb36131fa92c38d3a622914c5ee690306ca59a | |
parent | 8dda53fca24789acf891ef31a3c5e03332b43cce (diff) |
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: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_gem.c | 6 |
2 files changed, 5 insertions, 8 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 85fed108d7e4..824a98811de6 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -148,6 +148,7 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) | |||
148 | 148 | ||
149 | if (unlikely(nvbo->gem)) | 149 | if (unlikely(nvbo->gem)) |
150 | DRM_ERROR("bo %p still attached to GEM object\n", bo); | 150 | DRM_ERROR("bo %p still attached to GEM object\n", bo); |
151 | WARN_ON(nvbo->pin_refcnt > 0); | ||
151 | nv10_bo_put_tile_region(dev, nvbo->tile, NULL); | 152 | nv10_bo_put_tile_region(dev, nvbo->tile, NULL); |
152 | kfree(nvbo); | 153 | kfree(nvbo); |
153 | } | 154 | } |
@@ -340,13 +341,15 @@ nouveau_bo_unpin(struct nouveau_bo *nvbo) | |||
340 | { | 341 | { |
341 | struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); | 342 | struct nouveau_drm *drm = nouveau_bdev(nvbo->bo.bdev); |
342 | struct ttm_buffer_object *bo = &nvbo->bo; | 343 | struct ttm_buffer_object *bo = &nvbo->bo; |
343 | int ret; | 344 | int ret, ref; |
344 | 345 | ||
345 | ret = ttm_bo_reserve(bo, false, false, false, 0); | 346 | ret = ttm_bo_reserve(bo, false, false, false, 0); |
346 | if (ret) | 347 | if (ret) |
347 | return ret; | 348 | return ret; |
348 | 349 | ||
349 | if (--nvbo->pin_refcnt) | 350 | ref = --nvbo->pin_refcnt; |
351 | WARN_ON_ONCE(ref < 0); | ||
352 | if (ref) | ||
350 | goto out; | 353 | goto out; |
351 | 354 | ||
352 | nouveau_bo_placement_set(nvbo, bo->mem.placement, 0); | 355 | nouveau_bo_placement_set(nvbo, bo->mem.placement, 0); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index e72d09c068a8..830cb7bad922 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -50,12 +50,6 @@ nouveau_gem_object_del(struct drm_gem_object *gem) | |||
50 | return; | 50 | return; |
51 | nvbo->gem = NULL; | 51 | nvbo->gem = NULL; |
52 | 52 | ||
53 | /* Lockdep hates you for doing reserve with gem object lock held */ | ||
54 | if (WARN_ON_ONCE(nvbo->pin_refcnt)) { | ||
55 | nvbo->pin_refcnt = 1; | ||
56 | nouveau_bo_unpin(nvbo); | ||
57 | } | ||
58 | |||
59 | if (gem->import_attach) | 53 | if (gem->import_attach) |
60 | drm_prime_gem_destroy(gem, nvbo->bo.sg); | 54 | drm_prime_gem_destroy(gem, nvbo->bo.sg); |
61 | 55 | ||