summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/drmP.h6
-rw-r--r--linux-core/drm_bufs.c17
-rw-r--r--linux-core/radeon_drv.c3
-rw-r--r--shared-core/radeon_drv.h2
4 files changed, 28 insertions, 0 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index ff2af8cf..9c0e5b84 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -274,6 +274,9 @@ do { \
typedef int drm_ioctl_t(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
+ unsigned long arg);
+
typedef struct drm_ioctl_desc {
drm_ioctl_t *func;
int auth_needed;
@@ -758,6 +761,9 @@ extern void __exit drm_exit(struct drm_driver *driver);
extern void __exit drm_cleanup_pci(struct pci_dev *pdev);
extern int drm_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+extern long drm_compat_ioctl(struct file *filp,
+ unsigned int cmd, unsigned long arg);
+
extern int drm_takedown(drm_device_t * dev);
/* Device support (drm_fops.h) */
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);
+
diff --git a/linux-core/radeon_drv.c b/linux-core/radeon_drv.c
index 21f29fc4..7b1aa59e 100644
--- a/linux-core/radeon_drv.c
+++ b/linux-core/radeon_drv.c
@@ -102,6 +102,9 @@ static struct drm_driver driver = {
.mmap = drm_mmap,
.poll = drm_poll,
.fasync = drm_fasync,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = radeon_compat_ioctl,
+#endif
},
.pci_driver = {
.name = DRIVER_NAME,
diff --git a/shared-core/radeon_drv.h b/shared-core/radeon_drv.h
index 242f3cf2..8b05aab8 100644
--- a/shared-core/radeon_drv.h
+++ b/shared-core/radeon_drv.h
@@ -311,6 +311,8 @@ extern int radeon_driver_open_helper(drm_device_t * dev,
drm_file_t * filp_priv);
extern void radeon_driver_free_filp_priv(drm_device_t * dev,
drm_file_t * filp_priv);
+extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd,
+ unsigned long arg);
/* Flags for stats.boxes
*/