{
int ret;
unsigned long a_size = drm_size_align(size);
-
+
spin_lock(&drm_memctl.lock);
- ret = ((drm_memctl.cur_used + a_size) > drm_memctl.high_threshold) ?
+ ret = ((drm_memctl.cur_used + a_size) > drm_memctl.high_threshold) ?
-ENOMEM : 0;
- if (!ret)
+ if (!ret)
drm_memctl.cur_used += a_size;
spin_unlock(&drm_memctl.lock);
return ret;
}
EXPORT_SYMBOL(drm_alloc_memctl);
-
+
void drm_free_memctl(size_t size)
{
unsigned long a_size = drm_size_align(size);
void drm_query_memctl(drm_u64_t *cur_used,
drm_u64_t *low_threshold,
- drm_u64_t *high_threshold)
+ drm_u64_t *high_threshold)
{
spin_lock(&drm_memctl.lock);
*cur_used = drm_memctl.cur_used;
*low_threshold = drm_memctl.low_threshold;
*high_threshold = drm_memctl.high_threshold;
spin_unlock(&drm_memctl.lock);
-}
+}
EXPORT_SYMBOL(drm_query_memctl);
void drm_init_memctl(size_t p_low_threshold,
DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ",
i,
map->offset,
- map->size, type, map->flags,
+ map->size, type, map->flags,
(unsigned long) r_list->user_token);
if (map->mtrr < 0) {
drm_device_t *dev = (drm_device_t *) data;
int len = 0;
drm_buffer_manager_t *bm = &dev->bm;
- drm_fence_manager_t *fm = &dev->fm;
+ drm_fence_manager_t *fm = &dev->fm;
drm_u64_t used_mem;
drm_u64_t low_mem;
drm_u64_t high_mem;
*start = &buf[offset];
*eof = 0;
-
+
DRM_PROC_PRINT("Object accounting:\n\n");
if (fm->initialized) {
- DRM_PROC_PRINT("Number of active fence objects: %d.\n",
+ DRM_PROC_PRINT("Number of active fence objects: %d.\n",
atomic_read(&fm->count));
} else {
DRM_PROC_PRINT("Fence objects are not supported by this driver\n");
}
if (bm->initialized) {
- DRM_PROC_PRINT("Number of active buffer objects: %d.\n\n",
+ DRM_PROC_PRINT("Number of active buffer objects: %d.\n\n",
atomic_read(&bm->count));
}
DRM_PROC_PRINT("Memory accounting:\n\n");
drm_query_memctl(&used_mem, &low_mem, &high_mem);
- if (used_mem > 16*PAGE_SIZE) {
- DRM_PROC_PRINT("Used object memory is %lu pages.\n",
+ if (used_mem > 16*PAGE_SIZE) {
+ DRM_PROC_PRINT("Used object memory is %lu pages.\n",
(unsigned long) (used_mem >> PAGE_SHIFT));
} else {
- DRM_PROC_PRINT("Used object memory is %lu bytes.\n",
+ DRM_PROC_PRINT("Used object memory is %lu bytes.\n",
(unsigned long) used_mem);
}
- DRM_PROC_PRINT("Soft object memory usage threshold is %lu pages.\n",
+ DRM_PROC_PRINT("Soft object memory usage threshold is %lu pages.\n",
(unsigned long) (low_mem >> PAGE_SHIFT));
- DRM_PROC_PRINT("Hard object memory usage threshold is %lu pages.\n",
+ DRM_PROC_PRINT("Hard object memory usage threshold is %lu pages.\n",
(unsigned long) (high_mem >> PAGE_SHIFT));
DRM_PROC_PRINT("\n");
drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
return -ENOMEM;
}
- if (drm_mm_init(&dev->offset_manager, DRM_FILE_PAGE_OFFSET_START,
+ if (drm_mm_init(&dev->offset_manager, DRM_FILE_PAGE_OFFSET_START,
DRM_FILE_PAGE_OFFSET_SIZE)) {
drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
drm_ht_remove(&dev->map_hash);
vma->vm_private_data = (void *)map;
vma->vm_flags |= VM_RESERVED;
break;
- case _DRM_TTM:
+ case _DRM_TTM:
return drm_bo_mmap_locked(vma, filp, map);
default:
return -EINVAL; /* This should never happen. */
*/
#ifdef DRM_FULL_MM_COMPAT
-static unsigned long drm_bo_vm_nopfn(struct vm_area_struct *vma,
+static unsigned long drm_bo_vm_nopfn(struct vm_area_struct *vma,
unsigned long address)
{
drm_buffer_object_t *bo = (drm_buffer_object_t *) vma->vm_private_data;
unsigned long page_offset;
struct page *page = NULL;
- drm_ttm_t *ttm;
+ drm_ttm_t *ttm;
drm_device_t *dev;
unsigned long pfn;
int err;
unsigned long bus_offset;
unsigned long bus_size;
int ret = NOPFN_REFAULT;
-
- if (address > vma->vm_end)
+
+ if (address > vma->vm_end)
return NOPFN_SIGBUS;
-
+
err = mutex_lock_interruptible(&bo->mutex);
if (err)
return NOPFN_REFAULT;
*/
if (!(bo->mem.flags & DRM_BO_FLAG_MAPPABLE)) {
- uint32_t new_mask = bo->mem.mask |
- DRM_BO_FLAG_MAPPABLE |
+ uint32_t new_mask = bo->mem.mask |
+ DRM_BO_FLAG_MAPPABLE |
DRM_BO_FLAG_FORCE_MAPPABLE;
err = drm_bo_move_buffer(bo, new_mask, 0, 0);
if (err) {
}
dev = bo->dev;
- err = drm_bo_pci_offset(dev, &bo->mem, &bus_base, &bus_offset,
+ err = drm_bo_pci_offset(dev, &bo->mem, &bus_base, &bus_offset,
&bus_size);
if (err) {
pfn = page_to_pfn(page);
vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
}
-
+
err = vm_insert_pfn(vma, address, pfn);
if (err) {
ret = (err != -EAGAIN) ? NOPFN_OOM : NOPFN_REFAULT;
drm_bo_vm_open_locked(vma);
#ifdef DRM_ODD_MM_COMPAT
drm_bo_map_bound(vma);
-#endif
+#endif
return 0;
}