diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
index a60e560804e0..ce845be49153 100644
--- a/drivers/gpu/drm/ttm/Makefile
+++ b/drivers/gpu/drm/ttm/Makefile
@@ -4,7 +4,7 @@
 
 ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \
 	ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
-	ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
+	ttm_execbuf_util.o ttm_page_alloc.o \
 	ttm_bo_manager.o ttm_page_alloc_dma.o
 ttm-$(CONFIG_AGP) += ttm_agp_backend.o
 
diff --git a/drivers/gpu/drm/vmwgfx/Makefile b/drivers/gpu/drm/vmwgfx/Makefile
index ad80211e1098..a352ee85cc2b 100644
--- a/drivers/gpu/drm/vmwgfx/Makefile
+++ b/drivers/gpu/drm/vmwgfx/Makefile
@@ -7,6 +7,6 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \
 	    vmwgfx_surface.o vmwgfx_prime.o vmwgfx_mob.o vmwgfx_shader.o \
 	    vmwgfx_cmdbuf_res.o vmwgfx_cmdbuf.o vmwgfx_stdu.o \
 	    vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \
-	    vmwgfx_simple_resource.o vmwgfx_va.o
+	    vmwgfx_simple_resource.o vmwgfx_va.o vmwgfx_object.o vmwgfx_lock.o
 
 obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
