summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2012-11-21 11:06:22 +0100
committerThomas Hellstrom <thellstrom@vmware.com>2014-01-17 07:52:21 +0100
commit6da768aa66d2df9067b0bb694a6106bee3cb191f (patch)
tree3fdb6f8bdce75e0477b5e4283d2beb945795b7e0 /drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
parent3530bdc35e99c3823bc98deb09baed89c51d9f46 (diff)
downloadlinux-stable-6da768aa66d2df9067b0bb694a6106bee3cb191f.tar.gz
linux-stable-6da768aa66d2df9067b0bb694a6106bee3cb191f.tar.bz2
linux-stable-6da768aa66d2df9067b0bb694a6106bee3cb191f.zip
drm/vmwgfx: Hook up MOBs to TTM as a separate memory type
To bind a buffer object as a MOB, just validate it as a MOB memory type. We are reusing the GMRID manager, although we create a new instance of it to manage MOB ids and tomake sure we don't exceed the maximum amount of MOB pages. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
index c5c054ae9056..b1273e8e9a69 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
@@ -125,10 +125,21 @@ static int vmw_gmrid_man_init(struct ttm_mem_type_manager *man,
return -ENOMEM;
spin_lock_init(&gman->lock);
- gman->max_gmr_pages = dev_priv->max_gmr_pages;
gman->used_gmr_pages = 0;
ida_init(&gman->gmr_ida);
- gman->max_gmr_ids = p_size;
+
+ switch (p_size) {
+ case VMW_PL_GMR:
+ gman->max_gmr_ids = dev_priv->max_gmr_ids;
+ gman->max_gmr_pages = dev_priv->max_gmr_pages;
+ break;
+ case VMW_PL_MOB:
+ gman->max_gmr_ids = VMWGFX_NUM_MOB;
+ gman->max_gmr_pages = dev_priv->max_mob_pages;
+ break;
+ default:
+ BUG();
+ }
man->priv = (void *) gman;
return 0;
}