diff options
author | Marcin Slusarz <marcin.slusarz@gmail.com> | 2012-11-25 23:04:23 +0100 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-11-29 09:58:11 +1000 |
commit | 04c8c21085e13011a2eaf3ae518ab44e23e21917 (patch) | |
tree | eb7fe589503f248555e3fc7e33d071932c78dd86 /drivers/gpu/drm/nouveau/nv50_display.c | |
parent | 124ea297c8f0e0a3a567af0894fdbe05caaf80ec (diff) |
drm/nouveau: unpin various bo's before destroying
These objects leak VRAM - but only on module unload.
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nv50_display.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_display.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index b252dbe0f4e..35874085a61 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -1228,8 +1228,12 @@ nv50_crtc_destroy(struct drm_crtc *crtc) nv50_dmac_destroy(disp->core, &head->sync.base); nv50_pioc_destroy(disp->core, &head->curs.base); nouveau_bo_unmap(nv_crtc->cursor.nvbo); + if (nv_crtc->cursor.nvbo) + nouveau_bo_unpin(nv_crtc->cursor.nvbo); nouveau_bo_ref(NULL, &nv_crtc->cursor.nvbo); nouveau_bo_unmap(nv_crtc->lut.nvbo); + if (nv_crtc->lut.nvbo) + nouveau_bo_unpin(nv_crtc->lut.nvbo); nouveau_bo_ref(NULL, &nv_crtc->lut.nvbo); drm_crtc_cleanup(crtc); kfree(crtc); @@ -1300,8 +1304,11 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index) 0, 0x0000, NULL, &head->base.lut.nvbo); if (!ret) { ret = nouveau_bo_pin(head->base.lut.nvbo, TTM_PL_FLAG_VRAM); - if (!ret) + if (!ret) { ret = nouveau_bo_map(head->base.lut.nvbo); + if (ret) + nouveau_bo_unpin(head->base.lut.nvbo); + } if (ret) nouveau_bo_ref(NULL, &head->base.lut.nvbo); } @@ -1324,8 +1331,11 @@ nv50_crtc_create(struct drm_device *dev, struct nouveau_object *core, int index) 0, 0x0000, NULL, &head->base.cursor.nvbo); if (!ret) { ret = nouveau_bo_pin(head->base.cursor.nvbo, TTM_PL_FLAG_VRAM); - if (!ret) + if (!ret) { ret = nouveau_bo_map(head->base.cursor.nvbo); + if (ret) + nouveau_bo_unpin(head->base.lut.nvbo); + } if (ret) nouveau_bo_ref(NULL, &head->base.cursor.nvbo); } @@ -1917,6 +1927,8 @@ nv50_display_destroy(struct drm_device *dev) nv50_dmac_destroy(disp->core, &disp->mast.base); nouveau_bo_unmap(disp->sync); + if (disp->sync) + nouveau_bo_unpin(disp->sync); nouveau_bo_ref(NULL, &disp->sync); nouveau_display(dev)->priv = NULL; @@ -1957,8 +1969,11 @@ nv50_display_create(struct drm_device *dev) 0, 0x0000, NULL, &disp->sync); if (!ret) { ret = nouveau_bo_pin(disp->sync, TTM_PL_FLAG_VRAM); - if (!ret) + if (!ret) { ret = nouveau_bo_map(disp->sync); + if (ret) + nouveau_bo_unpin(disp->sync); + } if (ret) nouveau_bo_ref(NULL, &disp->sync); } |