Lines Matching refs:tfile

116 	struct ttm_object_file *tfile;  member
122 ttm_object_file_ref(struct ttm_object_file *tfile) in ttm_object_file_ref() argument
124 refcount_acquire(&tfile->refcount); in ttm_object_file_ref()
125 return tfile; in ttm_object_file_ref()
128 static void ttm_object_file_destroy(struct ttm_object_file *tfile) in ttm_object_file_destroy() argument
131 free(tfile, M_TTM_OBJ_FILE); in ttm_object_file_destroy()
137 struct ttm_object_file *tfile = *p_tfile; in ttm_object_file_unref() local
140 if (refcount_release(&tfile->refcount)) in ttm_object_file_unref()
141 ttm_object_file_destroy(tfile); in ttm_object_file_unref()
145 int ttm_base_object_init(struct ttm_object_file *tfile, in ttm_base_object_init() argument
153 struct ttm_object_device *tdev = tfile->tdev; in ttm_base_object_init()
157 base->tfile = ttm_object_file_ref(tfile); in ttm_base_object_init()
171 ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL); in ttm_base_object_init()
188 struct ttm_object_device *tdev = base->tfile->tdev; in ttm_release_base()
199 ttm_object_file_unref(&base->tfile); in ttm_release_base()
208 struct ttm_object_device *tdev = base->tfile->tdev; in ttm_base_object_unref()
223 struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile, in ttm_base_object_lookup() argument
226 struct ttm_object_device *tdev = tfile->tdev; in ttm_base_object_lookup()
243 if (tfile != base->tfile && !base->shareable) { in ttm_base_object_lookup()
255 int ttm_ref_object_add(struct ttm_object_file *tfile, in ttm_ref_object_add() argument
259 struct drm_open_hash *ht = &tfile->ref_hash[ref_type]; in ttm_ref_object_add()
262 struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob; in ttm_ref_object_add()
269 rw_rlock(&tfile->lock); in ttm_ref_object_add()
275 rw_runlock(&tfile->lock); in ttm_ref_object_add()
279 rw_runlock(&tfile->lock); in ttm_ref_object_add()
287 ref->tfile = tfile; in ttm_ref_object_add()
291 rw_wlock(&tfile->lock); in ttm_ref_object_add()
295 list_add_tail(&ref->head, &tfile->ref_list); in ttm_ref_object_add()
297 rw_wunlock(&tfile->lock); in ttm_ref_object_add()
303 rw_wunlock(&tfile->lock); in ttm_ref_object_add()
316 struct ttm_object_file *tfile = ref->tfile; in ttm_ref_object_release() local
318 struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob; in ttm_ref_object_release()
320 ht = &tfile->ref_hash[ref->ref_type]; in ttm_ref_object_release()
323 rw_wunlock(&tfile->lock); in ttm_ref_object_release()
331 rw_wlock(&tfile->lock); in ttm_ref_object_release()
334 int ttm_ref_object_base_unref(struct ttm_object_file *tfile, in ttm_ref_object_base_unref() argument
337 struct drm_open_hash *ht = &tfile->ref_hash[ref_type]; in ttm_ref_object_base_unref()
342 rw_wlock(&tfile->lock); in ttm_ref_object_base_unref()
345 rw_wunlock(&tfile->lock); in ttm_ref_object_base_unref()
351 rw_wunlock(&tfile->lock); in ttm_ref_object_base_unref()
360 struct ttm_object_file *tfile = *p_tfile; in ttm_object_file_release() local
363 rw_wlock(&tfile->lock); in ttm_object_file_release()
370 while (!list_empty(&tfile->ref_list)) { in ttm_object_file_release()
371 list = tfile->ref_list.next; in ttm_object_file_release()
377 drm_ht_remove(&tfile->ref_hash[i]); in ttm_object_file_release()
379 rw_wunlock(&tfile->lock); in ttm_object_file_release()
380 ttm_object_file_unref(&tfile); in ttm_object_file_release()
386 struct ttm_object_file *tfile; in ttm_object_file_init() local
391 tfile = malloc(sizeof(*tfile), M_TTM_OBJ_FILE, M_WAITOK); in ttm_object_file_init()
392 rw_init(&tfile->lock, "ttmfo"); in ttm_object_file_init()
393 tfile->tdev = tdev; in ttm_object_file_init()
394 refcount_init(&tfile->refcount, 1); in ttm_object_file_init()
395 INIT_LIST_HEAD(&tfile->ref_list); in ttm_object_file_init()
398 ret = drm_ht_create(&tfile->ref_hash[i], hash_order); in ttm_object_file_init()
405 return tfile; in ttm_object_file_init()
408 drm_ht_remove(&tfile->ref_hash[i]); in ttm_object_file_init()
410 free(tfile, M_TTM_OBJ_FILE); in ttm_object_file_init()