aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hellstrom <thellstrom@vmware.com>2012-11-21 05:29:13 -0500
committerThomas Hellstrom <thellstrom@vmware.com>2014-01-17 01:52:24 -0500
commitf468911feec94201b4296e3fe7480ebaf278fc4d (patch)
tree5615f531151ecea1511941d96f2b1728178d0691
parentddcda24e3bec1d4c8bcc37e85d1b1b37bf0fecac (diff)
drm/vmwgfx: Detach backing store from its resources when it is evicted
When the backing store buffer is evicted, Issue a readback from the resources and notify the resources that they are no longer bound to a valid backing store. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Zack Rusin <zackr@vmware.com>
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_resource.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
index 1a62eedb0fea..6cd1560c1547 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_resource.c
@@ -1293,11 +1293,54 @@ void vmw_fence_single_bo(struct ttm_buffer_object *bo,
1293 * @mem: The truct ttm_mem_reg indicating to what memory 1293 * @mem: The truct ttm_mem_reg indicating to what memory
1294 * region the move is taking place. 1294 * region the move is taking place.
1295 * 1295 *
1296 * For now does nothing. 1296 * Evicts the Guest Backed hardware resource if the backup
1297 * buffer is being moved out of MOB memory.
1298 * Note that this function should not race with the resource
1299 * validation code as long as it accesses only members of struct
1300 * resource that remain static while bo::res is !NULL and
1301 * while we have @bo reserved. struct resource::backup is *not* a
1302 * static member. The resource validation code will take care
1303 * to set @bo::res to NULL, while having @bo reserved when the
1304 * buffer is no longer bound to the resource, so @bo:res can be
1305 * used to determine whether there is a need to unbind and whether
1306 * it is safe to unbind.
1297 */ 1307 */
1298void vmw_resource_move_notify(struct ttm_buffer_object *bo, 1308void vmw_resource_move_notify(struct ttm_buffer_object *bo,
1299 struct ttm_mem_reg *mem) 1309 struct ttm_mem_reg *mem)
1300{ 1310{
1311 struct vmw_dma_buffer *dma_buf;
1312
1313 if (mem == NULL)
1314 return;
1315
1316 if (bo->destroy != vmw_dmabuf_bo_free &&
1317 bo->destroy != vmw_user_dmabuf_destroy)
1318 return;
1319
1320 dma_buf = container_of(bo, struct vmw_dma_buffer, base);
1321
1322 if (mem->mem_type != VMW_PL_MOB) {
1323 struct vmw_resource *res, *n;
1324 struct ttm_bo_device *bdev = bo->bdev;
1325 struct ttm_validate_buffer val_buf;
1326
1327 val_buf.bo = bo;
1328
1329 list_for_each_entry_safe(res, n, &dma_buf->res_list, mob_head) {
1330
1331 if (unlikely(res->func->unbind == NULL))
1332 continue;
1333
1334 (void) res->func->unbind(res, true, &val_buf);
1335 res->backup_dirty = true;
1336 res->res_dirty = false;
1337 list_del_init(&res->mob_head);
1338 }
1339
1340 spin_lock(&bdev->fence_lock);
1341 (void) ttm_bo_wait(bo, false, false, false);
1342 spin_unlock(&bdev->fence_lock);
1343 }
1301} 1344}
1302 1345
1303/** 1346/**