summaryrefslogtreecommitdiff
path: root/linux-core/drm_bo.c
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@hobbes.virtuousgeek.org>2007-04-11 12:51:52 -0700
committerJesse Barnes <jbarnes@hobbes.virtuousgeek.org>2007-04-11 12:51:52 -0700
commit2e21779992bd5026d8ec4dea52466377dbe5a0ed (patch)
tree8d1eaa5f69f87088bf02f47a347751802ebcf468 /linux-core/drm_bo.c
parent8dd75bd601f5fbf9793afc7b869a278050aa17d5 (diff)
Add new buffer object type for kernel allocations that don't initially have a user mapping.
Diffstat (limited to 'linux-core/drm_bo.c')
-rw-r--r--linux-core/drm_bo.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 2107a3a8..a379c741 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -89,6 +89,9 @@ static int drm_bo_vm_pre_move(drm_buffer_object_t * bo, int old_is_pci)
#ifdef DRM_ODD_MM_COMPAT
int ret;
+ if (!bo->map_list.map)
+ return 0;
+
ret = drm_bo_lock_kmm(bo);
if (ret)
return ret;
@@ -96,6 +99,9 @@ static int drm_bo_vm_pre_move(drm_buffer_object_t * bo, int old_is_pci)
if (old_is_pci)
drm_bo_finish_unmap(bo);
#else
+ if (!bo->map_list.map)
+ return 0;
+
drm_bo_unmap_virtual(bo);
#endif
return 0;
@@ -106,6 +112,9 @@ static void drm_bo_vm_post_move(drm_buffer_object_t * bo)
#ifdef DRM_ODD_MM_COMPAT
int ret;
+ if (!bo->map_list.map)
+ return;
+
ret = drm_bo_remap_bound(bo);
if (ret) {
DRM_ERROR("Failed to remap a bound buffer object.\n"
@@ -131,6 +140,11 @@ static int drm_bo_add_ttm(drm_buffer_object_t * bo)
if (!bo->ttm)
ret = -ENOMEM;
break;
+ case drm_bo_type_kernel:
+ bo->ttm = drm_ttm_init(dev, bo->mem.num_pages << PAGE_SHIFT);
+ if (!bo->ttm)
+ ret = -ENOMEM;
+ break;
case drm_bo_type_user:
case drm_bo_type_fake:
break;
@@ -2302,9 +2316,6 @@ void drm_bo_unmap_virtual(drm_buffer_object_t * bo)
loff_t offset = ((loff_t) bo->map_list.hash.key) << PAGE_SHIFT;
loff_t holelen = ((loff_t) bo->mem.num_pages) << PAGE_SHIFT;
- if (!dev->dev_mapping)
- return;
-
unmap_mapping_range(dev->dev_mapping, offset, holelen, 1);
}