Lines Matching defs:tfile

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