diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-07-24 15:10:03 -0400 |
---|---|---|
committer | Dave Airlie <airlied@gmail.com> | 2013-07-25 06:47:08 -0400 |
commit | 51335df9f044ccfafb029f4d7fbeb11c4526340a (patch) | |
tree | b2875ee2e4ab79a10c84bdff6a558b336be86838 /drivers/gpu/drm/ttm | |
parent | 72525b3f333de54fa0c42ef87f27861e41478f1e (diff) |
drm/vma: provide drm_vma_node_unmap() helper
Instead of unmapping the nodes in TTM and GEM users manually, we provide
a generic wrapper which does the correct thing for all vma-nodes.
v2: remove bdev->dev_mapping test in ttm_bo_unmap_virtual_unlocked() as
ttm_mem_io_free_vm() does nothing in that case (io_reserved_vm is 0).
v4: Fix docbook comments
v5: use drm_vma_node_size()
Cc: Dave Airlie <airlied@redhat.com>
Cc: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 3dc08b612292..050edfaf5b88 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -1488,17 +1488,8 @@ bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem) | |||
1488 | void ttm_bo_unmap_virtual_locked(struct ttm_buffer_object *bo) | 1488 | void ttm_bo_unmap_virtual_locked(struct ttm_buffer_object *bo) |
1489 | { | 1489 | { |
1490 | struct ttm_bo_device *bdev = bo->bdev; | 1490 | struct ttm_bo_device *bdev = bo->bdev; |
1491 | loff_t offset, holelen; | ||
1492 | 1491 | ||
1493 | if (!bdev->dev_mapping) | 1492 | drm_vma_node_unmap(&bo->vma_node, bdev->dev_mapping); |
1494 | return; | ||
1495 | |||
1496 | if (drm_vma_node_has_offset(&bo->vma_node)) { | ||
1497 | offset = (loff_t) drm_vma_node_offset_addr(&bo->vma_node); | ||
1498 | holelen = ((loff_t) bo->mem.num_pages) << PAGE_SHIFT; | ||
1499 | |||
1500 | unmap_mapping_range(bdev->dev_mapping, offset, holelen, 1); | ||
1501 | } | ||
1502 | ttm_mem_io_free_vm(bo); | 1493 | ttm_mem_io_free_vm(bo); |
1503 | } | 1494 | } |
1504 | 1495 | ||