summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-10-02 13:49:43 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-10-02 13:49:43 +0200
commitd85b99435f0ea7a17b3b7be31b53c00632c07177 (patch)
treee0c3418b1ccaba4766dbb26ab5b61bfcf8596536 /linux-core
parent418b81c65c55601d4e414b351db5b8d76db8a109 (diff)
Allow for 44 bit user-tokens (or drm_file offsets)
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_bufs.c9
-rw-r--r--linux-core/drm_proc.c4
-rw-r--r--linux-core/drm_ttm.c6
-rw-r--r--linux-core/drm_vm.c14
4 files changed, 17 insertions, 16 deletions
diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c
index 03659143..dd897a19 100644
--- a/linux-core/drm_bufs.c
+++ b/linux-core/drm_bufs.c
@@ -80,14 +80,14 @@ static int drm_map_handle(drm_device_t *dev, drm_hash_item_t *hash,
if (!use_hashed_handle) {
int ret;
- hash->key = user_token;
+ hash->key = user_token >> PAGE_SHIFT;
ret = drm_ht_insert_item(&dev->map_hash, hash);
if (ret != -EINVAL)
return ret;
}
return drm_ht_just_insert_please(&dev->map_hash, hash,
user_token, 32 - PAGE_SHIFT - 3,
- PAGE_SHIFT, DRM_MAP_HASH_OFFSET);
+ 0, DRM_MAP_HASH_OFFSET >> PAGE_SHIFT);
}
/**
@@ -301,7 +301,7 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
return ret;
}
- list->user_token = list->hash.key;
+ list->user_token = list->hash.key << PAGE_SHIFT;
mutex_unlock(&dev->struct_mutex);
*maplist = list;
@@ -386,7 +386,8 @@ int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map)
if (r_list->map == map) {
list_del(list);
- drm_ht_remove_key(&dev->map_hash, r_list->user_token);
+ drm_ht_remove_key(&dev->map_hash,
+ r_list->user_token >> PAGE_SHIFT);
drm_free(list, sizeof(*list), DRM_MEM_MAPS);
break;
}
diff --git a/linux-core/drm_proc.c b/linux-core/drm_proc.c
index 488d1e71..b0b1748a 100644
--- a/linux-core/drm_proc.c
+++ b/linux-core/drm_proc.c
@@ -572,7 +572,7 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request,
for (pt = dev->vmalist; pt; pt = pt->next) {
if (!(vma = pt->vma))
continue;
- DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx",
+ DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx000",
pt->pid,
vma->vm_start,
vma->vm_end,
@@ -582,7 +582,7 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request,
vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
vma->vm_flags & VM_LOCKED ? 'l' : '-',
vma->vm_flags & VM_IO ? 'i' : '-',
- VM_OFFSET(vma));
+ vma->vm_pgoff);
#if defined(__i386__)
pgprot = pgprot_val(vma->vm_page_prot);
diff --git a/linux-core/drm_ttm.c b/linux-core/drm_ttm.c
index 6790c886..5fbe283e 100644
--- a/linux-core/drm_ttm.c
+++ b/linux-core/drm_ttm.c
@@ -903,13 +903,13 @@ int drm_ttm_object_create(drm_device_t * dev, unsigned long size,
if (drm_ht_just_insert_please(&dev->map_hash, &list->hash,
(unsigned long)map->handle,
- 32 - PAGE_SHIFT - 3, PAGE_SHIFT,
- DRM_MAP_HASH_OFFSET)) {
+ 32 - PAGE_SHIFT - 3, 0,
+ DRM_MAP_HASH_OFFSET >> PAGE_SHIFT)) {
drm_ttm_object_remove(dev, object);
return -ENOMEM;
}
- list->user_token = list->hash.key;
+ list->user_token = list->hash.key << PAGE_SHIFT;
atomic_set(&object->usage, 1);
*ttm_object = object;
diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c
index 76d7fb4e..4755684e 100644
--- a/linux-core/drm_vm.c
+++ b/linux-core/drm_vm.c
@@ -100,7 +100,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
if (!dev->agp || !dev->agp->cant_use_aperture)
goto vm_nopage_error;
- if (drm_ht_find_item(&dev->map_hash, VM_OFFSET(vma), &hash))
+ if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash))
goto vm_nopage_error;
r_list = drm_hash_entry(hash, drm_map_list_t, hash);
@@ -753,8 +753,8 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
lock_kernel();
dev = priv->head->dev;
dma = dev->dma;
- DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
- vma->vm_start, vma->vm_end, VM_OFFSET(vma));
+ DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
+ vma->vm_start, vma->vm_end, vma->vm_pgoff);
/* Length must match exact page count */
if (!dma || (length >> PAGE_SHIFT) != dma->page_count) {
@@ -813,8 +813,8 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
unsigned long offset = 0;
drm_hash_item_t *hash;
- DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
- vma->vm_start, vma->vm_end, VM_OFFSET(vma));
+ DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
+ vma->vm_start, vma->vm_end, vma->vm_pgoff);
if (!priv->authenticated)
return -EACCES;
@@ -823,7 +823,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
* the AGP mapped at physical address 0
* --BenH.
*/
- if (!VM_OFFSET(vma)
+ if (!vma->vm_pgoff
#if __OS_HAS_AGP
&& (!dev->agp
|| dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE)
@@ -831,7 +831,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
)
return drm_mmap_dma(filp, vma);
- if (drm_ht_find_item(&dev->map_hash, VM_OFFSET(vma), &hash)) {
+ if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff , &hash)) {
DRM_ERROR("Could not find map\n");
return -EINVAL;
}