summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-08-04 05:55:53 +0300
committerDave Airlie <airlied@redhat.com>2020-08-06 05:31:36 +0300
commit252f8d7b917464f1f5aa51b3c7ac4867e035389a (patch)
tree6cd4c462030c32a03a6ef6d7e405ee031a3f4c64 /drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
parente9172ada44606a8dfaa81be008d3c9a99d766280 (diff)
downloadlinux-252f8d7b917464f1f5aa51b3c7ac4867e035389a.tar.xz
drm/vmwgfx/ttm: convert vram mm init to new code paths
Split out the vram thp init path vs the range manager init. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Dave Airlie <airlied@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-21-airlied@gmail.com
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_drv.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_drv.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 8e67a29471a8..0aecdd73133f 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -620,6 +620,23 @@ static int vmw_dma_masks(struct vmw_private *dev_priv)
return ret;
}
+static int vmw_vram_manager_init(struct vmw_private *dev_priv)
+{
+ int ret;
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+ ret = vmw_thp_init(dev_priv);
+#else
+ struct ttm_mem_type_manager *man = &dev_priv->bdev.man[TTM_PL_VRAM];
+
+ man->available_caching = TTM_PL_FLAG_CACHED;
+ man->default_caching = TTM_PL_FLAG_CACHED;
+
+ ret = ttm_range_man_init(&dev_priv->bdev, man,
+ dev_priv->vram_size >> PAGE_SHIFT);
+#endif
+ dev_priv->bdev.man[TTM_PL_VRAM].use_type = false;
+ return ret;
+}
static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
{
struct vmw_private *dev_priv;
@@ -866,16 +883,12 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
* Enable VRAM, but initially don't use it until SVGA is enabled and
* unhidden.
*/
- dev_priv->bdev.man[TTM_PL_VRAM].func = &vmw_thp_func;
- dev_priv->bdev.man[TTM_PL_VRAM].available_caching = TTM_PL_FLAG_CACHED;
- dev_priv->bdev.man[TTM_PL_VRAM].default_caching = TTM_PL_FLAG_CACHED;
- ret = ttm_bo_init_mm(&dev_priv->bdev, TTM_PL_VRAM,
- (dev_priv->vram_size >> PAGE_SHIFT));
+
+ ret = vmw_vram_manager_init(dev_priv);
if (unlikely(ret != 0)) {
DRM_ERROR("Failed initializing memory manager for VRAM.\n");
goto out_no_vram;
}
- dev_priv->bdev.man[TTM_PL_VRAM].use_type = false;
/*
* "Guest Memory Regions" is an aperture like feature with