Changeset View
Changeset View
Standalone View
Standalone View
user/alc/PQ_LAUNDRY/sys/dev/drm2/ttm/ttm_bo.c
Show First 20 Lines • Show All 1,482 Lines • ▼ Show 20 Lines | if (refcount_release(&glob->kobj_ref)) | ||||
ttm_bo_global_kobj_release(glob); | ttm_bo_global_kobj_release(glob); | ||||
} | } | ||||
int ttm_bo_global_init(struct drm_global_reference *ref) | int ttm_bo_global_init(struct drm_global_reference *ref) | ||||
{ | { | ||||
struct ttm_bo_global_ref *bo_ref = | struct ttm_bo_global_ref *bo_ref = | ||||
container_of(ref, struct ttm_bo_global_ref, ref); | container_of(ref, struct ttm_bo_global_ref, ref); | ||||
struct ttm_bo_global *glob = ref->object; | struct ttm_bo_global *glob = ref->object; | ||||
int ret; | int req, ret; | ||||
int tries; | int tries; | ||||
sx_init(&glob->device_list_mutex, "ttmdlm"); | sx_init(&glob->device_list_mutex, "ttmdlm"); | ||||
mtx_init(&glob->lru_lock, "ttmlru", NULL, MTX_DEF); | mtx_init(&glob->lru_lock, "ttmlru", NULL, MTX_DEF); | ||||
glob->mem_glob = bo_ref->mem_glob; | glob->mem_glob = bo_ref->mem_glob; | ||||
req = VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ; | |||||
tries = 0; | tries = 0; | ||||
retry: | retry: | ||||
glob->dummy_read_page = vm_page_alloc_contig(NULL, 0, | glob->dummy_read_page = vm_page_alloc_contig(NULL, 0, req, | ||||
VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ, | |||||
1, 0, VM_MAX_ADDRESS, PAGE_SIZE, 0, VM_MEMATTR_UNCACHEABLE); | 1, 0, VM_MAX_ADDRESS, PAGE_SIZE, 0, VM_MEMATTR_UNCACHEABLE); | ||||
if (unlikely(glob->dummy_read_page == NULL)) { | if (unlikely(glob->dummy_read_page == NULL)) { | ||||
if (tries < 1) { | if (tries < 1 && vm_page_reclaim_contig(req, 1, | ||||
vm_pageout_grow_cache(tries, 0, VM_MAX_ADDRESS); | 0, VM_MAX_ADDRESS, PAGE_SIZE, 0)) { | ||||
tries++; | tries++; | ||||
goto retry; | goto retry; | ||||
} | } | ||||
ret = -ENOMEM; | ret = -ENOMEM; | ||||
goto out_no_drp; | goto out_no_drp; | ||||
} | } | ||||
INIT_LIST_HEAD(&glob->swap_lru); | INIT_LIST_HEAD(&glob->swap_lru); | ||||
▲ Show 20 Lines • Show All 382 Lines • Show Last 20 Lines |