diff options
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_resource.c')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c index 9e101450cc4d..6b3a942b18df 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | |||
@@ -354,6 +354,7 @@ void vmw_dmabuf_bo_free(struct ttm_buffer_object *bo) | |||
354 | { | 354 | { |
355 | struct vmw_dma_buffer *vmw_bo = vmw_dma_buffer(bo); | 355 | struct vmw_dma_buffer *vmw_bo = vmw_dma_buffer(bo); |
356 | 356 | ||
357 | vmw_dma_buffer_unmap(vmw_bo); | ||
357 | kfree(vmw_bo); | 358 | kfree(vmw_bo); |
358 | } | 359 | } |
359 | 360 | ||
@@ -361,6 +362,7 @@ static void vmw_user_dmabuf_destroy(struct ttm_buffer_object *bo) | |||
361 | { | 362 | { |
362 | struct vmw_user_dma_buffer *vmw_user_bo = vmw_user_dma_buffer(bo); | 363 | struct vmw_user_dma_buffer *vmw_user_bo = vmw_user_dma_buffer(bo); |
363 | 364 | ||
365 | vmw_dma_buffer_unmap(&vmw_user_bo->dma); | ||
364 | ttm_prime_object_kfree(vmw_user_bo, prime); | 366 | ttm_prime_object_kfree(vmw_user_bo, prime); |
365 | } | 367 | } |
366 | 368 | ||
@@ -1239,6 +1241,12 @@ void vmw_resource_move_notify(struct ttm_buffer_object *bo, | |||
1239 | 1241 | ||
1240 | dma_buf = container_of(bo, struct vmw_dma_buffer, base); | 1242 | dma_buf = container_of(bo, struct vmw_dma_buffer, base); |
1241 | 1243 | ||
1244 | /* | ||
1245 | * Kill any cached kernel maps before move. An optimization could | ||
1246 | * be to do this iff source or destination memory type is VRAM. | ||
1247 | */ | ||
1248 | vmw_dma_buffer_unmap(dma_buf); | ||
1249 | |||
1242 | if (mem->mem_type != VMW_PL_MOB) { | 1250 | if (mem->mem_type != VMW_PL_MOB) { |
1243 | struct vmw_resource *res, *n; | 1251 | struct vmw_resource *res, *n; |
1244 | struct ttm_validate_buffer val_buf; | 1252 | struct ttm_validate_buffer val_buf; |
@@ -1262,6 +1270,21 @@ void vmw_resource_move_notify(struct ttm_buffer_object *bo, | |||
1262 | } | 1270 | } |
1263 | 1271 | ||
1264 | 1272 | ||
1273 | /** | ||
1274 | * vmw_resource_swap_notify - swapout notify callback. | ||
1275 | * | ||
1276 | * @bo: The buffer object to be swapped out. | ||
1277 | */ | ||
1278 | void vmw_resource_swap_notify(struct ttm_buffer_object *bo) | ||
1279 | { | ||
1280 | if (bo->destroy != vmw_dmabuf_bo_free && | ||
1281 | bo->destroy != vmw_user_dmabuf_destroy) | ||
1282 | return; | ||
1283 | |||
1284 | /* Kill any cached kernel maps before swapout */ | ||
1285 | vmw_dma_buffer_unmap(vmw_dma_buffer(bo)); | ||
1286 | } | ||
1287 | |||
1265 | 1288 | ||
1266 | /** | 1289 | /** |
1267 | * vmw_query_readback_all - Read back cached query states | 1290 | * vmw_query_readback_all - Read back cached query states |