index 22231bc9e845..49c997251126 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_buffer.c
@@ -775,7 +775,7 @@ static void vmw_evict_flags(struct ttm_buffer_object *bo,
 
 static int vmw_verify_access(struct ttm_buffer_object *bo, struct file *filp)
 {
-	struct ttm_object_file *tfile =
+	struct vmwgfx_object_file *tfile =
 		vmw_fpriv((struct drm_file *)filp->private_data)->tfile;
 
 	return vmw_user_dmabuf_verify_access(bo, tfile);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
index 3767ac335aca..6d2a16982ee3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_context.c
@@ -32,7 +32,7 @@
 #include "vmwgfx_binding.h"
 
 struct vmw_user_context {
-	struct ttm_base_object base;
+	struct vmwgfx_base_object base;
 	struct vmw_resource res;
 	struct vmw_ctx_binding_state *cbs;
 	struct vmw_cmdbuf_res_manager *man;
@@ -43,7 +43,7 @@ struct vmw_user_context {
 
 static void vmw_user_context_free(struct vmw_resource *res);
 static struct vmw_resource *
-vmw_user_context_base_to_res(struct ttm_base_object *base);
+vmw_user_context_base_to_res(struct vmwgfx_base_object *base);
 
 static int vmw_gb_context_create(struct vmw_resource *res);
 static int vmw_gb_context_bind(struct vmw_resource *res,
@@ -691,7 +691,7 @@ static int vmw_dx_context_destroy(struct vmw_resource *res)
  */
 
 static struct vmw_resource *
-vmw_user_context_base_to_res(struct ttm_base_object *base)
+vmw_user_context_base_to_res(struct vmwgfx_base_object *base)
 {
 	return &(container_of(base, struct vmw_user_context, base)->res);
 }
@@ -707,7 +707,7 @@ static void vmw_user_context_free(struct vmw_resource *res)
 
 	(void) vmw_context_bind_dx_query(res, NULL);
 
-	ttm_base_object_kfree(ctx, base);
+	vmwgfx_base_object_kfree(ctx, base);
 	ttm_mem_global_free(vmw_mem_glob(dev_priv),
 			    vmw_user_context_size);
 }
@@ -717,9 +717,9 @@ static void vmw_user_context_free(struct vmw_resource *res)
  * base object. It releases the base-object's reference on the resource object.
  */
 
-static void vmw_user_context_base_release(struct ttm_base_object **p_base)
+static void vmw_user_context_base_release(struct vmwgfx_base_object **p_base)
 {
-	struct ttm_base_object *base = *p_base;
+	struct vmwgfx_base_object *base = *p_base;
 	struct vmw_user_context *ctx =
 	    container_of(base, struct vmw_user_context, base);
 	struct vmw_resource *res = &ctx->res;
@@ -732,9 +732,9 @@ int vmw_context_destroy_ioctl(struct drm_device *dev, void *data,
 			      struct drm_file *file_priv)
 {
 	struct drm_vmw_context_arg *arg = (struct drm_vmw_context_arg *)data;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 
-	return ttm_ref_object_base_unref(tfile, arg->cid, TTM_REF_USAGE);
+	return vmwgfx_ref_object_base_unref(tfile, arg->cid, VMWGFX_REF_USAGE);
 }
 
 static int vmw_context_define(struct drm_device *dev, void *data,
@@ -745,7 +745,7 @@ static int vmw_context_define(struct drm_device *dev, void *data,
 	struct vmw_resource *res;
 	struct vmw_resource *tmp;
 	struct drm_vmw_context_arg *arg = (struct drm_vmw_context_arg *)data;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct ttm_operation_ctx ttm_opt_ctx = {
 		.interruptible = true,
 		.no_wait_gpu = false
@@ -766,7 +766,7 @@ static int vmw_context_define(struct drm_device *dev, void *data,
 		vmw_user_context_size = ttm_round_pot(sizeof(*ctx)) + 128 +
 		  ((dev_priv->has_mob) ? vmw_cmdbuf_res_man_size() : 0);
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0))
 		return ret;
 
@@ -801,7 +801,7 @@ static int vmw_context_define(struct drm_device *dev, void *data,
 		goto out_unlock;
 
 	tmp = vmw_resource_reference(&ctx->res);
-	ret = ttm_base_object_init(tfile, &ctx->base, false, VMW_RES_CONTEXT,
+	ret = vmwgfx_base_object_init(tfile, &ctx->base, false, VMW_RES_CONTEXT,
 				   &vmw_user_context_base_release, NULL);
 
 	if (unlikely(ret != 0)) {
@@ -813,7 +813,7 @@ static int vmw_context_define(struct drm_device *dev, void *data,
 out_err:
 	vmw_resource_unreference(&res);
 out_unlock:
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 	return ret;
 }
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
index d45d2caffa5a..3784af7b0f66 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c
@@ -52,7 +52,7 @@ int vmw_dmabuf_pin_in_placement(struct vmw_private *dev_priv,
 	int ret;
 	uint32_t new_flags;
 
-	ret = ttm_write_lock(&dev_priv->reservation_sem, interruptible);
+	ret = vmwgfx_write_lock(&dev_priv->reservation_sem, interruptible);
 	if (unlikely(ret != 0))
 		return ret;
 
@@ -74,7 +74,7 @@ int vmw_dmabuf_pin_in_placement(struct vmw_private *dev_priv,
 	ttm_bo_unreserve(bo);
 
 err:
-	ttm_write_unlock(&dev_priv->reservation_sem);
+	vmwgfx_write_unlock(&dev_priv->reservation_sem);
 	return ret;
 }
 
@@ -101,7 +101,7 @@ int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private *dev_priv,
 	int ret;
 	uint32_t new_flags;
 
-	ret = ttm_write_lock(&dev_priv->reservation_sem, interruptible);
+	ret = vmwgfx_write_lock(&dev_priv->reservation_sem, interruptible);
 	if (unlikely(ret != 0))
 		return ret;
 
@@ -129,7 +129,7 @@ int vmw_dmabuf_pin_in_vram_or_gmr(struct vmw_private *dev_priv,
 
 	ttm_bo_unreserve(bo);
 err:
-	ttm_write_unlock(&dev_priv->reservation_sem);
+	vmwgfx_write_unlock(&dev_priv->reservation_sem);
 	return ret;
 }
 
@@ -185,7 +185,7 @@ int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private *dev_priv,
 	placement.num_busy_placement = 1;
 	placement.busy_placement = &place;
 
-	ret = ttm_write_lock(&dev_priv->reservation_sem, interruptible);
+	ret = vmwgfx_write_lock(&dev_priv->reservation_sem, interruptible);
 	if (unlikely(ret != 0))
 		return ret;
 
@@ -220,7 +220,7 @@ int vmw_dmabuf_pin_in_start_of_vram(struct vmw_private *dev_priv,
 
 	ttm_bo_unreserve(bo);
 err_unlock:
-	ttm_write_unlock(&dev_priv->reservation_sem);
+	vmwgfx_write_unlock(&dev_priv->reservation_sem);
 
 	return ret;
 }
@@ -244,7 +244,7 @@ int vmw_dmabuf_unpin(struct vmw_private *dev_priv,
 	struct ttm_buffer_object *bo = &buf->base;
 	int ret;
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, interruptible);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, interruptible);
 	if (unlikely(ret != 0))
 		return ret;
 
@@ -257,7 +257,7 @@ int vmw_dmabuf_unpin(struct vmw_private *dev_priv,
 	ttm_bo_unreserve(bo);
 
 err:
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 	return ret;
 }
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 184340d486c3..e18f65b0daed 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -30,9 +30,9 @@
 #include <drm/drmP.h>
 #include "vmwgfx_drv.h"
 #include "vmwgfx_binding.h"
+#include "vmwgfx_object.h"
 #include <drm/ttm/ttm_placement.h>
 #include <drm/ttm/ttm_bo_driver.h>
-#include <drm/ttm/ttm_object.h>
 #include <drm/ttm/ttm_module.h>
 #include <linux/dma_remapping.h>
 
@@ -644,7 +644,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 	mutex_init(&dev_priv->binding_mutex);
 	mutex_init(&dev_priv->global_kms_state_mutex);
 	rwlock_init(&dev_priv->resource_lock);
-	ttm_lock_init(&dev_priv->reservation_sem);
+	vmwgfx_lock_init(&dev_priv->reservation_sem);
 	spin_lock_init(&dev_priv->hw_lock);
 	spin_lock_init(&dev_priv->waiter_lock);
 	spin_lock_init(&dev_priv->cap_lock);
@@ -775,7 +775,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 
 
 	vmw_master_init(&dev_priv->fbdev_master);
-	ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM);
+	vmwgfx_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM);
 	dev_priv->active_master = &dev_priv->fbdev_master;
 
 	dev_priv->mmio_virt = memremap(dev_priv->mmio_start,
@@ -796,7 +796,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 		goto out_err4;
 	}
 
-	dev_priv->tdev = ttm_object_device_init
+	dev_priv->tdev = vmwgfx_object_device_init
 		(dev_priv->mem_global_ref.object, 12, &vmw_prime_dmabuf_ops);
 
 	if (unlikely(dev_priv->tdev == NULL)) {
@@ -943,7 +943,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
 	else
 		pci_release_regions(dev->pdev);
 out_no_device:
-	ttm_object_device_release(&dev_priv->tdev);
+	vmwgfx_object_device_release(&dev_priv->tdev);
 out_err4:
 	memunmap(dev_priv->mmio_virt);
 out_err3:
@@ -995,7 +995,7 @@ static void vmw_driver_unload(struct drm_device *dev)
 	else
 		pci_release_regions(dev->pdev);
 
-	ttm_object_device_release(&dev_priv->tdev);
+	vmwgfx_object_device_release(&dev_priv->tdev);
 	memunmap(dev_priv->mmio_virt);
 	if (dev_priv->ctx.staged_bindings)
 		vmw_binding_state_free(dev_priv->ctx.staged_bindings);
@@ -1018,12 +1018,12 @@ static void vmw_postclose(struct drm_device *dev,
 		struct vmw_master *vmaster =
 			vmw_master(vmw_fp->locked_master);
 
-		ttm_lock_set_kill(&vmaster->lock, true, SIGTERM);
-		ttm_vt_unlock(&vmaster->lock);
+		vmwgfx_lock_set_kill(&vmaster->lock, true, SIGTERM);
+		vmwgfx_vt_unlock(&vmaster->lock);
 		drm_master_put(&vmw_fp->locked_master);
 	}
 
-	ttm_object_file_release(&vmw_fp->tfile);
+	vmwgfx_object_file_release(&vmw_fp->tfile);
 	kfree(vmw_fp);
 }
 
@@ -1037,7 +1037,7 @@ static int vmw_driver_open(struct drm_device *dev, struct drm_file *file_priv)
 	if (unlikely(!vmw_fp))
 		return ret;
 
-	vmw_fp->tfile = ttm_object_file_init(dev_priv->tdev, 10);
+	vmw_fp->tfile = vmwgfx_object_file_init(dev_priv->tdev, 10);
 	if (unlikely(vmw_fp->tfile == NULL))
 		goto out_no_tfile;
 
@@ -1092,7 +1092,7 @@ static struct vmw_master *vmw_master_check(struct drm_device *dev,
 	 * authenticating master exits.
 	 */
 	vmaster = vmw_master(file_priv->master);
-	ret = ttm_read_lock(&vmaster->lock, true);
+	ret = vmwgfx_read_lock(&vmaster->lock, true);
 	if (unlikely(ret != 0))
 		vmaster = ERR_PTR(ret);
 
@@ -1155,7 +1155,7 @@ static long vmw_generic_ioctl(struct file *filp, unsigned int cmd,
 
 	ret = ioctl_func(filp, cmd, arg);
 	if (vmaster)
-		ttm_read_unlock(&vmaster->lock);
+		vmwgfx_read_unlock(&vmaster->lock);
 
 	return ret;
 
@@ -1186,7 +1186,7 @@ static void vmw_lastclose(struct drm_device *dev)
 
 static void vmw_master_init(struct vmw_master *vmaster)
 {
-	ttm_lock_init(&vmaster->lock);
+	vmwgfx_lock_init(&vmaster->lock);
 }
 
 static int vmw_master_create(struct drm_device *dev,
@@ -1199,7 +1199,7 @@ static int vmw_master_create(struct drm_device *dev,
 		return -ENOMEM;
 
 	vmw_master_init(vmaster);
-	ttm_lock_set_kill(&vmaster->lock, true, SIGTERM);
+	vmwgfx_lock_set_kill(&vmaster->lock, true, SIGTERM);
 	master->driver_priv = vmaster;
 
 	return 0;
@@ -1226,17 +1226,17 @@ static int vmw_master_set(struct drm_device *dev,
 
 	if (active) {
 		BUG_ON(active != &dev_priv->fbdev_master);
-		ret = ttm_vt_lock(&active->lock, false, vmw_fp->tfile);
+		ret = vmwgfx_vt_lock(&active->lock, false, vmw_fp->tfile);
 		if (unlikely(ret != 0))
 			return ret;
 
-		ttm_lock_set_kill(&active->lock, true, SIGTERM);
+		vmwgfx_lock_set_kill(&active->lock, true, SIGTERM);
 		dev_priv->active_master = NULL;
 	}
 
-	ttm_lock_set_kill(&vmaster->lock, false, SIGTERM);
+	vmwgfx_lock_set_kill(&vmaster->lock, false, SIGTERM);
 	if (!from_open) {
-		ttm_vt_unlock(&vmaster->lock);
+		vmwgfx_vt_unlock(&vmaster->lock);
 		BUG_ON(vmw_fp->locked_master != file_priv->master);
 		drm_master_put(&vmw_fp->locked_master);
 	}
@@ -1261,21 +1261,21 @@ static void vmw_master_drop(struct drm_device *dev,
 	 */
 
 	vmw_fp->locked_master = drm_master_get(file_priv->master);
-	ret = ttm_vt_lock(&vmaster->lock, false, vmw_fp->tfile);
+	ret = vmwgfx_vt_lock(&vmaster->lock, false, vmw_fp->tfile);
 	vmw_kms_legacy_hotspot_clear(dev_priv);
 	if (unlikely((ret != 0))) {
 		DRM_ERROR("Unable to lock TTM at VT switch.\n");
 		drm_master_put(&vmw_fp->locked_master);
 	}
 
-	ttm_lock_set_kill(&vmaster->lock, false, SIGTERM);
+	vmwgfx_lock_set_kill(&vmaster->lock, false, SIGTERM);
 
 	if (!dev_priv->enable_fb)
 		vmw_svga_disable(dev_priv);
 
 	dev_priv->active_master = &dev_priv->fbdev_master;
-	ttm_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM);
-	ttm_vt_unlock(&dev_priv->fbdev_master.lock);
+	vmwgfx_lock_set_kill(&dev_priv->fbdev_master.lock, false, SIGTERM);
+	vmwgfx_vt_unlock(&dev_priv->fbdev_master.lock);
 
 	if (dev_priv->enable_fb)
 		vmw_fb_on(dev_priv);
@@ -1304,9 +1304,9 @@ static void __vmw_svga_enable(struct vmw_private *dev_priv)
  */
 void vmw_svga_enable(struct vmw_private *dev_priv)
 {
-	(void) ttm_read_lock(&dev_priv->reservation_sem, false);
+	(void) vmwgfx_read_lock(&dev_priv->reservation_sem, false);
 	__vmw_svga_enable(dev_priv);
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 }
 
 /**
@@ -1337,7 +1337,7 @@ static void __vmw_svga_disable(struct vmw_private *dev_priv)
  */
 void vmw_svga_disable(struct vmw_private *dev_priv)
 {
-	ttm_write_lock(&dev_priv->reservation_sem, false);
+	vmwgfx_write_lock(&dev_priv->reservation_sem, false);
 	spin_lock(&dev_priv->svga_lock);
 	if (dev_priv->bdev.man[TTM_PL_VRAM].use_type) {
 		dev_priv->bdev.man[TTM_PL_VRAM].use_type = false;
@@ -1349,7 +1349,7 @@ void vmw_svga_disable(struct vmw_private *dev_priv)
 			  SVGA_REG_ENABLE_ENABLE);
 	} else
 		spin_unlock(&dev_priv->svga_lock);
-	ttm_write_unlock(&dev_priv->reservation_sem);
+	vmwgfx_write_unlock(&dev_priv->reservation_sem);
 }
 
 static void vmw_remove(struct pci_dev *pdev)
@@ -1370,7 +1370,7 @@ static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
 	case PM_HIBERNATION_PREPARE:
 		if (dev_priv->enable_fb)
 			vmw_fb_off(dev_priv);
-		ttm_suspend_lock(&dev_priv->reservation_sem);
+		vmwgfx_suspend_lock(&dev_priv->reservation_sem);
 
 		/*
 		 * This empties VRAM and unbinds all GMR bindings.
@@ -1385,7 +1385,7 @@ static int vmwgfx_pm_notifier(struct notifier_block *nb, unsigned long val,
 	case PM_POST_HIBERNATION:
 	case PM_POST_RESTORE:
 		vmw_fence_fifo_up(dev_priv->fman);
-		ttm_suspend_unlock(&dev_priv->reservation_sem);
+		vmwgfx_suspend_unlock(&dev_priv->reservation_sem);
 		if (dev_priv->enable_fb)
 			vmw_fb_on(dev_priv);
 		break;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index 7e5f30e234b1..2b995d3338f7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -35,10 +35,10 @@
 #include <drm/drm_auth.h>
 #include <linux/suspend.h>
 #include <drm/ttm/ttm_bo_driver.h>
-#include <drm/ttm/ttm_object.h>
-#include <drm/ttm/ttm_lock.h>
 #include <drm/ttm/ttm_execbuf_util.h>
 #include <drm/ttm/ttm_module.h>
+#include "vmwgfx_object.h"
+#include "vmwgfx_lock.h"
 #include "vmwgfx_fence.h"
 #include <linux/sync_file.h>
 
@@ -74,15 +74,15 @@
 #define VMW_PL_MOB (TTM_PL_PRIV + 1)
 #define VMW_PL_FLAG_MOB (TTM_PL_FLAG_PRIV << 1)
 
-#define VMW_RES_CONTEXT ttm_driver_type0
-#define VMW_RES_SURFACE ttm_driver_type1
-#define VMW_RES_STREAM ttm_driver_type2
-#define VMW_RES_FENCE ttm_driver_type3
-#define VMW_RES_SHADER ttm_driver_type4
+#define VMW_RES_CONTEXT vmwgfx_driver_type0
+#define VMW_RES_SURFACE vmwgfx_driver_type1
+#define VMW_RES_STREAM vmwgfx_driver_type2
+#define VMW_RES_FENCE vmwgfx_driver_type3
+#define VMW_RES_SHADER vmwgfx_driver_type4
 
 struct vmw_fpriv {
 	struct drm_master *locked_master;
-	struct ttm_object_file *tfile;
+	struct vmwgfx_object_file *tfile;
 	bool gb_aware;
 };
 
@@ -322,7 +322,7 @@ struct vmw_legacy_display;
 struct vmw_overlay;
 
 struct vmw_master {
-	struct ttm_lock lock;
+	struct vmwgfx_lock lock;
 };
 
 struct vmw_vga_topology_state {
@@ -441,7 +441,7 @@ struct vmw_private {
 	 * contexts.
 	 */
 
-	struct ttm_object_device *tdev;
+	struct vmwgfx_object_device *tdev;
 
 	/*
 	 * Fencing and IRQs.
@@ -503,7 +503,7 @@ struct vmw_private {
 	/*
 	 * Replace this with an rwsem as soon as we have down_xx_interruptible()
 	 */
-	struct ttm_lock reservation_sem;
+	struct vmwgfx_lock reservation_sem;
 
 	/*
 	 * Query processing. These members
@@ -617,13 +617,13 @@ extern int vmw_resource_reserve(struct vmw_resource *res, bool interruptible,
 				bool no_backup);
 extern bool vmw_resource_needs_backup(const struct vmw_resource *res);
 extern int vmw_user_lookup_handle(struct vmw_private *dev_priv,
-				  struct ttm_object_file *tfile,
+				  struct vmwgfx_object_file *tfile,
 				  uint32_t handle,
 				  struct vmw_surface **out_surf,
 				  struct vmw_dma_buffer **out_buf);
 extern int vmw_user_resource_lookup_handle(
 	struct vmw_private *dev_priv,
-	struct ttm_object_file *tfile,
+	struct vmwgfx_object_file *tfile,
 	uint32_t handle,
 	const struct vmw_user_resource_conv *converter,
 	struct vmw_resource **p_res);
@@ -634,15 +634,15 @@ extern int vmw_dmabuf_init(struct vmw_private *dev_priv,
 			   bool interuptable,
 			   void (*bo_free) (struct ttm_buffer_object *bo));
 extern int vmw_user_dmabuf_verify_access(struct ttm_buffer_object *bo,
-				  struct ttm_object_file *tfile);
+				  struct vmwgfx_object_file *tfile);
 extern int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv,
-				 struct ttm_object_file *tfile,
+				 struct vmwgfx_object_file *tfile,
 				 uint32_t size,
 				 bool shareable,
 				 uint32_t *handle,
 				 struct vmw_dma_buffer **p_dma_buf,
-				 struct ttm_base_object **p_base);
-extern int vmw_user_dmabuf_reference(struct ttm_object_file *tfile,
+				 struct vmwgfx_base_object **p_base);
+extern int vmw_user_dmabuf_reference(struct vmwgfx_object_file *tfile,
 				     struct vmw_dma_buffer *dma_buf,
 				     uint32_t *handle);
 extern int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data,
@@ -654,15 +654,15 @@ extern int vmw_user_dmabuf_synccpu_ioctl(struct drm_device *dev, void *data,
 extern uint32_t vmw_dmabuf_validate_node(struct ttm_buffer_object *bo,
 					 uint32_t cur_validate_node);
 extern void vmw_dmabuf_validate_clear(struct ttm_buffer_object *bo);
-extern int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile,
+extern int vmw_user_dmabuf_lookup(struct vmwgfx_object_file *tfile,
 				  uint32_t id, struct vmw_dma_buffer **out,
-				  struct ttm_base_object **base);
+				  struct vmwgfx_base_object **base);
 extern int vmw_stream_claim_ioctl(struct drm_device *dev, void *data,
 				  struct drm_file *file_priv);
 extern int vmw_stream_unref_ioctl(struct drm_device *dev, void *data,
 				  struct drm_file *file_priv);
 extern int vmw_user_stream_lookup(struct vmw_private *dev_priv,
-				  struct ttm_object_file *tfile,
+				  struct vmwgfx_object_file *tfile,
 				  uint32_t *inout_id,
 				  struct vmw_resource **out);
 extern void vmw_resource_unreserve(struct vmw_resource *res,
@@ -915,7 +915,7 @@ int vmw_kms_cursor_bypass_ioctl(struct drm_device *dev, void *data,
 				struct drm_file *file_priv);
 void vmw_kms_cursor_post_execbuf(struct vmw_private *dev_priv);
 void vmw_kms_cursor_snoop(struct vmw_surface *srf,
-			  struct ttm_object_file *tfile,
+			  struct vmwgfx_object_file *tfile,
 			  struct ttm_buffer_object *bo,
 			  SVGA3dCmdHeader *header);
 int vmw_kms_write_svga(struct vmw_private *vmw_priv,
@@ -1009,7 +1009,7 @@ extern void vmw_otables_takedown(struct vmw_private *dev_priv);
 extern const struct vmw_user_resource_conv *user_context_converter;
 
 extern int vmw_context_check(struct vmw_private *dev_priv,
-			     struct ttm_object_file *tfile,
+			     struct vmwgfx_object_file *tfile,
 			     int id,
 			     struct vmw_resource **p_res);
 extern int vmw_context_define_ioctl(struct drm_device *dev, void *data,
@@ -1053,7 +1053,7 @@ extern int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
 extern int vmw_gb_surface_reference_ioctl(struct drm_device *dev, void *data,
 					  struct drm_file *file_priv);
 extern int vmw_surface_check(struct vmw_private *dev_priv,
-			     struct ttm_object_file *tfile,
+			     struct vmwgfx_object_file *tfile,
 			     uint32_t handle, int *id);
 extern int vmw_surface_validate(struct vmw_private *dev_priv,
 				struct vmw_surface *srf);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index b700667f6f0b..1a5ee5ff0603 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -3889,8 +3889,8 @@ vmw_execbuf_copy_fence_user(struct vmw_private *dev_priv,
 			fence_rep.fd = -1;
 		}
 
-		ttm_ref_object_base_unref(vmw_fp->tfile,
-					  fence_handle, TTM_REF_USAGE);
+		vmwgfx_ref_object_base_unref(vmw_fp->tfile,
+					  fence_handle, VMWGFX_REF_USAGE);
 		DRM_ERROR("Fence copy error. Syncing.\n");
 		(void) vmw_fence_obj_wait(fence, false, false,
 					  VMW_FENCE_WAIT_TIMEOUT);
@@ -4523,7 +4523,7 @@ int vmw_execbuf_ioctl(struct drm_device *dev, unsigned long data,
 			goto out;
 	}
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0))
 		return ret;
 
@@ -4534,7 +4534,7 @@ int vmw_execbuf_ioctl(struct drm_device *dev, unsigned long data,
 				  (void __user *)(unsigned long)arg.fence_rep,
 				  NULL,
 				  arg.flags);
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 	if (unlikely(ret != 0))
 		goto out;
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
index d23a18aae476..fc3701d9e996 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c
@@ -378,7 +378,7 @@ static int vmw_fb_create_bo(struct vmw_private *vmw_priv,
 	struct vmw_dma_buffer *vmw_bo;
 	int ret;
 
-	(void) ttm_write_lock(&vmw_priv->reservation_sem, false);
+	(void) vmwgfx_write_lock(&vmw_priv->reservation_sem, false);
 
 	vmw_bo = kmalloc(sizeof(*vmw_bo), GFP_KERNEL);
 	if (!vmw_bo) {
@@ -394,12 +394,12 @@ static int vmw_fb_create_bo(struct vmw_private *vmw_priv,
 		goto err_unlock; /* init frees the buffer on failure */
 
 	*out = vmw_bo;
-	ttm_write_unlock(&vmw_priv->reservation_sem);
+	vmwgfx_write_unlock(&vmw_priv->reservation_sem);
 
 	return 0;
 
 err_unlock:
-	ttm_write_unlock(&vmw_priv->reservation_sem);
+	vmwgfx_write_unlock(&vmw_priv->reservation_sem);
 	return ret;
 }
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
index 6c5c75cf5e6c..247ec72a8921 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
@@ -50,7 +50,7 @@ struct vmw_fence_manager {
 };
 
 struct vmw_user_fence {
-	struct ttm_base_object base;
+	struct vmwgfx_base_object base;
 	struct vmw_fence_obj fence;
 };
 
@@ -559,7 +559,7 @@ static void vmw_user_fence_destroy(struct vmw_fence_obj *fence)
 		container_of(fence, struct vmw_user_fence, fence);
 	struct vmw_fence_manager *fman = fman_from_fence(fence);
 
-	ttm_base_object_kfree(ufence, base);
+	vmwgfx_base_object_kfree(ufence, base);
 	/*
 	 * Free kernel space accounting.
 	 */
@@ -567,9 +567,9 @@ static void vmw_user_fence_destroy(struct vmw_fence_obj *fence)
 			    fman->user_fence_size);
 }
 
-static void vmw_user_fence_base_release(struct ttm_base_object **p_base)
+static void vmw_user_fence_base_release(struct vmwgfx_base_object **p_base)
 {
-	struct ttm_base_object *base = *p_base;
+	struct vmwgfx_base_object *base = *p_base;
 	struct vmw_user_fence *ufence =
 		container_of(base, struct vmw_user_fence, base);
 	struct vmw_fence_obj *fence = &ufence->fence;
@@ -584,7 +584,7 @@ int vmw_user_fence_create(struct drm_file *file_priv,
 			  struct vmw_fence_obj **p_fence,
 			  uint32_t *p_handle)
 {
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct vmw_user_fence *ufence;
 	struct vmw_fence_obj *tmp;
 	struct ttm_mem_global *mem_glob = vmw_mem_glob(fman->dev_priv);
@@ -622,7 +622,7 @@ int vmw_user_fence_create(struct drm_file *file_priv,
 	 * vmw_user_fence_base_release.
 	 */
 	tmp = vmw_fence_obj_reference(&ufence->fence);
-	ret = ttm_base_object_init(tfile, &ufence->base, false,
+	ret = vmwgfx_base_object_init(tfile, &ufence->base, false,
 				   VMW_RES_FENCE,
 				   &vmw_user_fence_base_release, NULL);
 
@@ -746,7 +746,7 @@ void vmw_fence_fifo_up(struct vmw_fence_manager *fman)
 /**
  * vmw_fence_obj_lookup - Look up a user-space fence object
  *
- * @tfile: A struct ttm_object_file identifying the caller.
+ * @tfile: A struct vmwgfx_object_file identifying the caller.
  * @handle: A handle identifying the fence object.
  * @return: A struct vmw_user_fence base ttm object on success or
  * an error pointer on failure.
@@ -756,10 +756,10 @@ void vmw_fence_fifo_up(struct vmw_fence_manager *fman)
  * creation and fence objects aren't shareable, that's not an
  * issue currently.
  */
-static struct ttm_base_object *
-vmw_fence_obj_lookup(struct ttm_object_file *tfile, u32 handle)
+static struct vmwgfx_base_object *
+vmw_fence_obj_lookup(struct vmwgfx_object_file *tfile, u32 handle)
 {
-	struct ttm_base_object *base = ttm_base_object_lookup(tfile, handle);
+	struct vmwgfx_base_object *base = vmwgfx_base_object_lookup(tfile, handle);
 
 	if (!base) {
 		pr_err("Invalid fence object handle 0x%08lx.\n",
@@ -770,7 +770,7 @@ vmw_fence_obj_lookup(struct ttm_object_file *tfile, u32 handle)
 	if (base->refcount_release != vmw_user_fence_base_release) {
 		pr_err("Invalid fence object handle 0x%08lx.\n",
 		       (unsigned long)handle);
-		ttm_base_object_unref(&base);
+		vmwgfx_base_object_unref(&base);
 		return ERR_PTR(-EINVAL);
 	}
 
@@ -784,9 +784,9 @@ int vmw_fence_obj_wait_ioctl(struct drm_device *dev, void *data,
 	struct drm_vmw_fence_wait_arg *arg =
 	    (struct drm_vmw_fence_wait_arg *)data;
 	unsigned long timeout;
-	struct ttm_base_object *base;
+	struct vmwgfx_base_object *base;
 	struct vmw_fence_obj *fence;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	int ret;
 	uint64_t wait_timeout = ((uint64_t)arg->timeout_us * HZ);
 
@@ -821,15 +821,15 @@ int vmw_fence_obj_wait_ioctl(struct drm_device *dev, void *data,
 	ret = vmw_fence_obj_wait(fence, arg->lazy, true, timeout);
 
 out:
-	ttm_base_object_unref(&base);
+	vmwgfx_base_object_unref(&base);
 
 	/*
 	 * Optionally unref the fence object.
 	 */
 
 	if (ret == 0 && (arg->wait_options & DRM_VMW_WAIT_OPTION_UNREF))
-		return ttm_ref_object_base_unref(tfile, arg->handle,
-						 TTM_REF_USAGE);
+		return vmwgfx_ref_object_base_unref(tfile, arg->handle,
+						 VMWGFX_REF_USAGE);
 	return ret;
 }
 
@@ -838,10 +838,10 @@ int vmw_fence_obj_signaled_ioctl(struct drm_device *dev, void *data,
 {
 	struct drm_vmw_fence_signaled_arg *arg =
 		(struct drm_vmw_fence_signaled_arg *) data;
-	struct ttm_base_object *base;
+	struct vmwgfx_base_object *base;
 	struct vmw_fence_obj *fence;
 	struct vmw_fence_manager *fman;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct vmw_private *dev_priv = vmw_priv(dev);
 
 	base = vmw_fence_obj_lookup(tfile, arg->handle);
@@ -858,7 +858,7 @@ int vmw_fence_obj_signaled_ioctl(struct drm_device *dev, void *data,
 	arg->passed_seqno = dev_priv->last_read_seqno;
 	spin_unlock(&fman->lock);
 
-	ttm_base_object_unref(&base);
+	vmwgfx_base_object_unref(&base);
 
 	return 0;
 }
@@ -870,9 +870,9 @@ int vmw_fence_obj_unref_ioctl(struct drm_device *dev, void *data,
 	struct drm_vmw_fence_arg *arg =
 		(struct drm_vmw_fence_arg *) data;
 
-	return ttm_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
+	return vmwgfx_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
 					 arg->handle,
-					 TTM_REF_USAGE);
+					 VMWGFX_REF_USAGE);
 }
 
 /**
@@ -1091,7 +1091,7 @@ int vmw_fence_event_ioctl(struct drm_device *dev, void *data,
 		(struct drm_vmw_fence_event_arg *) data;
 	struct vmw_fence_obj *fence = NULL;
 	struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv);
-	struct ttm_object_file *tfile = vmw_fp->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fp->tfile;
 	struct drm_vmw_fence_rep __user *user_fence_rep =
 		(struct drm_vmw_fence_rep __user *)(unsigned long)
 		arg->fence_rep;
@@ -1104,7 +1104,7 @@ int vmw_fence_event_ioctl(struct drm_device *dev, void *data,
 	 * add one.
 	 */
 	if (arg->handle) {
-		struct ttm_base_object *base =
+		struct vmwgfx_base_object *base =
 			vmw_fence_obj_lookup(tfile, arg->handle);
 
 		if (IS_ERR(base))
@@ -1115,8 +1115,8 @@ int vmw_fence_event_ioctl(struct drm_device *dev, void *data,
 		(void) vmw_fence_obj_reference(fence);
 
 		if (user_fence_rep != NULL) {
-			ret = ttm_ref_object_add(vmw_fp->tfile, base,
-						 TTM_REF_USAGE, NULL, false);
+			ret = vmwgfx_ref_object_add(vmw_fp->tfile, base,
+						 VMWGFX_REF_USAGE, NULL, false);
 			if (unlikely(ret != 0)) {
 				DRM_ERROR("Failed to reference a fence "
 					  "object.\n");
@@ -1124,7 +1124,7 @@ int vmw_fence_event_ioctl(struct drm_device *dev, void *data,
 			}
 			handle = base->hash.key;
 		}
-		ttm_base_object_unref(&base);
+		vmwgfx_base_object_unref(&base);
 	}
 
 	/*
@@ -1159,7 +1159,7 @@ int vmw_fence_event_ioctl(struct drm_device *dev, void *data,
 	return 0;
 out_no_create:
 	if (user_fence_rep != NULL)
-		ttm_ref_object_base_unref(tfile, handle, TTM_REF_USAGE);
+		vmwgfx_ref_object_base_unref(tfile, handle, VMWGFX_REF_USAGE);
 out_no_ref_obj:
 	vmw_fence_obj_unreference(&fence);
 	return ret;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
index 01be355525e4..cf2ea14fb041 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
@@ -245,7 +245,7 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data,
 int vmw_present_ioctl(struct drm_device *dev, void *data,
 		      struct drm_file *file_priv)
 {
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct vmw_private *dev_priv = vmw_priv(dev);
 	struct drm_vmw_present_arg *arg =
 		(struct drm_vmw_present_arg *)data;
@@ -294,7 +294,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data,
 	}
 	vfb = vmw_framebuffer_to_vfb(fb);
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0))
 		goto out_no_ttm_lock;
 
@@ -314,7 +314,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data,
 	vmw_surface_unreference(&surface);
 
 out_no_surface:
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 out_no_ttm_lock:
 	drm_framebuffer_unreference(fb);
 out_no_fb:
@@ -383,7 +383,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data,
 		goto out_no_ttm_lock;
 	}
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0))
 		goto out_no_ttm_lock;
 
@@ -391,7 +391,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data,
 			       vfb, user_fence_rep,
 			       clips, num_clips);
 
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 out_no_ttm_lock:
 	drm_framebuffer_unreference(fb);
 out_no_fb:
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index a2a93d7e2a04..98d723c62fb3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -140,7 +140,7 @@ static void vmw_cursor_update_position(struct vmw_private *dev_priv,
 
 
 void vmw_kms_cursor_snoop(struct vmw_surface *srf,
-			  struct ttm_object_file *tfile,
+			  struct vmwgfx_object_file *tfile,
 			  struct ttm_buffer_object *bo,
 			  SVGA3dCmdHeader *header)
 {
@@ -857,7 +857,7 @@ static void vmw_framebuffer_surface_destroy(struct drm_framebuffer *framebuffer)
 	drm_framebuffer_cleanup(framebuffer);
 	vmw_surface_unreference(&vfbs->surface);
 	if (vfbs->base.user_obj)
-		ttm_base_object_unref(&vfbs->base.user_obj);
+		vmwgfx_base_object_unref(&vfbs->base.user_obj);
 
 	kfree(vfbs);
 }
@@ -880,7 +880,7 @@ static int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer,
 
 	drm_modeset_lock_all(dev_priv->dev);
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0)) {
 		drm_modeset_unlock_all(dev_priv->dev);
 		return ret;
@@ -907,7 +907,7 @@ static int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer,
 						 num_clips, inc, NULL);
 
 	vmw_fifo_flush(dev_priv, false);
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 
 	drm_modeset_unlock_all(dev_priv->dev);
 
@@ -1062,7 +1062,7 @@ static void vmw_framebuffer_dmabuf_destroy(struct drm_framebuffer *framebuffer)
 	drm_framebuffer_cleanup(framebuffer);
 	vmw_dmabuf_unreference(&vfbd->buffer);
 	if (vfbd->base.user_obj)
-		ttm_base_object_unref(&vfbd->base.user_obj);
+		vmwgfx_base_object_unref(&vfbd->base.user_obj);
 
 	kfree(vfbd);
 }
@@ -1081,7 +1081,7 @@ static int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
 
 	drm_modeset_lock_all(dev_priv->dev);
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0)) {
 		drm_modeset_unlock_all(dev_priv->dev);
 		return ret;
@@ -1120,7 +1120,7 @@ static int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
 	}
 
 	vmw_fifo_flush(dev_priv, false);
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 
 	drm_modeset_unlock_all(dev_priv->dev);
 
@@ -1426,11 +1426,11 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
 						 const struct drm_mode_fb_cmd2 *mode_cmd)
 {
 	struct vmw_private *dev_priv = vmw_priv(dev);
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct vmw_framebuffer *vfb = NULL;
 	struct vmw_surface *surface = NULL;
 	struct vmw_dma_buffer *bo = NULL;
-	struct ttm_base_object *user_obj;
+	struct vmwgfx_base_object *user_obj;
 	int ret;
 
 	/**
@@ -1455,7 +1455,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
 	 * command stream using user-space handles.
 	 */
 
-	user_obj = ttm_base_object_lookup(tfile, mode_cmd->handles[0]);
+	user_obj = vmwgfx_base_object_lookup(tfile, mode_cmd->handles[0]);
 	if (unlikely(user_obj == NULL)) {
 		DRM_ERROR("Could not locate requested kms frame buffer.\n");
 		return ERR_PTR(-ENOENT);
@@ -1499,7 +1499,7 @@ static struct drm_framebuffer *vmw_kms_fb_create(struct drm_device *dev,
 
 	if (ret) {
 		DRM_ERROR("failed to create vmw_framebuffer: %i\n", ret);
-		ttm_base_object_unref(&user_obj);
+		vmwgfx_base_object_unref(&user_obj);
 		return ERR_PTR(ret);
 	} else
 		vfb->user_obj = user_obj;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
index ff9c8389ff21..2824c71da29a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h
@@ -101,7 +101,7 @@ struct vmw_framebuffer {
 	int (*pin)(struct vmw_framebuffer *fb);
 	int (*unpin)(struct vmw_framebuffer *fb);
 	bool dmabuf;
-	struct ttm_base_object *user_obj;
+	struct vmwgfx_base_object *user_obj;
 	uint32_t user_handle;
 };
 
diff --git a/drivers/gpu/drm/ttm/ttm_lock.c b/drivers/gpu/drm/vmwgfx/vmwgfx_lock.c
similarity index 61%
rename from drivers/gpu/drm/ttm/ttm_lock.c
rename to drivers/gpu/drm/vmwgfx/vmwgfx_lock.c
index 913f4318cdc0..6c8ffce32134 100644
--- a/drivers/gpu/drm/ttm/ttm_lock.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_lock.c
@@ -28,21 +28,21 @@
  * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
  */
 
-#include <drm/ttm/ttm_lock.h>
 #include <drm/ttm/ttm_module.h>
 #include <linux/atomic.h>
 #include <linux/errno.h>
 #include <linux/wait.h>
 #include <linux/sched/signal.h>
 #include <linux/module.h>
+#include "vmwgfx_lock.h"
 
-#define TTM_WRITE_LOCK_PENDING    (1 << 0)
-#define TTM_VT_LOCK_PENDING       (1 << 1)
-#define TTM_SUSPEND_LOCK_PENDING  (1 << 2)
-#define TTM_VT_LOCK               (1 << 3)
-#define TTM_SUSPEND_LOCK          (1 << 4)
+#define VMWGFX_WRITE_LOCK_PENDING    (1 << 0)
+#define VMWGFX_VT_LOCK_PENDING       (1 << 1)
+#define VMWGFX_SUSPEND_LOCK_PENDING  (1 << 2)
+#define VMWGFX_VT_LOCK               (1 << 3)
+#define VMWGFX_SUSPEND_LOCK          (1 << 4)
 
-void ttm_lock_init(struct ttm_lock *lock)
+void vmwgfx_lock_init(struct vmwgfx_lock *lock)
 {
 	spin_lock_init(&lock->lock);
 	init_waitqueue_head(&lock->queue);
@@ -51,18 +51,16 @@ void ttm_lock_init(struct ttm_lock *lock)
 	lock->kill_takers = false;
 	lock->signal = SIGKILL;
 }
-EXPORT_SYMBOL(ttm_lock_init);
 
-void ttm_read_unlock(struct ttm_lock *lock)
+void vmwgfx_read_unlock(struct vmwgfx_lock *lock)
 {
 	spin_lock(&lock->lock);
 	if (--lock->rw == 0)
 		wake_up_all(&lock->queue);
 	spin_unlock(&lock->lock);
 }
-EXPORT_SYMBOL(ttm_read_unlock);
 
-static bool __ttm_read_lock(struct ttm_lock *lock)
+static bool __vmwgfx_read_lock(struct vmwgfx_lock *lock)
 {
 	bool locked = false;
 
@@ -80,20 +78,19 @@ static bool __ttm_read_lock(struct ttm_lock *lock)
 	return locked;
 }
 
-int ttm_read_lock(struct ttm_lock *lock, bool interruptible)
+int vmwgfx_read_lock(struct vmwgfx_lock *lock, bool interruptible)
 {
 	int ret = 0;
 
 	if (interruptible)
 		ret = wait_event_interruptible(lock->queue,
-					       __ttm_read_lock(lock));
+					       __vmwgfx_read_lock(lock));
 	else
-		wait_event(lock->queue, __ttm_read_lock(lock));
+		wait_event(lock->queue, __vmwgfx_read_lock(lock));
 	return ret;
 }
-EXPORT_SYMBOL(ttm_read_lock);
 
-static bool __ttm_read_trylock(struct ttm_lock *lock, bool *locked)
+static bool __vmwgfx_read_trylock(struct vmwgfx_lock *lock, bool *locked)
 {
 	bool block = true;
 
@@ -117,16 +114,16 @@ static bool __ttm_read_trylock(struct ttm_lock *lock, bool *locked)
 	return !block;
 }
 
-int ttm_read_trylock(struct ttm_lock *lock, bool interruptible)
+int vmwgfx_read_trylock(struct vmwgfx_lock *lock, bool interruptible)
 {
 	int ret = 0;
 	bool locked;
 
 	if (interruptible)
 		ret = wait_event_interruptible
-			(lock->queue, __ttm_read_trylock(lock, &locked));
+			(lock->queue, __vmwgfx_read_trylock(lock, &locked));
 	else
-		wait_event(lock->queue, __ttm_read_trylock(lock, &locked));
+		wait_event(lock->queue, __vmwgfx_read_trylock(lock, &locked));
 
 	if (unlikely(ret != 0)) {
 		BUG_ON(locked);
@@ -136,16 +133,15 @@ int ttm_read_trylock(struct ttm_lock *lock, bool interruptible)
 	return (locked) ? 0 : -EBUSY;
 }
 
-void ttm_write_unlock(struct ttm_lock *lock)
+void vmwgfx_write_unlock(struct vmwgfx_lock *lock)
 {
 	spin_lock(&lock->lock);
 	lock->rw = 0;
 	wake_up_all(&lock->queue);
 	spin_unlock(&lock->lock);
 }
-EXPORT_SYMBOL(ttm_write_unlock);
 
-static bool __ttm_write_lock(struct ttm_lock *lock)
+static bool __vmwgfx_write_lock(struct vmwgfx_lock *lock)
 {
 	bool locked = false;
 
@@ -155,96 +151,94 @@ static bool __ttm_write_lock(struct ttm_lock *lock)
 		spin_unlock(&lock->lock);
 		return false;
 	}
-	if (lock->rw == 0 && ((lock->flags & ~TTM_WRITE_LOCK_PENDING) == 0)) {
+	if (lock->rw == 0 && ((lock->flags & ~VMWGFX_WRITE_LOCK_PENDING) == 0)) {
 		lock->rw = -1;
-		lock->flags &= ~TTM_WRITE_LOCK_PENDING;
+		lock->flags &= ~VMWGFX_WRITE_LOCK_PENDING;
 		locked = true;
 	} else {
-		lock->flags |= TTM_WRITE_LOCK_PENDING;
+		lock->flags |= VMWGFX_WRITE_LOCK_PENDING;
 	}
 	spin_unlock(&lock->lock);
 	return locked;
 }
 
-int ttm_write_lock(struct ttm_lock *lock, bool interruptible)
+int vmwgfx_write_lock(struct vmwgfx_lock *lock, bool interruptible)
 {
 	int ret = 0;
 
 	if (interruptible) {
 		ret = wait_event_interruptible(lock->queue,
-					       __ttm_write_lock(lock));
+					       __vmwgfx_write_lock(lock));
 		if (unlikely(ret != 0)) {
 			spin_lock(&lock->lock);
-			lock->flags &= ~TTM_WRITE_LOCK_PENDING;
+			lock->flags &= ~VMWGFX_WRITE_LOCK_PENDING;
 			wake_up_all(&lock->queue);
 			spin_unlock(&lock->lock);
 		}
 	} else
-		wait_event(lock->queue, __ttm_write_lock(lock));
+		wait_event(lock->queue, __vmwgfx_write_lock(lock));
 
 	return ret;
 }
-EXPORT_SYMBOL(ttm_write_lock);
 
-static int __ttm_vt_unlock(struct ttm_lock *lock)
+static int __vmwgfx_vt_unlock(struct vmwgfx_lock *lock)
 {
 	int ret = 0;
 
 	spin_lock(&lock->lock);
-	if (unlikely(!(lock->flags & TTM_VT_LOCK)))
+	if (unlikely(!(lock->flags & VMWGFX_VT_LOCK)))
 		ret = -EINVAL;
-	lock->flags &= ~TTM_VT_LOCK;
+	lock->flags &= ~VMWGFX_VT_LOCK;
 	wake_up_all(&lock->queue);
 	spin_unlock(&lock->lock);
 
 	return ret;
 }
 
-static void ttm_vt_lock_remove(struct ttm_base_object **p_base)
+static void vmwgfx_vt_lock_remove(struct vmwgfx_base_object **p_base)
 {
-	struct ttm_base_object *base = *p_base;
-	struct ttm_lock *lock = container_of(base, struct ttm_lock, base);
+	struct vmwgfx_base_object *base = *p_base;
+	struct vmwgfx_lock *lock = container_of(base, struct vmwgfx_lock, base);
 	int ret;
 
 	*p_base = NULL;
-	ret = __ttm_vt_unlock(lock);
+	ret = __vmwgfx_vt_unlock(lock);
 	BUG_ON(ret != 0);
 }
 
-static bool __ttm_vt_lock(struct ttm_lock *lock)
+static bool __vmwgfx_vt_lock(struct vmwgfx_lock *lock)
 {
 	bool locked = false;
 
 	spin_lock(&lock->lock);
 	if (lock->rw == 0) {
-		lock->flags &= ~TTM_VT_LOCK_PENDING;
-		lock->flags |= TTM_VT_LOCK;
+		lock->flags &= ~VMWGFX_VT_LOCK_PENDING;
+		lock->flags |= VMWGFX_VT_LOCK;
 		locked = true;
 	} else {
-		lock->flags |= TTM_VT_LOCK_PENDING;
+		lock->flags |= VMWGFX_VT_LOCK_PENDING;
 	}
 	spin_unlock(&lock->lock);
 	return locked;
 }
 
-int ttm_vt_lock(struct ttm_lock *lock,
-		bool interruptible,
-		struct ttm_object_file *tfile)
+int vmwgfx_vt_lock(struct vmwgfx_lock *lock, bool interruptible,
+		   struct vmwgfx_object_file *tfile)
 {
 	int ret = 0;
 
 	if (interruptible) {
 		ret = wait_event_interruptible(lock->queue,
-					       __ttm_vt_lock(lock));
+					       __vmwgfx_vt_lock(lock));
 		if (unlikely(ret != 0)) {
 			spin_lock(&lock->lock);
-			lock->flags &= ~TTM_VT_LOCK_PENDING;
+			lock->flags &= ~VMWGFX_VT_LOCK_PENDING;
 			wake_up_all(&lock->queue);
 			spin_unlock(&lock->lock);
 			return ret;
 		}
 	} else
-		wait_event(lock->queue, __ttm_vt_lock(lock));
+		wait_event(lock->queue, __vmwgfx_vt_lock(lock));
 
 	/*
 	 * Add a base-object, the destructor of which will
@@ -252,51 +246,47 @@ int ttm_vt_lock(struct ttm_lock *lock,
 	 * while holding it.
 	 */
 
-	ret = ttm_base_object_init(tfile, &lock->base, false,
-				   ttm_lock_type, &ttm_vt_lock_remove, NULL);
+	ret = vmwgfx_base_object_init(tfile, &lock->base, false,
+				   vmwgfx_lock_type, &vmwgfx_vt_lock_remove, NULL);
 	if (ret)
-		(void)__ttm_vt_unlock(lock);
+		(void)__vmwgfx_vt_unlock(lock);
 	else
 		lock->vt_holder = tfile;
 
 	return ret;
 }
-EXPORT_SYMBOL(ttm_vt_lock);
 
-int ttm_vt_unlock(struct ttm_lock *lock)
+int vmwgfx_vt_unlock(struct vmwgfx_lock *lock)
 {
-	return ttm_ref_object_base_unref(lock->vt_holder,
-					 lock->base.hash.key, TTM_REF_USAGE);
+	return vmwgfx_ref_object_base_unref(lock->vt_holder,
+					 lock->base.hash.key, VMWGFX_REF_USAGE);
 }
-EXPORT_SYMBOL(ttm_vt_unlock);
 
-void ttm_suspend_unlock(struct ttm_lock *lock)
+void vmwgfx_suspend_unlock(struct vmwgfx_lock *lock)
 {
 	spin_lock(&lock->lock);
-	lock->flags &= ~TTM_SUSPEND_LOCK;
+	lock->flags &= ~VMWGFX_SUSPEND_LOCK;
 	wake_up_all(&lock->queue);
 	spin_unlock(&lock->lock);
 }
-EXPORT_SYMBOL(ttm_suspend_unlock);
 
-static bool __ttm_suspend_lock(struct ttm_lock *lock)
+static bool __vmwgfx_suspend_lock(struct vmwgfx_lock *lock)
 {
 	bool locked = false;
 
 	spin_lock(&lock->lock);
 	if (lock->rw == 0) {
-		lock->flags &= ~TTM_SUSPEND_LOCK_PENDING;
-		lock->flags |= TTM_SUSPEND_LOCK;
+		lock->flags &= ~VMWGFX_SUSPEND_LOCK_PENDING;
+		lock->flags |= VMWGFX_SUSPEND_LOCK;
 		locked = true;
 	} else {
-		lock->flags |= TTM_SUSPEND_LOCK_PENDING;
+		lock->flags |= VMWGFX_SUSPEND_LOCK_PENDING;
 	}
 	spin_unlock(&lock->lock);
 	return locked;
 }
 
-void ttm_suspend_lock(struct ttm_lock *lock)
+void vmwgfx_suspend_lock(struct vmwgfx_lock *lock)
 {
-	wait_event(lock->queue, __ttm_suspend_lock(lock));
+	wait_event(lock->queue, __vmwgfx_suspend_lock(lock));
 }
-EXPORT_SYMBOL(ttm_suspend_lock);
diff --git a/include/drm/ttm/ttm_lock.h b/drivers/gpu/drm/vmwgfx/vmwgfx_lock.h
similarity index 69%
rename from include/drm/ttm/ttm_lock.h
rename to drivers/gpu/drm/vmwgfx/vmwgfx_lock.h
index 0c3af9836863..95219cb1663e 100644
--- a/include/drm/ttm/ttm_lock.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_lock.h
@@ -28,7 +28,7 @@
  * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
  */
 
-/** @file ttm_lock.h
+/** @file vmwgfx_lock.h
  * This file implements a simple replacement for the buffer manager use
  * of the DRM heavyweight hardware lock.
  * The lock is a read-write lock. Taking it in read mode and write mode
@@ -46,16 +46,16 @@
  *
  */
 
-#ifndef _TTM_LOCK_H_
-#define _TTM_LOCK_H_
+#ifndef _VMWGFX_LOCK_H_
+#define _VMWGFX_LOCK_H_
 
 #include <linux/wait.h>
 #include <linux/atomic.h>
 
-#include "ttm_object.h"
+#include "vmwgfx_object.h"
 
 /**
- * struct ttm_lock
+ * struct vmwgfx_lock
  *
  * @base: ttm base object used solely to release the lock if the client
  * holding the lock dies.
@@ -67,51 +67,51 @@
  * @signal: Signal to send when kill_takers is true.
  */
 
-struct ttm_lock {
-	struct ttm_base_object base;
+struct vmwgfx_lock {
+	struct vmwgfx_base_object base;
 	wait_queue_head_t queue;
 	spinlock_t lock;
 	int32_t rw;
 	uint32_t flags;
 	bool kill_takers;
 	int signal;
-	struct ttm_object_file *vt_holder;
+	struct vmwgfx_object_file *vt_holder;
 };
 
 
 /**
- * ttm_lock_init
+ * vmwgfx_lock_init
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  * Initializes the lock.
  */
-extern void ttm_lock_init(struct ttm_lock *lock);
+extern void vmwgfx_lock_init(struct vmwgfx_lock *lock);
 
 /**
- * ttm_read_unlock
+ * vmwgfx_read_unlock
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  *
  * Releases a read lock.
  */
-extern void ttm_read_unlock(struct ttm_lock *lock);
+extern void vmwgfx_read_unlock(struct vmwgfx_lock *lock);
 
 /**
- * ttm_read_lock
+ * vmwgfx_read_lock
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  * @interruptible: Interruptible sleeping while waiting for a lock.
  *
  * Takes the lock in read mode.
  * Returns:
  * -ERESTARTSYS If interrupted by a signal and interruptible is true.
  */
-extern int ttm_read_lock(struct ttm_lock *lock, bool interruptible);
+extern int vmwgfx_read_lock(struct vmwgfx_lock *lock, bool interruptible);
 
 /**
- * ttm_read_trylock
+ * vmwgfx_read_trylock
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  * @interruptible: Interruptible sleeping while waiting for a lock.
  *
  * Tries to take the lock in read mode. If the lock is already held
@@ -123,107 +123,107 @@ extern int ttm_read_lock(struct ttm_lock *lock, bool interruptible);
  * -EBUSY The lock was already held in write mode.
  * -ERESTARTSYS If interrupted by a signal and interruptible is true.
  */
-extern int ttm_read_trylock(struct ttm_lock *lock, bool interruptible);
+extern int vmwgfx_read_trylock(struct vmwgfx_lock *lock, bool interruptible);
 
 /**
- * ttm_write_unlock
+ * vmwgfx_write_unlock
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  *
  * Releases a write lock.
  */
-extern void ttm_write_unlock(struct ttm_lock *lock);
+extern void vmwgfx_write_unlock(struct vmwgfx_lock *lock);
 
 /**
- * ttm_write_lock
+ * vmwgfx_write_lock
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  * @interruptible: Interruptible sleeping while waiting for a lock.
  *
  * Takes the lock in write mode.
  * Returns:
  * -ERESTARTSYS If interrupted by a signal and interruptible is true.
  */
-extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible);
+extern int vmwgfx_write_lock(struct vmwgfx_lock *lock, bool interruptible);
 
 /**
- * ttm_lock_downgrade
+ * vmwgfx_lock_downgrade
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  *
  * Downgrades a write lock to a read lock.
  */
-extern void ttm_lock_downgrade(struct ttm_lock *lock);
+extern void vmwgfx_lock_downgrade(struct vmwgfx_lock *lock);
 
 /**
- * ttm_suspend_lock
+ * vmwgfx_suspend_lock
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  *
  * Takes the lock in suspend mode. Excludes read and write mode.
  */
-extern void ttm_suspend_lock(struct ttm_lock *lock);
+extern void vmwgfx_suspend_lock(struct vmwgfx_lock *lock);
 
 /**
- * ttm_suspend_unlock
+ * vmwgfx_suspend_unlock
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  *
  * Releases a suspend lock
  */
-extern void ttm_suspend_unlock(struct ttm_lock *lock);
+extern void vmwgfx_suspend_unlock(struct vmwgfx_lock *lock);
 
 /**
- * ttm_vt_lock
+ * vmwgfx_vt_lock
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  * @interruptible: Interruptible sleeping while waiting for a lock.
- * @tfile: Pointer to a struct ttm_object_file to register the lock with.
+ * @tfile: Pointer to a struct vmwgfx_object_file to register the lock with.
  *
  * Takes the lock in vt mode.
  * Returns:
  * -ERESTARTSYS If interrupted by a signal and interruptible is true.
  * -ENOMEM: Out of memory when locking.
  */
-extern int ttm_vt_lock(struct ttm_lock *lock, bool interruptible,
-		       struct ttm_object_file *tfile);
+extern int vmwgfx_vt_lock(struct vmwgfx_lock *lock, bool interruptible,
+			  struct vmwgfx_object_file *tfile);
 
 /**
- * ttm_vt_unlock
+ * vmwgfx_vt_lock
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  *
  * Releases a vt lock.
  * Returns:
  * -EINVAL If the lock was not held.
  */
-extern int ttm_vt_unlock(struct ttm_lock *lock);
+extern int vmwgfx_vt_unlock(struct vmwgfx_lock *lock);
 
 /**
- * ttm_write_unlock
+ * vmwgfx_write_unlock
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  *
  * Releases a write lock.
  */
-extern void ttm_write_unlock(struct ttm_lock *lock);
+extern void vmwgfx_write_unlock(struct vmwgfx_lock *lock);
 
 /**
- * ttm_write_lock
+ * vmwgfx_write_lock
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  * @interruptible: Interruptible sleeping while waiting for a lock.
  *
  * Takes the lock in write mode.
  * Returns:
  * -ERESTARTSYS If interrupted by a signal and interruptible is true.
  */
-extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible);
+extern int vmwgfx_write_lock(struct vmwgfx_lock *lock, bool interruptible);
 
 /**
- * ttm_lock_set_kill
+ * vmwgfx_lock_set_kill
  *
- * @lock: Pointer to a struct ttm_lock
+ * @lock: Pointer to a struct vmwgfx_lock
  * @val: Boolean whether to kill processes taking the lock.
  * @signal: Signal to send to the process taking the lock.
  *
@@ -231,14 +231,14 @@ extern int ttm_write_lock(struct ttm_lock *lock, bool interruptible);
  * on using the TTM functionality when its resources has been taken down, for
  * example when the X server exits. A typical sequence would look like this:
  * - X server takes lock in write mode.
- * - ttm_lock_set_kill() is called with @val set to true.
+ * - vmwgfx_lock_set_kill() is called with @val set to true.
  * - As part of X server exit, TTM resources are taken down.
  * - X server releases the lock on file release.
  * - Another dri client wants to render, takes the lock and is killed.
  *
  */
-static inline void ttm_lock_set_kill(struct ttm_lock *lock, bool val,
-				     int signal)
+static inline void vmwgfx_lock_set_kill(struct vmwgfx_lock *lock, bool val,
+					int signal)
 {
 	lock->kill_takers = val;
 	if (val)
diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/vmwgfx/vmwgfx_object.c
similarity index 69%
rename from drivers/gpu/drm/ttm/ttm_object.c
rename to drivers/gpu/drm/vmwgfx/vmwgfx_object.c
index 1aa2baa83959..91e0102be15b 100644
--- a/drivers/gpu/drm/ttm/ttm_object.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_object.c
@@ -42,9 +42,9 @@
 
 
 /**
- * struct ttm_object_file
+ * struct vmwgfx_object_file
  *
- * @tdev: Pointer to the ttm_object_device.
+ * @tdev: Pointer to the vmwgfx_object_device.
  *
  * @lock: Lock that protects the ref_list list and the
  * ref_hash hash tables.
@@ -52,30 +52,30 @@
  * @ref_list: List of ttm_ref_objects to be destroyed at
  * file release.
  *
- * @ref_hash: Hash tables of ref objects, one per ttm_ref_type,
+ * @ref_hash: Hash tables of ref objects, one per vmwgfx_ref_type,
  * for fast lookup of ref objects given a base object.
  */
 
-#define pr_fmt(fmt) "[TTM] " fmt
+#define pr_fmt(fmt) "[VMWGFX] " fmt
 
-#include <drm/ttm/ttm_object.h>
 #include <drm/ttm/ttm_module.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/atomic.h>
+#include "vmwgfx_object.h"
 
-struct ttm_object_file {
-	struct ttm_object_device *tdev;
+struct vmwgfx_object_file {
+	struct vmwgfx_object_device *tdev;
 	spinlock_t lock;
 	struct list_head ref_list;
-	struct drm_open_hash ref_hash[TTM_REF_NUM];
+	struct drm_open_hash ref_hash[VMWGFX_REF_NUM];
 	struct kref refcount;
 };
 
 /**
- * struct ttm_object_device
+ * struct vmwgfx_object_device
  *
  * @object_lock: lock that protects the object_hash hash table.
  *
@@ -86,7 +86,7 @@ struct ttm_object_file {
  * This is the per-device data structure needed for ttm object management.
  */
 
-struct ttm_object_device {
+struct vmwgfx_object_device {
 	spinlock_t object_lock;
 	struct drm_open_hash object_hash;
 	atomic_t object_count;
@@ -112,8 +112,8 @@ struct ttm_object_device {
  * This is similar to an idr object, but it also has a hash table entry
  * that allows lookup with a pointer to the referenced object as a key. In
  * that way, one can easily detect whether a base object is referenced by
- * a particular ttm_object_file. It also carries a ref count to avoid creating
- * multiple ref objects if a ttm_object_file references the same base
+ * a particular vmwgfx_object_file. It also carries a ref count to avoid creating
+ * multiple ref objects if a vmwgfx_object_file references the same base
  * object more than once.
  */
 
@@ -122,51 +122,51 @@ struct ttm_ref_object {
 	struct drm_hash_item hash;
 	struct list_head head;
 	struct kref kref;
-	enum ttm_ref_type ref_type;
-	struct ttm_base_object *obj;
-	struct ttm_object_file *tfile;
+	enum vmwgfx_ref_type ref_type;
+	struct vmwgfx_base_object *obj;
+	struct vmwgfx_object_file *tfile;
 };
 
 static void ttm_prime_dmabuf_release(struct dma_buf *dma_buf);
 
-static inline struct ttm_object_file *
-ttm_object_file_ref(struct ttm_object_file *tfile)
+static inline struct vmwgfx_object_file *
+vmwgfx_object_file_ref(struct vmwgfx_object_file *tfile)
 {
 	kref_get(&tfile->refcount);
 	return tfile;
 }
 
-static void ttm_object_file_destroy(struct kref *kref)
+static void vmwgfx_object_file_destroy(struct kref *kref)
 {
-	struct ttm_object_file *tfile =
-		container_of(kref, struct ttm_object_file, refcount);
+	struct vmwgfx_object_file *tfile =
+		container_of(kref, struct vmwgfx_object_file, refcount);
 
 	kfree(tfile);
 }
 
 
-static inline void ttm_object_file_unref(struct ttm_object_file **p_tfile)
+static inline void vmwgfx_object_file_unref(struct vmwgfx_object_file **p_tfile)
 {
-	struct ttm_object_file *tfile = *p_tfile;
+	struct vmwgfx_object_file *tfile = *p_tfile;
 
 	*p_tfile = NULL;
-	kref_put(&tfile->refcount, ttm_object_file_destroy);
+	kref_put(&tfile->refcount, vmwgfx_object_file_destroy);
 }
 
 
-int ttm_base_object_init(struct ttm_object_file *tfile,
-			 struct ttm_base_object *base,
+int vmwgfx_base_object_init(struct vmwgfx_object_file *tfile,
+			 struct vmwgfx_base_object *base,
 			 bool shareable,
-			 enum ttm_object_type object_type,
-			 void (*refcount_release) (struct ttm_base_object **),
-			 void (*ref_obj_release) (struct ttm_base_object *,
-						  enum ttm_ref_type ref_type))
+			 enum vmwgfx_object_type object_type,
+			 void (*refcount_release) (struct vmwgfx_base_object **),
+			 void (*ref_obj_release) (struct vmwgfx_base_object *,
+						  enum vmwgfx_ref_type ref_type))
 {
-	struct ttm_object_device *tdev = tfile->tdev;
+	struct vmwgfx_object_device *tdev = tfile->tdev;
 	int ret;
 
 	base->shareable = shareable;
-	base->tfile = ttm_object_file_ref(tfile);
+	base->tfile = vmwgfx_object_file_ref(tfile);
 	base->refcount_release = refcount_release;
 	base->ref_obj_release = ref_obj_release;
 	base->object_type = object_type;
@@ -179,11 +179,11 @@ int ttm_base_object_init(struct ttm_object_file *tfile,
 	if (unlikely(ret != 0))
 		goto out_err0;
 
-	ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false);
+	ret = vmwgfx_ref_object_add(tfile, base, VMWGFX_REF_USAGE, NULL, false);
 	if (unlikely(ret != 0))
 		goto out_err1;
 
-	ttm_base_object_unref(&base);
+	vmwgfx_base_object_unref(&base);
 
 	return 0;
 out_err1:
@@ -193,13 +193,13 @@ int ttm_base_object_init(struct ttm_object_file *tfile,
 out_err0:
 	return ret;
 }
-EXPORT_SYMBOL(ttm_base_object_init);
+EXPORT_SYMBOL(vmwgfx_base_object_init);
 
 static void ttm_release_base(struct kref *kref)
 {
-	struct ttm_base_object *base =
-	    container_of(kref, struct ttm_base_object, refcount);
-	struct ttm_object_device *tdev = base->tfile->tdev;
+	struct vmwgfx_base_object *base =
+	    container_of(kref, struct vmwgfx_base_object, refcount);
+	struct vmwgfx_object_device *tdev = base->tfile->tdev;
 
 	spin_lock(&tdev->object_lock);
 	(void)drm_ht_remove_item_rcu(&tdev->object_hash, &base->hash);
@@ -208,30 +208,30 @@ static void ttm_release_base(struct kref *kref)
 	/*
 	 * Note: We don't use synchronize_rcu() here because it's far
 	 * too slow. It's up to the user to free the object using
-	 * call_rcu() or ttm_base_object_kfree().
+	 * call_rcu() or vmwgfx_base_object_kfree().
 	 */
 
-	ttm_object_file_unref(&base->tfile);
+	vmwgfx_object_file_unref(&base->tfile);
 	if (base->refcount_release)
 		base->refcount_release(&base);
 }
 
-void ttm_base_object_unref(struct ttm_base_object **p_base)
+void vmwgfx_base_object_unref(struct vmwgfx_base_object **p_base)
 {
-	struct ttm_base_object *base = *p_base;
+	struct vmwgfx_base_object *base = *p_base;
 
 	*p_base = NULL;
 
 	kref_put(&base->refcount, ttm_release_base);
 }
-EXPORT_SYMBOL(ttm_base_object_unref);
+EXPORT_SYMBOL(vmwgfx_base_object_unref);
 
-struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile,
+struct vmwgfx_base_object *vmwgfx_base_object_lookup(struct vmwgfx_object_file *tfile,
 					       uint32_t key)
 {
-	struct ttm_base_object *base = NULL;
+	struct vmwgfx_base_object *base = NULL;
 	struct drm_hash_item *hash;
-	struct drm_open_hash *ht = &tfile->ref_hash[TTM_REF_USAGE];
+	struct drm_open_hash *ht = &tfile->ref_hash[VMWGFX_REF_USAGE];
 	int ret;
 
 	rcu_read_lock();
@@ -246,12 +246,12 @@ struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile,
 
 	return base;
 }
-EXPORT_SYMBOL(ttm_base_object_lookup);
+EXPORT_SYMBOL(vmwgfx_base_object_lookup);
 
-struct ttm_base_object *
-ttm_base_object_lookup_for_ref(struct ttm_object_device *tdev, uint32_t key)
+struct vmwgfx_base_object *
+vmwgfx_base_object_lookup_for_ref(struct vmwgfx_object_device *tdev, uint32_t key)
 {
-	struct ttm_base_object *base = NULL;
+	struct vmwgfx_base_object *base = NULL;
 	struct drm_hash_item *hash;
 	struct drm_open_hash *ht = &tdev->object_hash;
 	int ret;
@@ -260,7 +260,7 @@ ttm_base_object_lookup_for_ref(struct ttm_object_device *tdev, uint32_t key)
 	ret = drm_ht_find_item_rcu(ht, key, &hash);
 
 	if (likely(ret == 0)) {
-		base = drm_hash_entry(hash, struct ttm_base_object, hash);
+		base = drm_hash_entry(hash, struct vmwgfx_base_object, hash);
 		if (!kref_get_unless_zero(&base->refcount))
 			base = NULL;
 	}
@@ -268,22 +268,22 @@ ttm_base_object_lookup_for_ref(struct ttm_object_device *tdev, uint32_t key)
 
 	return base;
 }
-EXPORT_SYMBOL(ttm_base_object_lookup_for_ref);
+EXPORT_SYMBOL(vmwgfx_base_object_lookup_for_ref);
 
 /**
- * ttm_ref_object_exists - Check whether a caller has a valid ref object
+ * vmwgfx_ref_object_exists - Check whether a caller has a valid ref object
  * (has opened) a base object.
  *
- * @tfile: Pointer to a struct ttm_object_file identifying the caller.
+ * @tfile: Pointer to a struct vmwgfx_object_file identifying the caller.
  * @base: Pointer to a struct base object.
  *
  * Checks wether the caller identified by @tfile has put a valid USAGE
  * reference object on the base object identified by @base.
  */
-bool ttm_ref_object_exists(struct ttm_object_file *tfile,
-			   struct ttm_base_object *base)
+bool vmwgfx_ref_object_exists(struct vmwgfx_object_file *tfile,
+			   struct vmwgfx_base_object *base)
 {
-	struct drm_open_hash *ht = &tfile->ref_hash[TTM_REF_USAGE];
+	struct drm_open_hash *ht = &tfile->ref_hash[VMWGFX_REF_USAGE];
 	struct drm_hash_item *hash;
 	struct ttm_ref_object *ref;
 
@@ -314,11 +314,11 @@ bool ttm_ref_object_exists(struct ttm_object_file *tfile,
 	rcu_read_unlock();
 	return false;
 }
-EXPORT_SYMBOL(ttm_ref_object_exists);
+EXPORT_SYMBOL(vmwgfx_ref_object_exists);
 
-int ttm_ref_object_add(struct ttm_object_file *tfile,
-		       struct ttm_base_object *base,
-		       enum ttm_ref_type ref_type, bool *existed,
+int vmwgfx_ref_object_add(struct vmwgfx_object_file *tfile,
+		       struct vmwgfx_base_object *base,
+		       enum vmwgfx_ref_type ref_type, bool *existed,
 		       bool require_existed)
 {
 	struct drm_open_hash *ht = &tfile->ref_hash[ref_type];
@@ -390,14 +390,14 @@ int ttm_ref_object_add(struct ttm_object_file *tfile,
 
 	return ret;
 }
-EXPORT_SYMBOL(ttm_ref_object_add);
+EXPORT_SYMBOL(vmwgfx_ref_object_add);
 
 static void ttm_ref_object_release(struct kref *kref)
 {
 	struct ttm_ref_object *ref =
 	    container_of(kref, struct ttm_ref_object, kref);
-	struct ttm_base_object *base = ref->obj;
-	struct ttm_object_file *tfile = ref->tfile;
+	struct vmwgfx_base_object *base = ref->obj;
+	struct vmwgfx_object_file *tfile = ref->tfile;
 	struct drm_open_hash *ht;
 	struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob;
 
@@ -406,17 +406,17 @@ static void ttm_ref_object_release(struct kref *kref)
 	list_del(&ref->head);
 	spin_unlock(&tfile->lock);
 
-	if (ref->ref_type != TTM_REF_USAGE && base->ref_obj_release)
+	if (ref->ref_type != VMWGFX_REF_USAGE && base->ref_obj_release)
 		base->ref_obj_release(base, ref->ref_type);
 
-	ttm_base_object_unref(&ref->obj);
+	vmwgfx_base_object_unref(&ref->obj);
 	ttm_mem_global_free(mem_glob, sizeof(*ref));
 	kfree_rcu(ref, rcu_head);
 	spin_lock(&tfile->lock);
 }
 
-int ttm_ref_object_base_unref(struct ttm_object_file *tfile,
-			      unsigned long key, enum ttm_ref_type ref_type)
+int vmwgfx_ref_object_base_unref(struct vmwgfx_object_file *tfile,
+			      unsigned long key, enum vmwgfx_ref_type ref_type)
 {
 	struct drm_open_hash *ht = &tfile->ref_hash[ref_type];
 	struct ttm_ref_object *ref;
@@ -434,14 +434,14 @@ int ttm_ref_object_base_unref(struct ttm_object_file *tfile,
 	spin_unlock(&tfile->lock);
 	return 0;
 }
-EXPORT_SYMBOL(ttm_ref_object_base_unref);
+EXPORT_SYMBOL(vmwgfx_ref_object_base_unref);
 
-void ttm_object_file_release(struct ttm_object_file **p_tfile)
+void vmwgfx_object_file_release(struct vmwgfx_object_file **p_tfile)
 {
 	struct ttm_ref_object *ref;
 	struct list_head *list;
 	unsigned int i;
-	struct ttm_object_file *tfile = *p_tfile;
+	struct vmwgfx_object_file *tfile = *p_tfile;
 
 	*p_tfile = NULL;
 	spin_lock(&tfile->lock);
@@ -458,17 +458,17 @@ void ttm_object_file_release(struct ttm_object_file **p_tfile)
 	}
 
 	spin_unlock(&tfile->lock);
-	for (i = 0; i < TTM_REF_NUM; ++i)
+	for (i = 0; i < VMWGFX_REF_NUM; ++i)
 		drm_ht_remove(&tfile->ref_hash[i]);
 
-	ttm_object_file_unref(&tfile);
+	vmwgfx_object_file_unref(&tfile);
 }
-EXPORT_SYMBOL(ttm_object_file_release);
+EXPORT_SYMBOL(vmwgfx_object_file_release);
 
-struct ttm_object_file *ttm_object_file_init(struct ttm_object_device *tdev,
+struct vmwgfx_object_file *vmwgfx_object_file_init(struct vmwgfx_object_device *tdev,
 					     unsigned int hash_order)
 {
-	struct ttm_object_file *tfile = kmalloc(sizeof(*tfile), GFP_KERNEL);
+	struct vmwgfx_object_file *tfile = kmalloc(sizeof(*tfile), GFP_KERNEL);
 	unsigned int i;
 	unsigned int j = 0;
 	int ret;
@@ -481,7 +481,7 @@ struct ttm_object_file *ttm_object_file_init(struct ttm_object_device *tdev,
 	kref_init(&tfile->refcount);
 	INIT_LIST_HEAD(&tfile->ref_list);
 
-	for (i = 0; i < TTM_REF_NUM; ++i) {
+	for (i = 0; i < VMWGFX_REF_NUM; ++i) {
 		ret = drm_ht_create(&tfile->ref_hash[i], hash_order);
 		if (ret) {
 			j = i;
@@ -498,14 +498,14 @@ struct ttm_object_file *ttm_object_file_init(struct ttm_object_device *tdev,
 
 	return NULL;
 }
-EXPORT_SYMBOL(ttm_object_file_init);
+EXPORT_SYMBOL(vmwgfx_object_file_init);
 
-struct ttm_object_device *
-ttm_object_device_init(struct ttm_mem_global *mem_glob,
+struct vmwgfx_object_device *
+vmwgfx_object_device_init(struct ttm_mem_global *mem_glob,
 		       unsigned int hash_order,
 		       const struct dma_buf_ops *ops)
 {
-	struct ttm_object_device *tdev = kmalloc(sizeof(*tdev), GFP_KERNEL);
+	struct vmwgfx_object_device *tdev = kmalloc(sizeof(*tdev), GFP_KERNEL);
 	int ret;
 
 	if (unlikely(tdev == NULL))
@@ -529,11 +529,11 @@ ttm_object_device_init(struct ttm_mem_global *mem_glob,
 	kfree(tdev);
 	return NULL;
 }
-EXPORT_SYMBOL(ttm_object_device_init);
+EXPORT_SYMBOL(vmwgfx_object_device_init);
 
-void ttm_object_device_release(struct ttm_object_device **p_tdev)
+void vmwgfx_object_device_release(struct vmwgfx_object_device **p_tdev)
 {
-	struct ttm_object_device *tdev = *p_tdev;
+	struct vmwgfx_object_device *tdev = *p_tdev;
 
 	*p_tdev = NULL;
 
@@ -541,7 +541,7 @@ void ttm_object_device_release(struct ttm_object_device **p_tdev)
 
 	kfree(tdev);
 }
-EXPORT_SYMBOL(ttm_object_device_release);
+EXPORT_SYMBOL(vmwgfx_object_device_release);
 
 /**
  * get_dma_buf_unless_doomed - get a dma_buf reference if possible.
@@ -564,20 +564,20 @@ static bool __must_check get_dma_buf_unless_doomed(struct dma_buf *dmabuf)
 /**
  * ttm_prime_refcount_release - refcount release method for a prime object.
  *
- * @p_base: Pointer to ttm_base_object pointer.
+ * @p_base: Pointer to vmwgfx_base_object pointer.
  *
  * This is a wrapper that calls the refcount_release founction of the
  * underlying object. At the same time it cleans up the prime object.
  * This function is called when all references to the base object we
  * derive from are gone.
  */
-static void ttm_prime_refcount_release(struct ttm_base_object **p_base)
+static void ttm_prime_refcount_release(struct vmwgfx_base_object **p_base)
 {
-	struct ttm_base_object *base = *p_base;
-	struct ttm_prime_object *prime;
+	struct vmwgfx_base_object *base = *p_base;
+	struct vmwgfx_prime_object *prime;
 
 	*p_base = NULL;
-	prime = container_of(base, struct ttm_prime_object, base);
+	prime = container_of(base, struct vmwgfx_prime_object, base);
 	BUG_ON(prime->dma_buf != NULL);
 	mutex_destroy(&prime->mutex);
 	if (prime->refcount_release)
@@ -596,10 +596,10 @@ static void ttm_prime_refcount_release(struct ttm_base_object **p_base)
  */
 static void ttm_prime_dmabuf_release(struct dma_buf *dma_buf)
 {
-	struct ttm_prime_object *prime =
-		(struct ttm_prime_object *) dma_buf->priv;
-	struct ttm_base_object *base = &prime->base;
-	struct ttm_object_device *tdev = base->tfile->tdev;
+	struct vmwgfx_prime_object *prime =
+		(struct vmwgfx_prime_object *) dma_buf->priv;
+	struct vmwgfx_base_object *base = &prime->base;
+	struct vmwgfx_object_device *tdev = base->tfile->tdev;
 
 	if (tdev->dmabuf_release)
 		tdev->dmabuf_release(dma_buf);
@@ -608,13 +608,13 @@ static void ttm_prime_dmabuf_release(struct dma_buf *dma_buf)
 		prime->dma_buf = NULL;
 	mutex_unlock(&prime->mutex);
 	ttm_mem_global_free(tdev->mem_glob, tdev->dma_buf_size);
-	ttm_base_object_unref(&base);
+	vmwgfx_base_object_unref(&base);
 }
 
 /**
- * ttm_prime_fd_to_handle - Get a base object handle from a prime fd
+ * vmwgfx_prime_fd_to_handle - Get a base object handle from a prime fd
  *
- * @tfile: A struct ttm_object_file identifying the caller.
+ * @tfile: A struct vmwgfx_object_file identifying the caller.
  * @fd: The prime / dmabuf fd.
  * @handle: The returned handle.
  *
@@ -622,13 +622,13 @@ static void ttm_prime_dmabuf_release(struct dma_buf *dma_buf)
  * a dma-buf. Note that we don't handle imports yet, because we simply
  * have no consumers of that implementation.
  */
-int ttm_prime_fd_to_handle(struct ttm_object_file *tfile,
+int vmwgfx_prime_fd_to_handle(struct vmwgfx_object_file *tfile,
 			   int fd, u32 *handle)
 {
-	struct ttm_object_device *tdev = tfile->tdev;
+	struct vmwgfx_object_device *tdev = tfile->tdev;
 	struct dma_buf *dma_buf;
-	struct ttm_prime_object *prime;
-	struct ttm_base_object *base;
+	struct vmwgfx_prime_object *prime;
+	struct vmwgfx_base_object *base;
 	int ret;
 
 	dma_buf = dma_buf_get(fd);
@@ -638,44 +638,44 @@ int ttm_prime_fd_to_handle(struct ttm_object_file *tfile,
 	if (dma_buf->ops != &tdev->ops)
 		return -ENOSYS;
 
-	prime = (struct ttm_prime_object *) dma_buf->priv;
+	prime = (struct vmwgfx_prime_object *) dma_buf->priv;
 	base = &prime->base;
 	*handle = base->hash.key;
-	ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false);
+	ret = vmwgfx_ref_object_add(tfile, base, VMWGFX_REF_USAGE, NULL, false);
 
 	dma_buf_put(dma_buf);
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(ttm_prime_fd_to_handle);
+EXPORT_SYMBOL_GPL(vmwgfx_prime_fd_to_handle);
 
 /**
- * ttm_prime_handle_to_fd - Return a dma_buf fd from a ttm prime object
+ * vmwgfx_prime_handle_to_fd - Return a dma_buf fd from a ttm prime object
  *
- * @tfile: Struct ttm_object_file identifying the caller.
+ * @tfile: Struct vmwgfx_object_file identifying the caller.
  * @handle: Handle to the object we're exporting from.
  * @flags: flags for dma-buf creation. We just pass them on.
  * @prime_fd: The returned file descriptor.
  *
  */
-int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
+int vmwgfx_prime_handle_to_fd(struct vmwgfx_object_file *tfile,
 			   uint32_t handle, uint32_t flags,
 			   int *prime_fd)
 {
-	struct ttm_object_device *tdev = tfile->tdev;
-	struct ttm_base_object *base;
+	struct vmwgfx_object_device *tdev = tfile->tdev;
+	struct vmwgfx_base_object *base;
 	struct dma_buf *dma_buf;
-	struct ttm_prime_object *prime;
+	struct vmwgfx_prime_object *prime;
 	int ret;
 
-	base = ttm_base_object_lookup(tfile, handle);
+	base = vmwgfx_base_object_lookup(tfile, handle);
 	if (unlikely(base == NULL ||
-		     base->object_type != ttm_prime_type)) {
+		     base->object_type != vmwgfx_prime_type)) {
 		ret = -ENOENT;
 		goto out_unref;
 	}
 
-	prime = container_of(base, struct ttm_prime_object, base);
+	prime = container_of(base, struct vmwgfx_prime_object, base);
 	if (unlikely(!base->shareable)) {
 		ret = -EPERM;
 		goto out_unref;
@@ -735,40 +735,40 @@ int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
 
 out_unref:
 	if (base)
-		ttm_base_object_unref(&base);
+		vmwgfx_base_object_unref(&base);
 	return ret;
 }
-EXPORT_SYMBOL_GPL(ttm_prime_handle_to_fd);
+EXPORT_SYMBOL_GPL(vmwgfx_prime_handle_to_fd);
 
 /**
- * ttm_prime_object_init - Initialize a ttm_prime_object
+ * vmwgfx_prime_object_init - Initialize a vmwgfx_prime_object
  *
- * @tfile: struct ttm_object_file identifying the caller
+ * @tfile: struct vmwgfx_object_file identifying the caller
  * @size: The size of the dma_bufs we export.
  * @prime: The object to be initialized.
- * @shareable: See ttm_base_object_init
- * @type: See ttm_base_object_init
- * @refcount_release: See ttm_base_object_init
- * @ref_obj_release: See ttm_base_object_init
+ * @shareable: See vmwgfx_base_object_init
+ * @type: See vmwgfx_base_object_init
+ * @refcount_release: See vmwgfx_base_object_init
+ * @ref_obj_release: See vmwgfx_base_object_init
  *
  * Initializes an object which is compatible with the drm_prime model
  * for data sharing between processes and devices.
  */
-int ttm_prime_object_init(struct ttm_object_file *tfile, size_t size,
-			  struct ttm_prime_object *prime, bool shareable,
-			  enum ttm_object_type type,
-			  void (*refcount_release) (struct ttm_base_object **),
-			  void (*ref_obj_release) (struct ttm_base_object *,
-						   enum ttm_ref_type ref_type))
+int vmwgfx_prime_object_init(struct vmwgfx_object_file *tfile, size_t size,
+			  struct vmwgfx_prime_object *prime, bool shareable,
+			  enum vmwgfx_object_type type,
+			  void (*refcount_release) (struct vmwgfx_base_object **),
+			  void (*ref_obj_release) (struct vmwgfx_base_object *,
+						   enum vmwgfx_ref_type ref_type))
 {
 	mutex_init(&prime->mutex);
 	prime->size = PAGE_ALIGN(size);
 	prime->real_type = type;
 	prime->dma_buf = NULL;
 	prime->refcount_release = refcount_release;
-	return ttm_base_object_init(tfile, &prime->base, shareable,
-				    ttm_prime_type,
+	return vmwgfx_base_object_init(tfile, &prime->base, shareable,
+				    vmwgfx_prime_type,
 				    ttm_prime_refcount_release,
 				    ref_obj_release);
 }
-EXPORT_SYMBOL(ttm_prime_object_init);
+EXPORT_SYMBOL(vmwgfx_prime_object_init);
diff --git a/include/drm/ttm/ttm_object.h b/drivers/gpu/drm/vmwgfx/vmwgfx_object.h
similarity index 57%
rename from include/drm/ttm/ttm_object.h
rename to drivers/gpu/drm/vmwgfx/vmwgfx_object.h
index a98bfeb4239e..b69acfab8fac 100644
--- a/include/drm/ttm/ttm_object.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_object.h
@@ -27,78 +27,77 @@
 /*
  * Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
  */
-/** @file ttm_object.h
+/** @file vmwgfx_object.h
  *
  * Base- and reference object implementation for the various
  * ttm objects. Implements reference counting, minimal security checks
  * and release on file close.
  */
 
-#ifndef _TTM_OBJECT_H_
-#define _TTM_OBJECT_H_
+#ifndef _VMWGFX_OBJECT_H_
+#define _VMWGFX_OBJECT_H_
 
 #include <linux/list.h>
 #include <drm/drm_hashtab.h>
+#include <drm/ttm/ttm_memory.h>
 #include <linux/kref.h>
 #include <linux/rcupdate.h>
 #include <linux/dma-buf.h>
 
-#include "ttm_memory.h"
-
 /**
- * enum ttm_ref_type
+ * enum vmwgfx_ref_type
  *
  * Describes what type of reference a ref object holds.
  *
- * TTM_REF_USAGE is a simple refcount on a base object.
+ * VMWGFX_REF_USAGE is a simple refcount on a base object.
  *
- * TTM_REF_SYNCCPU_READ is a SYNCCPU_READ reference on a
+ * VMWGFX_REF_SYNCCPU_READ is a SYNCCPU_READ reference on a
  * buffer object.
  *
- * TTM_REF_SYNCCPU_WRITE is a SYNCCPU_WRITE reference on a
+ * VMWGFX_REF_SYNCCPU_WRITE is a SYNCCPU_WRITE reference on a
  * buffer object.
  *
  */
 
-enum ttm_ref_type {
-	TTM_REF_USAGE,
-	TTM_REF_SYNCCPU_READ,
-	TTM_REF_SYNCCPU_WRITE,
-	TTM_REF_NUM
+enum vmwgfx_ref_type {
+	VMWGFX_REF_USAGE,
+	VMWGFX_REF_SYNCCPU_READ,
+	VMWGFX_REF_SYNCCPU_WRITE,
+	VMWGFX_REF_NUM
 };
 
 /**
- * enum ttm_object_type
+ * enum vmwgfx_object_type
  *
  * One entry per ttm object type.
  * Device-specific types should use the
- * ttm_driver_typex types.
+ * vmwgfx_driver_typex types.
  */
 
-enum ttm_object_type {
-	ttm_fence_type,
-	ttm_buffer_type,
-	ttm_lock_type,
-	ttm_prime_type,
-	ttm_driver_type0 = 256,
-	ttm_driver_type1,
-	ttm_driver_type2,
-	ttm_driver_type3,
-	ttm_driver_type4,
-	ttm_driver_type5
+enum vmwgfx_object_type {
+	vmwgfx_fence_type,
+	vmwgfx_buffer_type,
+	vmwgfx_lock_type,
+	vmwgfx_prime_type,
+	vmwgfx_driver_type0 = 256,
+	vmwgfx_driver_type1,
+	vmwgfx_driver_type2,
+	vmwgfx_driver_type3,
+	vmwgfx_driver_type4,
+	vmwgfx_driver_type5
 };
 
-struct ttm_object_file;
-struct ttm_object_device;
+struct vmwgfx_object_file;
+struct vmwgfx_object_device;
 
 /**
- * struct ttm_base_object
+ * struct vmwgfx_base_object
  *
  * @hash: hash entry for the per-device object hash.
  * @type: derived type this object is base class for.
- * @shareable: Other ttm_object_files can access this object.
+ * @shareable: Other vmwgfx_object_files can access this object.
  *
- * @tfile: Pointer to ttm_object_file of the creator.
+ * @tfile: Pointer to vmwgfx_object_file of the creator.
  * NULL if the object was not created by a user request.
  * (kernel object).
  *
@@ -114,7 +113,7 @@ struct ttm_object_device;
  * "base" should be set to NULL by the function.
  *
  * @ref_obj_release: A function to be called when a reference object
- * with another ttm_ref_type than TTM_REF_USAGE is deleted.
+ * with another vmwgfx_ref_type than VMWGFX_REF_USAGE is deleted.
  * This function may, for example, release a lock held by a user-space
  * process.
  *
@@ -123,108 +122,108 @@ struct ttm_object_device;
  * access and refcounting, minimal access contol and hooks for unref actions.
  */
 
-struct ttm_base_object {
+struct vmwgfx_base_object {
 	struct rcu_head rhead;
 	struct drm_hash_item hash;
-	enum ttm_object_type object_type;
+	enum vmwgfx_object_type object_type;
 	bool shareable;
-	struct ttm_object_file *tfile;
+	struct vmwgfx_object_file *tfile;
 	struct kref refcount;
-	void (*refcount_release) (struct ttm_base_object **base);
-	void (*ref_obj_release) (struct ttm_base_object *base,
-				 enum ttm_ref_type ref_type);
+	void (*refcount_release) (struct vmwgfx_base_object **base);
+	void (*ref_obj_release) (struct vmwgfx_base_object *base,
+				 enum vmwgfx_ref_type ref_type);
 };
 
 
 /**
- * struct ttm_prime_object - Modified base object that is prime-aware
+ * struct vmwgfx_prime_object - Modified base object that is prime-aware
  *
- * @base: struct ttm_base_object that we derive from
+ * @base: struct vmwgfx_base_object that we derive from
  * @mutex: Mutex protecting the @dma_buf member.
  * @size: Size of the dma_buf associated with this object
  * @real_type: Type of the underlying object. Needed since we're setting
- * the value of @base::object_type to ttm_prime_type
+ * the value of @base::object_type to vmwgfx_prime_type
  * @dma_buf: Non ref-coutned pointer to a struct dma_buf created from this
  * object.
  * @refcount_release: The underlying object's release method. Needed since
  * we set @base::refcount_release to our own release method.
  */
 
-struct ttm_prime_object {
-	struct ttm_base_object base;
+struct vmwgfx_prime_object {
+	struct vmwgfx_base_object base;
 	struct mutex mutex;
 	size_t size;
-	enum ttm_object_type real_type;
+	enum vmwgfx_object_type real_type;
 	struct dma_buf *dma_buf;
-	void (*refcount_release) (struct ttm_base_object **);
+	void (*refcount_release) (struct vmwgfx_base_object **);
 };
 
 /**
- * ttm_base_object_init
+ * vmwgfx_base_object_init
  *
- * @tfile: Pointer to a struct ttm_object_file.
- * @base: The struct ttm_base_object to initialize.
+ * @tfile: Pointer to a struct vmwgfx_object_file.
+ * @base: The struct vmwgfx_base_object to initialize.
  * @shareable: This object is shareable with other applcations.
  * (different @tfile pointers.)
  * @type: The object type.
- * @refcount_release: See the struct ttm_base_object description.
- * @ref_obj_release: See the struct ttm_base_object description.
+ * @refcount_release: See the struct vmwgfx_base_object description.
+ * @ref_obj_release: See the struct vmwgfx_base_object description.
  *
- * Initializes a struct ttm_base_object.
+ * Initializes a struct vmwgfx_base_object.
  */
 
-extern int ttm_base_object_init(struct ttm_object_file *tfile,
-				struct ttm_base_object *base,
+extern int vmwgfx_base_object_init(struct vmwgfx_object_file *tfile,
+				struct vmwgfx_base_object *base,
 				bool shareable,
-				enum ttm_object_type type,
-				void (*refcount_release) (struct ttm_base_object
+				enum vmwgfx_object_type type,
+				void (*refcount_release) (struct vmwgfx_base_object
 							  **),
-				void (*ref_obj_release) (struct ttm_base_object
+				void (*ref_obj_release) (struct vmwgfx_base_object
 							 *,
-							 enum ttm_ref_type
+							 enum vmwgfx_ref_type
 							 ref_type));
 
 /**
- * ttm_base_object_lookup
+ * vmwgfx_base_object_lookup
  *
- * @tfile: Pointer to a struct ttm_object_file.
+ * @tfile: Pointer to a struct vmwgfx_object_file.
  * @key: Hash key
  *
- * Looks up a struct ttm_base_object with the key @key.
+ * Looks up a struct vmwgfx_base_object with the key @key.
  */
 
-extern struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file
+extern struct vmwgfx_base_object *vmwgfx_base_object_lookup(struct vmwgfx_object_file
 						      *tfile, uint32_t key);
 
 /**
- * ttm_base_object_lookup_for_ref
+ * vmwgfx_base_object_lookup_for_ref
  *
- * @tdev: Pointer to a struct ttm_object_device.
+ * @tdev: Pointer to a struct vmwgfx_object_device.
  * @key: Hash key
  *
- * Looks up a struct ttm_base_object with the key @key.
+ * Looks up a struct vmwgfx_base_object with the key @key.
  * This function should only be used when the struct tfile associated with the
  * caller doesn't yet have a reference to the base object.
  */
 
-extern struct ttm_base_object *
-ttm_base_object_lookup_for_ref(struct ttm_object_device *tdev, uint32_t key);
+extern struct vmwgfx_base_object *
+vmwgfx_base_object_lookup_for_ref(struct vmwgfx_object_device *tdev, uint32_t key);
 
 /**
- * ttm_base_object_unref
+ * vmwgfx_base_object_unref
  *
- * @p_base: Pointer to a pointer referencing a struct ttm_base_object.
+ * @p_base: Pointer to a pointer referencing a struct vmwgfx_base_object.
  *
  * Decrements the base object refcount and clears the pointer pointed to by
  * p_base.
  */
 
-extern void ttm_base_object_unref(struct ttm_base_object **p_base);
+extern void vmwgfx_base_object_unref(struct vmwgfx_base_object **p_base);
 
 /**
- * ttm_ref_object_add.
+ * vmwgfx_ref_object_add.
  *
- * @tfile: A struct ttm_object_file representing the application owning the
+ * @tfile: A struct vmwgfx_object_file representing the application owning the
  * ref_object.
  * @base: The base object to reference.
  * @ref_type: The type of reference.
@@ -244,16 +243,16 @@ extern void ttm_base_object_unref(struct ttm_base_object **p_base);
  * make sure the lock is released if the application dies. A ref object
  * will hold a single reference on a base object.
  */
-extern int ttm_ref_object_add(struct ttm_object_file *tfile,
-			      struct ttm_base_object *base,
-			      enum ttm_ref_type ref_type, bool *existed,
+extern int vmwgfx_ref_object_add(struct vmwgfx_object_file *tfile,
+			      struct vmwgfx_base_object *base,
+			      enum vmwgfx_ref_type ref_type, bool *existed,
 			      bool require_existed);
 
-extern bool ttm_ref_object_exists(struct ttm_object_file *tfile,
-				  struct ttm_base_object *base);
+extern bool vmwgfx_ref_object_exists(struct vmwgfx_object_file *tfile,
+				  struct vmwgfx_base_object *base);
 
 /**
- * ttm_ref_object_base_unref
+ * vmwgfx_ref_object_base_unref
  *
  * @key: Key representing the base object.
  * @ref_type: Ref type of the ref object to be dereferenced.
@@ -263,38 +262,38 @@ extern bool ttm_ref_object_exists(struct ttm_object_file *tfile,
  * references, the ref object will be destroyed and the base object
  * will be unreferenced.
  */
-extern int ttm_ref_object_base_unref(struct ttm_object_file *tfile,
+extern int vmwgfx_ref_object_base_unref(struct vmwgfx_object_file *tfile,
 				     unsigned long key,
-				     enum ttm_ref_type ref_type);
+				     enum vmwgfx_ref_type ref_type);
 
 /**
- * ttm_object_file_init - initialize a struct ttm_object file
+ * vmwgfx_object_file_init - initialize a struct vmwgfx_object file
  *
- * @tdev: A struct ttm_object device this file is initialized on.
+ * @tdev: A struct vmwgfx_object device this file is initialized on.
  * @hash_order: Order of the hash table used to hold the reference objects.
  *
  * This is typically called by the file_ops::open function.
  */
 
-extern struct ttm_object_file *ttm_object_file_init(struct ttm_object_device
+extern struct vmwgfx_object_file *vmwgfx_object_file_init(struct vmwgfx_object_device
 						    *tdev,
 						    unsigned int hash_order);
 
 /**
- * ttm_object_file_release - release data held by a ttm_object_file
+ * vmwgfx_object_file_release - release data held by a vmwgfx_object_file
  *
- * @p_tfile: Pointer to pointer to the ttm_object_file object to release.
+ * @p_tfile: Pointer to pointer to the vmwgfx_object_file object to release.
  * *p_tfile will be set to NULL by this function.
  *
- * Releases all data associated by a ttm_object_file.
+ * Releases all data associated by a vmwgfx_object_file.
  * Typically called from file_ops::release. The caller must
  * ensure that there are no concurrent users of tfile.
  */
 
-extern void ttm_object_file_release(struct ttm_object_file **p_tfile);
+extern void vmwgfx_object_file_release(struct vmwgfx_object_file **p_tfile);
 
 /**
- * ttm_object device init - initialize a struct ttm_object_device
+ * vmwgfx_object device init - initialize a struct vmwgfx_object_device
  *
  * @mem_glob: struct ttm_mem_global for memory accounting.
  * @hash_order: Order of hash table used to hash the base objects.
@@ -304,51 +303,51 @@ extern void ttm_object_file_release(struct ttm_object_file **p_tfile);
  * data structures needed for ttm base and ref objects.
  */
 
-extern struct ttm_object_device *
-ttm_object_device_init(struct ttm_mem_global *mem_glob,
+extern struct vmwgfx_object_device *
+vmwgfx_object_device_init(struct ttm_mem_global *mem_glob,
 		       unsigned int hash_order,
 		       const struct dma_buf_ops *ops);
 
 /**
- * ttm_object_device_release - release data held by a ttm_object_device
+ * vmwgfx_object_device_release - release data held by a vmwgfx_object_device
  *
- * @p_tdev: Pointer to pointer to the ttm_object_device object to release.
+ * @p_tdev: Pointer to pointer to the vmwgfx_object_device object to release.
  * *p_tdev will be set to NULL by this function.
  *
- * Releases all data associated by a ttm_object_device.
+ * Releases all data associated by a vmwgfx_object_device.
  * Typically called from driver::unload before the destruction of the
  * device private data structure.
  */
 
-extern void ttm_object_device_release(struct ttm_object_device **p_tdev);
+extern void vmwgfx_object_device_release(struct vmwgfx_object_device **p_tdev);
 
-#define ttm_base_object_kfree(__object, __base)\
+#define vmwgfx_base_object_kfree(__object, __base)\
 	kfree_rcu(__object, __base.rhead)
 
-extern int ttm_prime_object_init(struct ttm_object_file *tfile,
+extern int vmwgfx_prime_object_init(struct vmwgfx_object_file *tfile,
 				 size_t size,
-				 struct ttm_prime_object *prime,
+				 struct vmwgfx_prime_object *prime,
 				 bool shareable,
-				 enum ttm_object_type type,
+				 enum vmwgfx_object_type type,
 				 void (*refcount_release)
-				 (struct ttm_base_object **),
+				 (struct vmwgfx_base_object **),
 				 void (*ref_obj_release)
-				 (struct ttm_base_object *,
-				  enum ttm_ref_type ref_type));
+				 (struct vmwgfx_base_object *,
+				  enum vmwgfx_ref_type ref_type));
 
-static inline enum ttm_object_type
-ttm_base_object_type(struct ttm_base_object *base)
+static inline enum vmwgfx_object_type
+vmwgfx_base_object_type(struct vmwgfx_base_object *base)
 {
-	return (base->object_type == ttm_prime_type) ?
-		container_of(base, struct ttm_prime_object, base)->real_type :
+	return (base->object_type == vmwgfx_prime_type) ?
+		container_of(base, struct vmwgfx_prime_object, base)->real_type :
 		base->object_type;
 }
-extern int ttm_prime_fd_to_handle(struct ttm_object_file *tfile,
+extern int vmwgfx_prime_fd_to_handle(struct vmwgfx_object_file *tfile,
 				  int fd, u32 *handle);
-extern int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
+extern int vmwgfx_prime_handle_to_fd(struct vmwgfx_object_file *tfile,
 				  uint32_t handle, uint32_t flags,
 				  int *prime_fd);
 
-#define ttm_prime_object_kfree(__obj, __prime)		\
+#define vmwgfx_prime_object_kfree(__obj, __prime)		\
 	kfree_rcu(__obj, __prime.base.rhead)
 #endif
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
index 222c9c2123a1..ba4546d1e6fc 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_overlay.c
@@ -461,7 +461,7 @@ static bool vmw_overlay_available(const struct vmw_private *dev_priv)
 int vmw_overlay_ioctl(struct drm_device *dev, void *data,
 		      struct drm_file *file_priv)
 {
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct vmw_private *dev_priv = vmw_priv(dev);
 	struct vmw_overlay *overlay = dev_priv->overlay_priv;
 	struct drm_vmw_control_stream_arg *arg =
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_prime.c b/drivers/gpu/drm/vmwgfx/vmwgfx_prime.c
index 0d42a46521fc..22b548a4d632 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_prime.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_prime.c
@@ -31,8 +31,8 @@
  */
 
 #include "vmwgfx_drv.h"
+#include "vmwgfx_object.h"
 #include <linux/dma-buf.h>
-#include <drm/ttm/ttm_object.h>
 
 /*
  * DMA-BUF attach- and mapping methods. No need to implement
@@ -121,9 +121,9 @@ int vmw_prime_fd_to_handle(struct drm_device *dev,
 			   struct drm_file *file_priv,
 			   int fd, u32 *handle)
 {
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 
-	return ttm_prime_fd_to_handle(tfile, fd, handle);
+	return vmwgfx_prime_fd_to_handle(tfile, fd, handle);
 }
 
 int vmw_prime_handle_to_fd(struct drm_device *dev,
@@ -131,7 +131,7 @@ int vmw_prime_handle_to_fd(struct drm_device *dev,
 			   uint32_t handle, uint32_t flags,
 			   int *prime_fd)
 {
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 
-	return ttm_prime_handle_to_fd(tfile, handle, flags, prime_fd);
+	return vmwgfx_prime_handle_to_fd(tfile, handle, flags, prime_fd);
 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index 200904ff9a22..cec67e100de8 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -26,8 +26,8 @@
  **************************************************************************/
 
 #include "vmwgfx_drv.h"
+#include "vmwgfx_object.h"
 #include <drm/vmwgfx_drm.h>
-#include <drm/ttm/ttm_object.h>
 #include <drm/ttm/ttm_placement.h>
 #include <drm/drmP.h>
 #include "vmwgfx_resource_priv.h"
@@ -36,7 +36,7 @@
 #define VMW_RES_EVICT_ERR_COUNT 10
 
 struct vmw_user_dma_buffer {
-	struct ttm_prime_object prime;
+	struct vmwgfx_prime_object prime;
 	struct vmw_dma_buffer dma;
 };
 
@@ -239,7 +239,7 @@ void vmw_resource_activate(struct vmw_resource *res,
  * TTM user-space handle and perform basic type checks
  *
  * @dev_priv:     Pointer to a device private struct
- * @tfile:        Pointer to a struct ttm_object_file identifying the caller
+ * @tfile:        Pointer to a struct vmwgfx_object_file identifying the caller
  * @handle:       The TTM user-space handle
  * @converter:    Pointer to an object describing the resource type
  * @p_res:        On successful return the location pointed to will contain
@@ -249,21 +249,21 @@ void vmw_resource_activate(struct vmw_resource *res,
  * type, -EINVAL will be returned.
  */
 int vmw_user_resource_lookup_handle(struct vmw_private *dev_priv,
-				    struct ttm_object_file *tfile,
+				    struct vmwgfx_object_file *tfile,
 				    uint32_t handle,
 				    const struct vmw_user_resource_conv
 				    *converter,
 				    struct vmw_resource **p_res)
 {
-	struct ttm_base_object *base;
+	struct vmwgfx_base_object *base;
 	struct vmw_resource *res;
 	int ret = -EINVAL;
 
-	base = ttm_base_object_lookup(tfile, handle);
+	base = vmwgfx_base_object_lookup(tfile, handle);
 	if (unlikely(base == NULL))
 		return -EINVAL;
 
-	if (unlikely(ttm_base_object_type(base) != converter->object_type))
+	if (unlikely(vmwgfx_base_object_type(base) != converter->object_type))
 		goto out_bad_resource;
 
 	res = converter->base_obj_to_res(base);
@@ -281,7 +281,7 @@ int vmw_user_resource_lookup_handle(struct vmw_private *dev_priv,
 	ret = 0;
 
 out_bad_resource:
-	ttm_base_object_unref(&base);
+	vmwgfx_base_object_unref(&base);
 
 	return ret;
 }
@@ -292,7 +292,7 @@ int vmw_user_resource_lookup_handle(struct vmw_private *dev_priv,
  * The pointer this pointed at by out_surf and out_buf needs to be null.
  */
 int vmw_user_lookup_handle(struct vmw_private *dev_priv,
-			   struct ttm_object_file *tfile,
+			   struct vmwgfx_object_file *tfile,
 			   uint32_t handle,
 			   struct vmw_surface **out_surf,
 			   struct vmw_dma_buffer **out_buf)
@@ -361,7 +361,7 @@ static void vmw_user_dmabuf_destroy(struct ttm_buffer_object *bo)
 {
 	struct vmw_user_dma_buffer *vmw_user_bo = vmw_user_dma_buffer(bo);
 
-	ttm_prime_object_kfree(vmw_user_bo, prime);
+	vmwgfx_prime_object_kfree(vmw_user_bo, prime);
 }
 
 int vmw_dmabuf_init(struct vmw_private *dev_priv,
@@ -389,10 +389,10 @@ int vmw_dmabuf_init(struct vmw_private *dev_priv,
 	return ret;
 }
 
-static void vmw_user_dmabuf_release(struct ttm_base_object **p_base)
+static void vmw_user_dmabuf_release(struct vmwgfx_base_object **p_base)
 {
 	struct vmw_user_dma_buffer *vmw_user_bo;
-	struct ttm_base_object *base = *p_base;
+	struct vmwgfx_base_object *base = *p_base;
 	struct ttm_buffer_object *bo;
 
 	*p_base = NULL;
@@ -406,14 +406,14 @@ static void vmw_user_dmabuf_release(struct ttm_base_object **p_base)
 	ttm_bo_unref(&bo);
 }
 
-static void vmw_user_dmabuf_ref_obj_release(struct ttm_base_object *base,
-					    enum ttm_ref_type ref_type)
+static void vmw_user_dmabuf_ref_obj_release(struct vmwgfx_base_object *base,
+					    enum vmwgfx_ref_type ref_type)
 {
 	struct vmw_user_dma_buffer *user_bo;
 	user_bo = container_of(base, struct vmw_user_dma_buffer, prime.base);
 
 	switch (ref_type) {
-	case TTM_REF_SYNCCPU_WRITE:
+	case VMWGFX_REF_SYNCCPU_WRITE:
 		ttm_bo_synccpu_write_release(&user_bo->dma.base);
 		break;
 	default:
@@ -425,7 +425,7 @@ static void vmw_user_dmabuf_ref_obj_release(struct ttm_base_object *base,
  * vmw_user_dmabuf_alloc - Allocate a user dma buffer
  *
  * @dev_priv: Pointer to a struct device private.
- * @tfile: Pointer to a struct ttm_object_file on which to register the user
+ * @tfile: Pointer to a struct vmwgfx_object_file on which to register the user
  * object.
  * @size: Size of the dma buffer.
  * @shareable: Boolean whether the buffer is shareable with other open files.
@@ -434,12 +434,12 @@ static void vmw_user_dmabuf_ref_obj_release(struct ttm_base_object *base,
  * should be assigned.
  */
 int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv,
-			  struct ttm_object_file *tfile,
+			  struct vmwgfx_object_file *tfile,
 			  uint32_t size,
 			  bool shareable,
 			  uint32_t *handle,
 			  struct vmw_dma_buffer **p_dma_buf,
-			  struct ttm_base_object **p_base)
+			  struct vmwgfx_base_object **p_base)
 {
 	struct vmw_user_dma_buffer *user_bo;
 	struct ttm_buffer_object *tmp;
@@ -460,11 +460,11 @@ int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv,
 		return ret;
 
 	tmp = ttm_bo_reference(&user_bo->dma.base);
-	ret = ttm_prime_object_init(tfile,
+	ret = vmwgfx_prime_object_init(tfile,
 				    size,
 				    &user_bo->prime,
 				    shareable,
-				    ttm_buffer_type,
+				    vmwgfx_buffer_type,
 				    &vmw_user_dmabuf_release,
 				    &vmw_user_dmabuf_ref_obj_release);
 	if (unlikely(ret != 0)) {
@@ -491,7 +491,7 @@ int vmw_user_dmabuf_alloc(struct vmw_private *dev_priv,
  * @tfile: Identifying the caller.
  */
 int vmw_user_dmabuf_verify_access(struct ttm_buffer_object *bo,
-				  struct ttm_object_file *tfile)
+				  struct vmwgfx_object_file *tfile)
 {
 	struct vmw_user_dma_buffer *vmw_user_bo;
 
@@ -501,7 +501,7 @@ int vmw_user_dmabuf_verify_access(struct ttm_buffer_object *bo,
 	vmw_user_bo = vmw_user_dma_buffer(bo);
 
 	/* Check that the caller has opened the object. */
-	if (likely(ttm_ref_object_exists(tfile, &vmw_user_bo->prime.base)))
+	if (likely(vmwgfx_ref_object_exists(tfile, &vmw_user_bo->prime.base)))
 		return 0;
 
 	DRM_ERROR("Could not grant buffer access.\n");
@@ -520,7 +520,7 @@ int vmw_user_dmabuf_verify_access(struct ttm_buffer_object *bo,
  * A blocking grab will be automatically released when @tfile is closed.
  */
 static int vmw_user_dmabuf_synccpu_grab(struct vmw_user_dma_buffer *user_bo,
-					struct ttm_object_file *tfile,
+					struct vmwgfx_object_file *tfile,
 					uint32_t flags)
 {
 	struct ttm_buffer_object *bo = &user_bo->dma.base;
@@ -545,8 +545,8 @@ static int vmw_user_dmabuf_synccpu_grab(struct vmw_user_dma_buffer *user_bo,
 	if (unlikely(ret != 0))
 		return ret;
 
-	ret = ttm_ref_object_add(tfile, &user_bo->prime.base,
-				 TTM_REF_SYNCCPU_WRITE, &existed, false);
+	ret = vmwgfx_ref_object_add(tfile, &user_bo->prime.base,
+				 VMWGFX_REF_SYNCCPU_WRITE, &existed, false);
 	if (ret != 0 || existed)
 		ttm_bo_synccpu_write_release(&user_bo->dma.base);
 
@@ -562,12 +562,12 @@ static int vmw_user_dmabuf_synccpu_grab(struct vmw_user_dma_buffer *user_bo,
  * @flags: Flags indicating the type of release.
  */
 static int vmw_user_dmabuf_synccpu_release(uint32_t handle,
-					   struct ttm_object_file *tfile,
+					   struct vmwgfx_object_file *tfile,
 					   uint32_t flags)
 {
 	if (!(flags & drm_vmw_synccpu_allow_cs))
-		return ttm_ref_object_base_unref(tfile, handle,
-						 TTM_REF_SYNCCPU_WRITE);
+		return vmwgfx_ref_object_base_unref(tfile, handle,
+						 VMWGFX_REF_SYNCCPU_WRITE);
 
 	return 0;
 }
@@ -590,8 +590,8 @@ int vmw_user_dmabuf_synccpu_ioctl(struct drm_device *dev, void *data,
 		(struct drm_vmw_synccpu_arg *) data;
 	struct vmw_dma_buffer *dma_buf;
 	struct vmw_user_dma_buffer *user_bo;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
-	struct ttm_base_object *buffer_base;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_base_object *buffer_base;
 	int ret;
 
 	if ((arg->flags & (drm_vmw_synccpu_read | drm_vmw_synccpu_write)) == 0
@@ -613,7 +613,7 @@ int vmw_user_dmabuf_synccpu_ioctl(struct drm_device *dev, void *data,
 				       dma);
 		ret = vmw_user_dmabuf_synccpu_grab(user_bo, tfile, arg->flags);
 		vmw_dmabuf_unreference(&dma_buf);
-		ttm_base_object_unref(&buffer_base);
+		vmwgfx_base_object_unref(&buffer_base);
 		if (unlikely(ret != 0 && ret != -ERESTARTSYS &&
 			     ret != -EBUSY)) {
 			DRM_ERROR("Failed synccpu grab on handle 0x%08x.\n",
@@ -650,7 +650,7 @@ int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data,
 	uint32_t handle;
 	int ret;
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0))
 		return ret;
 
@@ -668,7 +668,7 @@ int vmw_dmabuf_alloc_ioctl(struct drm_device *dev, void *data,
 	vmw_dmabuf_unreference(&dma_buf);
 
 out_no_dmabuf:
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 
 	return ret;
 }
@@ -679,27 +679,27 @@ int vmw_dmabuf_unref_ioctl(struct drm_device *dev, void *data,
 	struct drm_vmw_unref_dmabuf_arg *arg =
 	    (struct drm_vmw_unref_dmabuf_arg *)data;
 
-	return ttm_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
+	return vmwgfx_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
 					 arg->handle,
-					 TTM_REF_USAGE);
+					 VMWGFX_REF_USAGE);
 }
 
-int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile,
+int vmw_user_dmabuf_lookup(struct vmwgfx_object_file *tfile,
 			   uint32_t handle, struct vmw_dma_buffer **out,
-			   struct ttm_base_object **p_base)
+			   struct vmwgfx_base_object **p_base)
 {
 	struct vmw_user_dma_buffer *vmw_user_bo;
-	struct ttm_base_object *base;
+	struct vmwgfx_base_object *base;
 
-	base = ttm_base_object_lookup(tfile, handle);
+	base = vmwgfx_base_object_lookup(tfile, handle);
 	if (unlikely(base == NULL)) {
 		pr_err("Invalid buffer object handle 0x%08lx\n",
 		       (unsigned long)handle);
 		return -ESRCH;
 	}
 
-	if (unlikely(ttm_base_object_type(base) != ttm_buffer_type)) {
-		ttm_base_object_unref(&base);
+	if (unlikely(vmwgfx_base_object_type(base) != vmwgfx_buffer_type)) {
+		vmwgfx_base_object_unref(&base);
 		pr_err("Invalid buffer object handle 0x%08lx\n",
 		       (unsigned long)handle);
 		return -EINVAL;
@@ -711,13 +711,13 @@ int vmw_user_dmabuf_lookup(struct ttm_object_file *tfile,
 	if (p_base)
 		*p_base = base;
 	else
-		ttm_base_object_unref(&base);
+		vmwgfx_base_object_unref(&base);
 	*out = &vmw_user_bo->dma;
 
 	return 0;
 }
 
-int vmw_user_dmabuf_reference(struct ttm_object_file *tfile,
+int vmw_user_dmabuf_reference(struct vmwgfx_object_file *tfile,
 			      struct vmw_dma_buffer *dma_buf,
 			      uint32_t *handle)
 {
@@ -729,8 +729,8 @@ int vmw_user_dmabuf_reference(struct ttm_object_file *tfile,
 	user_bo = container_of(dma_buf, struct vmw_user_dma_buffer, dma);
 
 	*handle = user_bo->prime.base.hash.key;
-	return ttm_ref_object_add(tfile, &user_bo->prime.base,
-				  TTM_REF_USAGE, NULL, false);
+	return vmwgfx_ref_object_add(tfile, &user_bo->prime.base,
+				  VMWGFX_REF_USAGE, NULL, false);
 }
 
 /**
@@ -755,7 +755,7 @@ int vmw_dumb_create(struct drm_file *file_priv,
 	args->pitch = args->width * ((args->bpp + 7) / 8);
 	args->size = args->pitch * args->height;
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0))
 		return ret;
 
@@ -767,7 +767,7 @@ int vmw_dumb_create(struct drm_file *file_priv,
 
 	vmw_dmabuf_unreference(&dma_buf);
 out_no_dmabuf:
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 	return ret;
 }
 
@@ -785,7 +785,7 @@ int vmw_dumb_map_offset(struct drm_file *file_priv,
 			struct drm_device *dev, uint32_t handle,
 			uint64_t *offset)
 {
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct vmw_dma_buffer *out_buf;
 	int ret;
 
@@ -811,8 +811,8 @@ int vmw_dumb_destroy(struct drm_file *file_priv,
 		     struct drm_device *dev,
 		     uint32_t handle)
 {
-	return ttm_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
-					 handle, TTM_REF_USAGE);
+	return vmwgfx_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
+					 handle, VMWGFX_REF_USAGE);
 }
 
 /**
@@ -1451,7 +1451,7 @@ int vmw_resource_pin(struct vmw_resource *res, bool interruptible)
 	struct vmw_private *dev_priv = res->dev_priv;
 	int ret;
 
-	ttm_write_lock(&dev_priv->reservation_sem, interruptible);
+	vmwgfx_write_lock(&dev_priv->reservation_sem, interruptible);
 	mutex_lock(&dev_priv->cmdbuf_mutex);
 	ret = vmw_resource_reserve(res, interruptible, false);
 	if (ret)
@@ -1490,7 +1490,7 @@ int vmw_resource_pin(struct vmw_resource *res, bool interruptible)
 	vmw_resource_unreserve(res, false, NULL, 0UL);
 out_no_reserve:
 	mutex_unlock(&dev_priv->cmdbuf_mutex);
-	ttm_write_unlock(&dev_priv->reservation_sem);
+	vmwgfx_write_unlock(&dev_priv->reservation_sem);
 
 	return ret;
 }
@@ -1508,7 +1508,7 @@ void vmw_resource_unpin(struct vmw_resource *res)
 	struct vmw_private *dev_priv = res->dev_priv;
 	int ret;
 
-	(void) ttm_read_lock(&dev_priv->reservation_sem, false);
+	(void) vmwgfx_read_lock(&dev_priv->reservation_sem, false);
 	mutex_lock(&dev_priv->cmdbuf_mutex);
 
 	ret = vmw_resource_reserve(res, false, true);
@@ -1526,7 +1526,7 @@ void vmw_resource_unpin(struct vmw_resource *res)
 	vmw_resource_unreserve(res, false, NULL, 0UL);
 
 	mutex_unlock(&dev_priv->cmdbuf_mutex);
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 }
 
 /**
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h
index ac05968a832b..e16d03204358 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h
@@ -40,12 +40,12 @@ enum vmw_cmdbuf_res_state {
 
 /**
  * struct vmw_user_resource_conv - Identify a derived user-exported resource
- * type and provide a function to convert its ttm_base_object pointer to
+ * type and provide a function to convert its vmwgfx_base_object pointer to
  * a struct vmw_resource
  */
 struct vmw_user_resource_conv {
-	enum ttm_object_type object_type;
-	struct vmw_resource *(*base_obj_to_res)(struct ttm_base_object *base);
+	enum vmwgfx_object_type object_type;
+	struct vmw_resource *(*base_obj_to_res)(struct vmwgfx_base_object *base);
 	void (*res_free) (struct vmw_resource *res);
 };
 
@@ -128,7 +128,7 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev,
 				 struct drm_file *file_priv,
 				 const struct vmw_simple_resource_func *func);
 struct vmw_resource *
-vmw_simple_resource_lookup(struct ttm_object_file *tfile,
+vmw_simple_resource_lookup(struct vmwgfx_object_file *tfile,
 			   uint32_t handle,
 			   const struct vmw_simple_resource_func *func);
 #endif
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index 73b8e9a16368..ffabce79a005 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -40,7 +40,7 @@ struct vmw_shader {
 };
 
 struct vmw_user_shader {
-	struct ttm_base_object base;
+	struct vmwgfx_base_object base;
 	struct vmw_shader shader;
 };
 
@@ -59,7 +59,7 @@ static size_t vmw_shader_dx_size;
 
 static void vmw_user_shader_free(struct vmw_resource *res);
 static struct vmw_resource *
-vmw_user_shader_base_to_res(struct ttm_base_object *base);
+vmw_user_shader_base_to_res(struct vmwgfx_base_object *base);
 
 static int vmw_gb_shader_create(struct vmw_resource *res);
 static int vmw_gb_shader_bind(struct vmw_resource *res,
@@ -671,7 +671,7 @@ int vmw_dx_shader_add(struct vmw_cmdbuf_res_manager *man,
  */
 
 static struct vmw_resource *
-vmw_user_shader_base_to_res(struct ttm_base_object *base)
+vmw_user_shader_base_to_res(struct vmwgfx_base_object *base)
 {
 	return &(container_of(base, struct vmw_user_shader, base)->
 		 shader.res);
@@ -683,7 +683,7 @@ static void vmw_user_shader_free(struct vmw_resource *res)
 		container_of(res, struct vmw_user_shader, shader.res);
 	struct vmw_private *dev_priv = res->dev_priv;
 
-	ttm_base_object_kfree(ushader, base);
+	vmwgfx_base_object_kfree(ushader, base);
 	ttm_mem_global_free(vmw_mem_glob(dev_priv),
 			    vmw_user_shader_size);
 }
@@ -703,9 +703,9 @@ static void vmw_shader_free(struct vmw_resource *res)
  * base object. It releases the base-object's reference on the resource object.
  */
 
-static void vmw_user_shader_base_release(struct ttm_base_object **p_base)
+static void vmw_user_shader_base_release(struct vmwgfx_base_object **p_base)
 {
-	struct ttm_base_object *base = *p_base;
+	struct vmwgfx_base_object *base = *p_base;
 	struct vmw_resource *res = vmw_user_shader_base_to_res(base);
 
 	*p_base = NULL;
@@ -716,10 +716,10 @@ int vmw_shader_destroy_ioctl(struct drm_device *dev, void *data,
 			      struct drm_file *file_priv)
 {
 	struct drm_vmw_shader_arg *arg = (struct drm_vmw_shader_arg *)data;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 
-	return ttm_ref_object_base_unref(tfile, arg->handle,
-					 TTM_REF_USAGE);
+	return vmwgfx_ref_object_base_unref(tfile, arg->handle,
+					 VMWGFX_REF_USAGE);
 }
 
 static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
@@ -729,7 +729,7 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
 				 SVGA3dShaderType shader_type,
 				 uint8_t num_input_sig,
 				 uint8_t num_output_sig,
-				 struct ttm_object_file *tfile,
+				 struct vmwgfx_object_file *tfile,
 				 u32 *handle)
 {
 	struct vmw_user_shader *ushader;
@@ -782,7 +782,7 @@ static int vmw_user_shader_alloc(struct vmw_private *dev_priv,
 		goto out;
 
 	tmp = vmw_resource_reference(res);
-	ret = ttm_base_object_init(tfile, &ushader->base, false,
+	ret = vmwgfx_base_object_init(tfile, &ushader->base, false,
 				   VMW_RES_SHADER,
 				   &vmw_user_shader_base_release, NULL);
 
@@ -861,7 +861,7 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv,
 			     uint32_t *shader_handle)
 {
 	struct vmw_private *dev_priv = vmw_priv(dev);
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct vmw_dma_buffer *buffer = NULL;
 	SVGA3dShaderType shader_type;
 	int ret;
@@ -896,7 +896,7 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv,
 		goto out_bad_arg;
 	}
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0))
 		goto out_bad_arg;
 
@@ -904,7 +904,7 @@ static int vmw_shader_define(struct drm_device *dev, struct drm_file *file_priv,
 				    shader_type, num_input_sig,
 				    num_output_sig, tfile, shader_handle);
 
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 out_bad_arg:
 	vmw_dmabuf_unreference(&buffer);
 	return ret;
@@ -970,7 +970,7 @@ int vmw_shader_remove(struct vmw_cmdbuf_res_manager *man,
  * unique to the shader type.
  * @bytecode: Pointer to the bytecode of the shader.
  * @shader_type: Shader type.
- * @tfile: Pointer to a struct ttm_object_file that the guest-backed shader is
+ * @tfile: Pointer to a struct vmwgfx_object_file that the guest-backed shader is
  * to be created with.
  * @list: Caller's list of staged command buffer resource actions.
  *
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c
index a0cb310665cc..64518dffd360 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_simple_resource.c
@@ -36,7 +36,7 @@
  * @simple: The embedded struct vmw_simple_resource.
  */
 struct vmw_user_simple_resource {
-	struct ttm_base_object base;
+	struct vmwgfx_base_object base;
 	size_t account_size;
 	struct vmw_simple_resource simple;
 /*
@@ -101,22 +101,22 @@ static void vmw_simple_resource_free(struct vmw_resource *res)
 	struct vmw_private *dev_priv = res->dev_priv;
 	size_t size = usimple->account_size;
 
-	ttm_base_object_kfree(usimple, base);
+	vmwgfx_base_object_kfree(usimple, base);
 	ttm_mem_global_free(vmw_mem_glob(dev_priv), size);
 }
 
 /**
  * vmw_simple_resource_base_release - TTM object release callback
  *
- * @p_base: The struct ttm_base_object member of the simple resource object.
+ * @p_base: The struct vmwgfx_base_object member of the simple resource object.
  *
- * Called when the last reference to the embedded struct ttm_base_object is
+ * Called when the last reference to the embedded struct vmwgfx_base_object is
  * gone. Typically results in an object free, unless there are other
  * references to the embedded struct vmw_resource.
  */
-static void vmw_simple_resource_base_release(struct ttm_base_object **p_base)
+static void vmw_simple_resource_base_release(struct vmwgfx_base_object **p_base)
 {
-	struct ttm_base_object *base = *p_base;
+	struct vmwgfx_base_object *base = *p_base;
 	struct vmw_user_simple_resource *usimple =
 		container_of(base, struct vmw_user_simple_resource, base);
 	struct vmw_resource *res = &usimple->simple.res;
@@ -148,7 +148,7 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data,
 	struct vmw_user_simple_resource *usimple;
 	struct vmw_resource *res;
 	struct vmw_resource *tmp;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct ttm_operation_ctx ctx = {
 		.interruptible = true,
 		.no_wait_gpu = false
@@ -161,13 +161,13 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data,
 	  func->size;
 	account_size = ttm_round_pot(alloc_size) + VMW_IDA_ACC_SIZE;
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (ret)
 		return ret;
 
 	ret = ttm_mem_global_alloc(vmw_mem_glob(dev_priv), account_size,
 				   &ctx);
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 	if (ret) {
 		if (ret != -ERESTARTSYS)
 			DRM_ERROR("Out of graphics memory for %s"
@@ -199,7 +199,7 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data,
 		goto out_ret;
 
 	tmp = vmw_resource_reference(res);
-	ret = ttm_base_object_init(tfile, &usimple->base, false,
+	ret = vmwgfx_base_object_init(tfile, &usimple->base, false,
 				   func->ttm_res_type,
 				   &vmw_simple_resource_base_release, NULL);
 
@@ -219,7 +219,7 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data,
  * vmw_simple_resource_lookup - Look up a simple resource from its user-space
  * handle.
  *
- * @tfile: struct ttm_object_file identifying the caller.
+ * @tfile: struct vmwgfx_object_file identifying the caller.
  * @handle: The user-space handle.
  * @func: The struct vmw_simple_resource_func identifying the simple resource
  * type.
@@ -228,15 +228,15 @@ vmw_simple_resource_create_ioctl(struct drm_device *dev, void *data,
  * successfule. Error pointer otherwise.
  */
 struct vmw_resource *
-vmw_simple_resource_lookup(struct ttm_object_file *tfile,
+vmw_simple_resource_lookup(struct vmwgfx_object_file *tfile,
 			   uint32_t handle,
 			   const struct vmw_simple_resource_func *func)
 {
 	struct vmw_user_simple_resource *usimple;
-	struct ttm_base_object *base;
+	struct vmwgfx_base_object *base;
 	struct vmw_resource *res;
 
-	base = ttm_base_object_lookup(tfile, handle);
+	base = vmwgfx_base_object_lookup(tfile, handle);
 	if (!base) {
 		DRM_ERROR("Invalid %s handle 0x%08lx.\n",
 			  func->res_func.type_name,
@@ -244,8 +244,8 @@ vmw_simple_resource_lookup(struct ttm_object_file *tfile,
 		return ERR_PTR(-ESRCH);
 	}
 
-	if (ttm_base_object_type(base) != func->ttm_res_type) {
-		ttm_base_object_unref(&base);
+	if (vmwgfx_base_object_type(base) != func->ttm_res_type) {
+		vmwgfx_base_object_unref(&base);
 		DRM_ERROR("Invalid type of %s handle 0x%08lx.\n",
 			  func->res_func.type_name,
 			  (unsigned long) handle);
@@ -254,7 +254,7 @@ vmw_simple_resource_lookup(struct ttm_object_file *tfile,
 
 	usimple = container_of(base, typeof(*usimple), base);
 	res = vmw_resource_reference(&usimple->simple.res);
-	ttm_base_object_unref(&base);
+	vmwgfx_base_object_unref(&base);
 
 	return res;
 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index db1bb166845e..e9fdc10ff2c1 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -43,11 +43,11 @@
  * @master: master of the creating client. Used for security check.
  */
 struct vmw_user_surface {
-	struct ttm_prime_object prime;
+	struct vmwgfx_prime_object prime;
 	struct vmw_surface srf;
 	uint32_t size;
 	struct drm_master *master;
-	struct ttm_base_object *backup_base;
+	struct vmwgfx_base_object *backup_base;
 };
 
 /**
@@ -66,7 +66,7 @@ struct vmw_surface_offset {
 
 static void vmw_user_surface_free(struct vmw_resource *res);
 static struct vmw_resource *
-vmw_user_surface_base_to_res(struct ttm_base_object *base);
+vmw_user_surface_base_to_res(struct vmwgfx_base_object *base);
 static int vmw_legacy_srf_bind(struct vmw_resource *res,
 			       struct ttm_validate_buffer *val_buf);
 static int vmw_legacy_srf_unbind(struct vmw_resource *res,
@@ -612,7 +612,7 @@ static int vmw_surface_init(struct vmw_private *dev_priv,
  * for the user-visible object identified by the TTM base object @base.
  */
 static struct vmw_resource *
-vmw_user_surface_base_to_res(struct ttm_base_object *base)
+vmw_user_surface_base_to_res(struct vmwgfx_base_object *base)
 {
 	return &(container_of(base, struct vmw_user_surface,
 			      prime.base)->srf.res);
@@ -636,7 +636,7 @@ static void vmw_user_surface_free(struct vmw_resource *res)
 	kfree(srf->offsets);
 	kfree(srf->sizes);
 	kfree(srf->snooper.image);
-	ttm_prime_object_kfree(user_srf, prime);
+	vmwgfx_prime_object_kfree(user_srf, prime);
 	ttm_mem_global_free(vmw_mem_glob(dev_priv), size);
 }
 
@@ -649,16 +649,16 @@ static void vmw_user_surface_free(struct vmw_resource *res)
  * Drops the base object's reference on its resource, and the
  * pointer pointed to by *p_base is set to NULL.
  */
-static void vmw_user_surface_base_release(struct ttm_base_object **p_base)
+static void vmw_user_surface_base_release(struct vmwgfx_base_object **p_base)
 {
-	struct ttm_base_object *base = *p_base;
+	struct vmwgfx_base_object *base = *p_base;
 	struct vmw_user_surface *user_srf =
 	    container_of(base, struct vmw_user_surface, prime.base);
 	struct vmw_resource *res = &user_srf->srf.res;
 
 	*p_base = NULL;
 	if (user_srf->backup_base)
-		ttm_base_object_unref(&user_srf->backup_base);
+		vmwgfx_base_object_unref(&user_srf->backup_base);
 	vmw_resource_unreference(&res);
 }
 
@@ -674,9 +674,9 @@ int vmw_surface_destroy_ioctl(struct drm_device *dev, void *data,
 			      struct drm_file *file_priv)
 {
 	struct drm_vmw_surface_arg *arg = (struct drm_vmw_surface_arg *)data;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 
-	return ttm_ref_object_base_unref(tfile, arg->sid, TTM_REF_USAGE);
+	return vmwgfx_ref_object_base_unref(tfile, arg->sid, VMWGFX_REF_USAGE);
 }
 
 /**
@@ -699,7 +699,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
 	    (union drm_vmw_surface_create_arg *)data;
 	struct drm_vmw_surface_create_req *req = &arg->req;
 	struct drm_vmw_surface_arg *rep = &arg->rep;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct ttm_operation_ctx ctx = {
 		.interruptible = true,
 		.no_wait_gpu = false
@@ -740,7 +740,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
 		return -EINVAL;
 	}
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0))
 		return ret;
 
@@ -857,7 +857,7 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
 	}
 
 	tmp = vmw_resource_reference(&srf->res);
-	ret = ttm_prime_object_init(tfile, res->backup_size, &user_srf->prime,
+	ret = vmwgfx_prime_object_init(tfile, res->backup_size, &user_srf->prime,
 				    req->shareable, VMW_RES_SURFACE,
 				    &vmw_user_surface_base_release, NULL);
 
@@ -870,18 +870,18 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,
 	rep->sid = user_srf->prime.base.hash.key;
 	vmw_resource_unreference(&res);
 
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 	return 0;
 out_no_copy:
 	kfree(srf->offsets);
 out_no_offsets:
 	kfree(srf->sizes);
 out_no_sizes:
-	ttm_prime_object_kfree(user_srf, prime);
+	vmwgfx_prime_object_kfree(user_srf, prime);
 out_no_user_srf:
 	ttm_mem_global_free(vmw_mem_glob(dev_priv), size);
 out_unlock:
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 	return ret;
 }
 
@@ -891,17 +891,17 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
 			     struct drm_file *file_priv,
 			     uint32_t u_handle,
 			     enum drm_vmw_handle_type handle_type,
-			     struct ttm_base_object **base_p)
+			     struct vmwgfx_base_object **base_p)
 {
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct vmw_user_surface *user_srf;
 	uint32_t handle;
-	struct ttm_base_object *base;
+	struct vmwgfx_base_object *base;
 	int ret;
 	bool require_exist = false;
 
 	if (handle_type == DRM_VMW_HANDLE_PRIME) {
-		ret = ttm_prime_fd_to_handle(tfile, u_handle, &handle);
+		ret = vmwgfx_prime_fd_to_handle(tfile, u_handle, &handle);
 		if (unlikely(ret != 0))
 			return ret;
 	} else {
@@ -918,13 +918,13 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
 	}
 
 	ret = -EINVAL;
-	base = ttm_base_object_lookup_for_ref(dev_priv->tdev, handle);
+	base = vmwgfx_base_object_lookup_for_ref(dev_priv->tdev, handle);
 	if (unlikely(!base)) {
 		DRM_ERROR("Could not find surface to reference.\n");
 		goto out_no_lookup;
 	}
 
-	if (unlikely(ttm_base_object_type(base) != VMW_RES_SURFACE)) {
+	if (unlikely(vmwgfx_base_object_type(base) != VMW_RES_SURFACE)) {
 		DRM_ERROR("Referenced object is not a surface.\n");
 		goto out_bad_resource;
 	}
@@ -941,7 +941,7 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
 		    user_srf->master != file_priv->master)
 			require_exist = true;
 
-		ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL,
+		ret = vmwgfx_ref_object_add(tfile, base, VMWGFX_REF_USAGE, NULL,
 					 require_exist);
 		if (unlikely(ret != 0)) {
 			DRM_ERROR("Could not add a reference to a surface.\n");
@@ -953,10 +953,10 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
 	return 0;
 
 out_bad_resource:
-	ttm_base_object_unref(&base);
+	vmwgfx_base_object_unref(&base);
 out_no_lookup:
 	if (handle_type == DRM_VMW_HANDLE_PRIME)
-		(void) ttm_ref_object_base_unref(tfile, handle, TTM_REF_USAGE);
+		(void) vmwgfx_ref_object_base_unref(tfile, handle, VMWGFX_REF_USAGE);
 
 	return ret;
 }
@@ -977,11 +977,11 @@ int vmw_surface_reference_ioctl(struct drm_device *dev, void *data,
 	    (union drm_vmw_surface_reference_arg *)data;
 	struct drm_vmw_surface_arg *req = &arg->req;
 	struct drm_vmw_surface_create_req *rep = &arg->rep;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct vmw_surface *srf;
 	struct vmw_user_surface *user_srf;
 	struct drm_vmw_size __user *user_sizes;
-	struct ttm_base_object *base;
+	struct vmwgfx_base_object *base;
 	int ret;
 
 	ret = vmw_surface_handle_reference(dev_priv, file_priv, req->sid,
@@ -1004,11 +1004,11 @@ int vmw_surface_reference_ioctl(struct drm_device *dev, void *data,
 	if (unlikely(ret != 0)) {
 		DRM_ERROR("copy_to_user failed %p %u\n",
 			  user_sizes, srf->num_sizes);
-		ttm_ref_object_base_unref(tfile, base->hash.key, TTM_REF_USAGE);
+		vmwgfx_ref_object_base_unref(tfile, base->hash.key, VMWGFX_REF_USAGE);
 		ret = -EFAULT;
 	}
 
-	ttm_base_object_unref(&base);
+	vmwgfx_base_object_unref(&base);
 
 	return ret;
 }
@@ -1276,7 +1276,7 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
 	    (union drm_vmw_gb_surface_create_arg *)data;
 	struct drm_vmw_gb_surface_create_req *req = &arg->req;
 	struct drm_vmw_gb_surface_create_rep *rep = &arg->rep;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	int ret;
 	uint32_t size;
 	uint32_t backup_handle = 0;
@@ -1311,7 +1311,7 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
 	if (drm_is_primary_client(file_priv))
 		user_srf->master = drm_master_get(file_priv->master);
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0))
 		return ret;
 
@@ -1348,7 +1348,7 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
 	}
 
 	tmp = vmw_resource_reference(res);
-	ret = ttm_prime_object_init(tfile, res->backup_size, &user_srf->prime,
+	ret = vmwgfx_prime_object_init(tfile, res->backup_size, &user_srf->prime,
 				    req->drm_surface_flags &
 				    drm_vmw_surface_flag_shareable,
 				    VMW_RES_SURFACE,
@@ -1376,7 +1376,7 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,
 	vmw_resource_unreference(&res);
 
 out_unlock:
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 	return ret;
 }
 
@@ -1396,10 +1396,10 @@ int vmw_gb_surface_reference_ioctl(struct drm_device *dev, void *data,
 	    (union drm_vmw_gb_surface_reference_arg *)data;
 	struct drm_vmw_surface_arg *req = &arg->req;
 	struct drm_vmw_gb_surface_ref_rep *rep = &arg->rep;
-	struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile;
+	struct vmwgfx_object_file *tfile = vmw_fpriv(file_priv)->tfile;
 	struct vmw_surface *srf;
 	struct vmw_user_surface *user_srf;
-	struct ttm_base_object *base;
+	struct vmwgfx_base_object *base;
 	uint32_t backup_handle;
 	int ret = -EINVAL;
 
@@ -1423,8 +1423,8 @@ int vmw_gb_surface_reference_ioctl(struct drm_device *dev, void *data,
 	if (unlikely(ret != 0)) {
 		DRM_ERROR("Could not add a reference to a GB surface "
 			  "backup buffer.\n");
-		(void) ttm_ref_object_base_unref(tfile, base->hash.key,
-						 TTM_REF_USAGE);
+		(void) vmwgfx_ref_object_base_unref(tfile, base->hash.key,
+						 VMWGFX_REF_USAGE);
 		goto out_bad_resource;
 	}
 
@@ -1445,7 +1445,7 @@ int vmw_gb_surface_reference_ioctl(struct drm_device *dev, void *data,
 	rep->crep.buffer_size = srf->res.backup->base.num_pages * PAGE_SIZE;
 
 out_bad_resource:
-	ttm_base_object_unref(&base);
+	vmwgfx_base_object_unref(&base);
 
 	return ret;
 }
@@ -1528,7 +1528,7 @@ int vmw_surface_gb_priv_define(struct drm_device *dev,
 		return -EINVAL;
 	}
 
-	ret = ttm_read_lock(&dev_priv->reservation_sem, true);
+	ret = vmwgfx_read_lock(&dev_priv->reservation_sem, true);
 	if (unlikely(ret != 0))
 		return ret;
 
@@ -1591,13 +1591,13 @@ int vmw_surface_gb_priv_define(struct drm_device *dev,
 	 */
 	ret = vmw_surface_init(dev_priv, srf, vmw_user_surface_free);
 
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 	return ret;
 
 out_no_user_srf:
 	ttm_mem_global_free(vmw_mem_glob(dev_priv), user_accounting_size);
 
 out_unlock:
-	ttm_read_unlock(&dev_priv->reservation_sem);
+	vmwgfx_read_unlock(&dev_priv->reservation_sem);
 	return ret;
 }
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_va.c b/drivers/gpu/drm/vmwgfx/vmwgfx_va.c
index b4162fd78600..72009db37bb4 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_va.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_va.c
@@ -116,8 +116,8 @@ int vmw_stream_unref_ioctl(struct drm_device *dev, void *data,
 {
 	struct drm_vmw_stream_arg *arg = (struct drm_vmw_stream_arg *)data;
 
-	return ttm_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
-					 arg->stream_id, TTM_REF_USAGE);
+	return vmwgfx_ref_object_base_unref(vmw_fpriv(file_priv)->tfile,
+					 arg->stream_id, VMWGFX_REF_USAGE);
 }
 
 /**
@@ -140,7 +140,7 @@ int vmw_stream_claim_ioctl(struct drm_device *dev, void *data,
 /**
  * vmw_user_stream_lookup - Look up a struct vmw_user_stream from a handle.
  * @dev_priv: Pointer to a struct vmw_private.
- * @tfile: struct ttm_object_file identifying the caller.
+ * @tfile: struct vmwgfx_object_file identifying the caller.
  * @inout_id: In: The user-space handle. Out: The stream id.
  * @out: On output contains a refcounted pointer to the embedded
  * struct vmw_resource.
@@ -150,7 +150,7 @@ int vmw_stream_claim_ioctl(struct drm_device *dev, void *data,
  *   Negative error value on failure.
  */
 int vmw_user_stream_lookup(struct vmw_private *dev_priv,
-			   struct ttm_object_file *tfile,
+			   struct vmwgfx_object_file *tfile,
 			   uint32_t *inout_id, struct vmw_resource **out)
 {
 	struct vmw_stream *stream;
