summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_gem_vram_helper.c
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2019-05-21 13:08:29 +0200
committerGerd Hoffmann <kraxel@redhat.com>2019-05-22 12:43:29 +0200
commit81da87f63a1edebcf8cbb811d387e353d9f89c7a (patch)
tree9838a67ed18ddb9b4d76dc9feadb9582a0d18843 /drivers/gpu/drm/drm_gem_vram_helper.c
parent982c0500fd1a8012c31d3c9dd8de285129904656 (diff)
drm: Replace drm_gem_vram_push_to_system() with kunmap + unpin
The push-to-system function forces a buffer out of video RAM. This decision should rather be made by the memory manager. By replacing the function with calls to the kunmap and unpin functions, the buffer's memory becomes available, but the buffer remains in VRAM until it's evicted by a pin operation. This patch replaces the remaining instances of drm_gem_vram_push_to_system() in ast and mgag200, and removes the function from DRM. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/20190521110831.20200-2-tzimmermann@suse.de Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_gem_vram_helper.c')
-rw-r--r--drivers/gpu/drm/drm_gem_vram_helper.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
index bde8237e8021..b341b70832be 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -380,56 +380,6 @@ int drm_gem_vram_unpin_reserved(struct drm_gem_vram_object *gbo)
EXPORT_SYMBOL(drm_gem_vram_unpin_reserved);
/**
- * drm_gem_vram_push_to_system() - \
- Unpins a GEM VRAM object and moves it to system memory
- * @gbo: the GEM VRAM object
- *
- * This operation only works if the caller holds the final pin on the
- * buffer object.
- *
- * Returns:
- * 0 on success, or
- * a negative error code otherwise.
- */
-int drm_gem_vram_push_to_system(struct drm_gem_vram_object *gbo)
-{
- int i, ret;
- struct ttm_operation_ctx ctx = { false, false };
-
- ret = ttm_bo_reserve(&gbo->bo, true, false, NULL);
- if (ret < 0)
- return ret;
-
- if (WARN_ON_ONCE(!gbo->pin_count))
- goto out;
-
- --gbo->pin_count;
- if (gbo->pin_count)
- goto out;
-
- if (gbo->kmap.virtual)
- ttm_bo_kunmap(&gbo->kmap);
-
- drm_gem_vram_placement(gbo, TTM_PL_FLAG_SYSTEM);
- for (i = 0; i < gbo->placement.num_placement ; ++i)
- gbo->placements[i].flags |= TTM_PL_FLAG_NO_EVICT;
-
- ret = ttm_bo_validate(&gbo->bo, &gbo->placement, &ctx);
- if (ret)
- goto err_ttm_bo_unreserve;
-
-out:
- ttm_bo_unreserve(&gbo->bo);
-
- return 0;
-
-err_ttm_bo_unreserve:
- ttm_bo_unreserve(&gbo->bo);
- return ret;
-}
-EXPORT_SYMBOL(drm_gem_vram_push_to_system);
-
-/**
* drm_gem_vram_kmap_at() - Maps a GEM VRAM object into kernel address space
* @gbo: the GEM VRAM object
* @map: establish a mapping if necessary