summaryrefslogtreecommitdiff
path: root/linux-core/drm_bufs.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2005-06-28 13:02:20 +0000
committerDave Airlie <airlied@linux.ie>2005-06-28 13:02:20 +0000
commit6397722f1990856a9ee268cadd65d78b44b24835 (patch)
tree684c6ad6a83fd589b2f6b03dfe89b224f7a67af8 /linux-core/drm_bufs.c
parent827806f697855c65a8c9821ad410467c48e25d35 (diff)
add compat code from Paul Mackerras
Diffstat (limited to 'linux-core/drm_bufs.c')
-rw-r--r--linux-core/drm_bufs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c
index b54aaeb8..d60d0823 100644
--- a/linux-core/drm_bufs.c
+++ b/linux-core/drm_bufs.c
@@ -109,6 +109,15 @@ int drm_initmap(drm_device_t * dev, unsigned int offset, unsigned int size,
}
EXPORT_SYMBOL(drm_initmap);
+#ifdef CONFIG_COMPAT
+/*
+ * Used to allocate 32-bit handles for _DRM_SHM regions
+ * The 0x10000000 value is chosen to be out of the way of
+ * FB/register and GART physical addresses.
+ */
+static unsigned int map32_handle = 0x10000000;
+#endif
+
/**
* Ioctl to specify a range of memory that is available for mapping by a non-root process.
*
@@ -283,6 +292,13 @@ int drm_addmap(drm_device_t * dev, unsigned int offset,
down(&dev->struct_sem);
list_add(&list->head, &dev->maplist->head);
+#ifdef CONFIG_COMPAT
+ /* Assign a 32-bit handle for _DRM_SHM mappings */
+ /* We do it here so that dev->struct_sem protects the increment */
+ if (map->type == _DRM_SHM)
+ map->offset = map32_handle += PAGE_SIZE;
+#endif
+
up(&dev->struct_sem);
found_it:
*map_ptr = map;
@@ -1568,3 +1584,4 @@ int drm_order( unsigned long size )
}
EXPORT_SYMBOL(drm_order);
+