]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
drm/vmwgfx: Optimize memory footprint for DMA buffers.
[mv-sheeva.git] / drivers / gpu / drm / vmwgfx / vmwgfx_execbuf.c
index 2e92da5674033cd1af7d1e658d8ac5fa9c5d0a0a..d69caf92ffe78bfc4060f7daf99c10d60af5e6b7 100644 (file)
@@ -487,6 +487,21 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv,
 {
        int ret;
 
+       if (vmw_dmabuf_gmr(bo) != SVGA_GMR_NULL)
+               return 0;
+
+       /**
+        * Put BO in VRAM, only if there is space.
+        */
+
+       ret = ttm_bo_validate(bo, &vmw_vram_sys_placement, true, false);
+       if (unlikely(ret == -ERESTARTSYS))
+               return ret;
+
+       /**
+        * Otherwise, set it up as GMR.
+        */
+
        if (vmw_dmabuf_gmr(bo) != SVGA_GMR_NULL)
                return 0;
 
@@ -494,6 +509,10 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv,
        if (likely(ret == 0 || ret == -ERESTARTSYS))
                return ret;
 
+       /**
+        * If that failed, try VRAM again, this time evicting
+        * previous contents.
+        */
 
        ret = ttm_bo_validate(bo, &vmw_vram_placement, true, false);
        return ret;