]> err.no Git - linux-2.6/commitdiff
drm: Allow for 44 bit user-tokens (or drm_file offsets)
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>
Thu, 8 Feb 2007 05:14:05 +0000 (16:14 +1100)
committerDave Airlie <airlied@linux.ie>
Thu, 8 Feb 2007 05:14:05 +0000 (16:14 +1100)
drivers/char/drm/drm_bufs.c
drivers/char/drm/drm_proc.c
drivers/char/drm/drm_vm.c

index d917c8cb8a36226cc492ec50f2794e57d7fa3820..a6828cc14e584e9961442c1303a85de86778fac4 100644 (file)
@@ -79,14 +79,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);
 }
 
 /**
@@ -262,7 +262,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;
@@ -347,7 +347,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;
                }
index 62d5fe15f0468971b9017c1b932c3c1fcd5be819..7fd0da712142cdc78d9e96450e026e8550373404 100644 (file)
@@ -500,7 +500,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,
@@ -510,7 +510,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' : '-',
-                              vma->vm_pgoff << PAGE_SHIFT);
+                              vma->vm_pgoff);
 
 #if defined(__i386__)
                pgprot = pgprot_val(vma->vm_page_prot);
index 4e480583a27fb6bbe912ef929de53ceca8ce8089..54a632848955143df4bf30d1e49868366782375d 100644 (file)
@@ -70,7 +70,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, vma->vm_pgoff << PAGE_SHIFT, &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);
@@ -463,8 +463,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, vma->vm_pgoff << PAGE_SHIFT);
+       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) {
@@ -537,8 +537,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, vma->vm_pgoff << PAGE_SHIFT);
+       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;
@@ -547,7 +547,7 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
         * the AGP mapped at physical address 0
         * --BenH.
         */
-       if (!(vma->vm_pgoff << PAGE_SHIFT)
+       if (!vma->vm_pgoff
 #if __OS_HAS_AGP
            && (!dev->agp
                || dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE)
@@ -555,7 +555,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, vma->vm_pgoff << PAGE_SHIFT, &hash)) {
+       if (drm_ht_find_item(&dev->map_hash, vma->vm_pgoff, &hash)) {
                DRM_ERROR("Could not find map\n");
                return -EINVAL;
        }