mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2026-05-05 01:58:02 +02:00
Allow for 44 bit user-tokens (or drm_file offsets)
This commit is contained in:
parent
418b81c65c
commit
d85b99435f
4 changed files with 17 additions and 16 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue