summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@hobbes.virtuousgeek.org>2007-04-11 12:51:52 -0700
committerDave Airlie <airlied@linux.ie>2007-04-26 16:04:09 +1000
commit3c384a9ad5f964709a237cfe035ea5d6df2da5fa (patch)
tree97ae85517b4fd61ba0d3fe9fa1ce2a9956ddcd91
parent5c8561aae22138880673503d930af7f1b361d071 (diff)
Add new buffer object type for kernel allocations that don't initially have a user mapping.
(cherry picked from commit 2e21779992bd5026d8ec4dea52466377dbe5a0ed)
-rw-r--r--linux-core/drm_bo.c14
-rw-r--r--shared-core/drm.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 450e448c..9501ba6e 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;
diff --git a/shared-core/drm.h b/shared-core/drm.h
index 3c59cd40..9ddb480b 100644
--- a/shared-core/drm.h
+++ b/shared-core/drm.h
@@ -795,6 +795,7 @@ typedef struct drm_fence_arg {
typedef enum {
drm_bo_type_dc,
+ drm_bo_type_kernel, /* for initial kernel allocations */
drm_bo_type_user,
drm_bo_type_fake
}drm_bo_type_t;