Commit f3309105 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm/vram: Add infrastructure for move_notify()

This patch prepares VRAM helpers for lazy unmapping of buffer objects.
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarGerd Hoffmann <kraxel@redhat.com>
Acked-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Reported-and-tested-by: default avatarDavidlohr Bueso <dbueso@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20190906122056.32018-4-tzimmermann@suse.de
parent bc25bb91
...@@ -98,6 +98,17 @@ static int bo_driver_verify_access(struct ttm_buffer_object *bo, ...@@ -98,6 +98,17 @@ static int bo_driver_verify_access(struct ttm_buffer_object *bo,
return vmm->funcs->verify_access(bo, filp); return vmm->funcs->verify_access(bo, filp);
} }
static void bo_driver_move_notify(struct ttm_buffer_object *bo,
bool evict,
struct ttm_mem_reg *new_mem)
{
struct drm_vram_mm *vmm = drm_vram_mm_of_bdev(bo->bdev);
if (!vmm->funcs || !vmm->funcs->move_notify)
return;
vmm->funcs->move_notify(bo, evict, new_mem);
}
static int bo_driver_io_mem_reserve(struct ttm_bo_device *bdev, static int bo_driver_io_mem_reserve(struct ttm_bo_device *bdev,
struct ttm_mem_reg *mem) struct ttm_mem_reg *mem)
{ {
...@@ -140,6 +151,7 @@ static struct ttm_bo_driver bo_driver = { ...@@ -140,6 +151,7 @@ static struct ttm_bo_driver bo_driver = {
.eviction_valuable = ttm_bo_eviction_valuable, .eviction_valuable = ttm_bo_eviction_valuable,
.evict_flags = bo_driver_evict_flags, .evict_flags = bo_driver_evict_flags,
.verify_access = bo_driver_verify_access, .verify_access = bo_driver_verify_access,
.move_notify = bo_driver_move_notify,
.io_mem_reserve = bo_driver_io_mem_reserve, .io_mem_reserve = bo_driver_io_mem_reserve,
.io_mem_free = bo_driver_io_mem_free, .io_mem_free = bo_driver_io_mem_free,
}; };
......
...@@ -15,6 +15,8 @@ struct drm_device; ...@@ -15,6 +15,8 @@ struct drm_device;
&ttm_bo_driver.evict_flags &ttm_bo_driver.evict_flags
* @verify_access: Provides an implementation for \ * @verify_access: Provides an implementation for \
struct &ttm_bo_driver.verify_access struct &ttm_bo_driver.verify_access
* @move_notify: Provides an implementation for
* struct &ttm_bo_driver.move_notify
* *
* These callback function integrate VRAM MM with TTM buffer objects. New * These callback function integrate VRAM MM with TTM buffer objects. New
* functions can be added if necessary. * functions can be added if necessary.
...@@ -23,6 +25,8 @@ struct drm_vram_mm_funcs { ...@@ -23,6 +25,8 @@ struct drm_vram_mm_funcs {
void (*evict_flags)(struct ttm_buffer_object *bo, void (*evict_flags)(struct ttm_buffer_object *bo,
struct ttm_placement *placement); struct ttm_placement *placement);
int (*verify_access)(struct ttm_buffer_object *bo, struct file *filp); int (*verify_access)(struct ttm_buffer_object *bo, struct file *filp);
void (*move_notify)(struct ttm_buffer_object *bo, bool evict,
struct ttm_mem_reg *new_mem);
}; };
/** /**
......
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