summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_gem_vram_helper.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-10-06 10:06:43 +1000
committerDave Airlie <airlied@redhat.com>2020-10-07 15:41:58 +1000
commit2b8283ff1a60d201e92f0d48c4918a035dbe82fe (patch)
tree280b996512be5662d8897b838022646c620f1864 /drivers/gpu/drm/drm_gem_vram_helper.c
parentbcff5d3e3bab979d820bbabd3f0be13ae6ce6cf5 (diff)
downloadlinux-2b8283ff1a60d201e92f0d48c4918a035dbe82fe.tar.bz2
drm/vram_helper: implement a ttm move callback.
This will always do memcpy moves. Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201006000644.1005758-5-airlied@gmail.com
Diffstat (limited to 'drivers/gpu/drm/drm_gem_vram_helper.c')
-rw-r--r--drivers/gpu/drm/drm_gem_vram_helper.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c
index 3fe4b326e18e..3213429f8444 100644
--- a/drivers/gpu/drm/drm_gem_vram_helper.c
+++ b/drivers/gpu/drm/drm_gem_vram_helper.c
@@ -588,6 +588,14 @@ static void drm_gem_vram_bo_driver_move_notify(struct drm_gem_vram_object *gbo,
kmap->virtual = NULL;
}
+static int drm_gem_vram_bo_driver_move(struct drm_gem_vram_object *gbo,
+ bool evict,
+ struct ttm_operation_ctx *ctx,
+ struct ttm_resource *new_mem)
+{
+ return ttm_bo_move_memcpy(&gbo->bo, ctx, new_mem);
+}
+
/*
* Helpers for struct drm_gem_object_funcs
*/
@@ -950,6 +958,18 @@ static void bo_driver_move_notify(struct ttm_buffer_object *bo,
drm_gem_vram_bo_driver_move_notify(gbo, evict, new_mem);
}
+static int bo_driver_move(struct ttm_buffer_object *bo,
+ bool evict,
+ struct ttm_operation_ctx *ctx,
+ struct ttm_resource *new_mem)
+{
+ struct drm_gem_vram_object *gbo;
+
+ gbo = drm_gem_vram_of_bo(bo);
+
+ return drm_gem_vram_bo_driver_move(gbo, evict, ctx, new_mem);
+}
+
static int bo_driver_io_mem_reserve(struct ttm_bo_device *bdev,
struct ttm_resource *mem)
{
@@ -974,6 +994,7 @@ static struct ttm_bo_driver bo_driver = {
.ttm_tt_destroy = bo_driver_ttm_tt_destroy,
.eviction_valuable = ttm_bo_eviction_valuable,
.evict_flags = bo_driver_evict_flags,
+ .move = bo_driver_move,
.move_notify = bo_driver_move_notify,
.io_mem_reserve = bo_driver_io_mem_reserve,
};