aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2018-06-19 19:20:29 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2018-07-03 20:33:57 +0200
commit098d7d532bf78ea218b46c1d6887cbb43197ab4e (patch)
tree95cac27c6ed35761467a490534b9d51eefffec66 /drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
parentdrm/vmwgfx: Move buffer object related code to vmwgfx_bo.c (diff)
downloadlinux-dev-098d7d532bf78ea218b46c1d6887cbb43197ab4e.tar.xz
linux-dev-098d7d532bf78ea218b46c1d6887cbb43197ab4e.zip
drm/vmwgfx: Optimize the buffer object swap_notify callback somewhat.
Only try to unmap cached maps when the buffer is moved into or out from vram. Otherwise the underlying pages stay the same. Also when unbinding resources from MOBs about to move, make sure we're really moving out of MOB memory. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Sinclair Yeh <syeh@vmware.com> Reviewed-by: Deepak Rawat <drawat@vmware.com>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_bo.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_bo.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
index d950244798fe..87204ff67c09 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
@@ -1105,16 +1105,18 @@ void vmw_bo_move_notify(struct ttm_buffer_object *bo,
vbo = container_of(bo, struct vmw_buffer_object, base);
/*
- * Kill any cached kernel maps before move. An optimization could
- * be to do this iff source or destination memory type is in VRAM.
+ * Kill any cached kernel maps before move to or from VRAM.
+ * With other types of moves, the underlying pages stay the same,
+ * and the map can be kept.
*/
- vmw_bo_unmap(vbo);
+ if (mem->mem_type == TTM_PL_VRAM || bo->mem.mem_type == TTM_PL_VRAM)
+ vmw_bo_unmap(vbo);
/*
* If we're moving a backup MOB out of MOB placement, then make sure we
* read back all resource content first, and unbind the MOB from
* the resource.
*/
- if (mem->mem_type != VMW_PL_MOB)
+ if (mem->mem_type != VMW_PL_MOB && bo->mem.mem_type == VMW_PL_MOB)
vmw_resource_unbind_list(vbo);
}