Lines Matching refs:tfile

128 	struct ttm_object_file *tfile;  member
134 ttm_object_file_ref(struct ttm_object_file *tfile) in ttm_object_file_ref() argument
136 kref_get(&tfile->refcount); in ttm_object_file_ref()
137 return tfile; in ttm_object_file_ref()
142 struct ttm_object_file *tfile = in ttm_object_file_destroy() local
145 kfree(tfile); in ttm_object_file_destroy()
151 struct ttm_object_file *tfile = *p_tfile; in ttm_object_file_unref() local
154 kref_put(&tfile->refcount, ttm_object_file_destroy); in ttm_object_file_unref()
158 int ttm_base_object_init(struct ttm_object_file *tfile, in ttm_base_object_init() argument
166 struct ttm_object_device *tdev = tfile->tdev; in ttm_base_object_init()
170 base->tfile = ttm_object_file_ref(tfile); in ttm_base_object_init()
184 ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false); in ttm_base_object_init()
202 struct ttm_object_device *tdev = base->tfile->tdev; in ttm_release_base()
214 ttm_object_file_unref(&base->tfile); in ttm_release_base()
245 ttm_base_object_noref_lookup(struct ttm_object_file *tfile, uint32_t key) in ttm_base_object_noref_lookup() argument
248 struct drm_open_hash *ht = &tfile->ref_hash[TTM_REF_USAGE]; in ttm_base_object_noref_lookup()
263 struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile, in ttm_base_object_lookup() argument
268 struct drm_open_hash *ht = &tfile->ref_hash[TTM_REF_USAGE]; in ttm_base_object_lookup()
309 bool ttm_ref_object_exists(struct ttm_object_file *tfile, in ttm_ref_object_exists() argument
312 struct drm_open_hash *ht = &tfile->ref_hash[TTM_REF_USAGE]; in ttm_ref_object_exists()
344 int ttm_ref_object_add(struct ttm_object_file *tfile, in ttm_ref_object_add() argument
349 struct drm_open_hash *ht = &tfile->ref_hash[ref_type]; in ttm_ref_object_add()
352 struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob; in ttm_ref_object_add()
359 if (base->tfile != tfile && !base->shareable) in ttm_ref_object_add()
393 ref->tfile = tfile; in ttm_ref_object_add()
397 spin_lock(&tfile->lock); in ttm_ref_object_add()
401 list_add_tail(&ref->head, &tfile->ref_list); in ttm_ref_object_add()
403 spin_unlock(&tfile->lock); in ttm_ref_object_add()
409 spin_unlock(&tfile->lock); in ttm_ref_object_add()
419 static void __releases(tfile->lock) __acquires(tfile->lock)
425 struct ttm_object_file *tfile = ref->tfile; in ttm_ref_object_release() local
427 struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob; in ttm_ref_object_release()
429 ht = &tfile->ref_hash[ref->ref_type]; in ttm_ref_object_release()
432 spin_unlock(&tfile->lock); in ttm_ref_object_release()
440 spin_lock(&tfile->lock); in ttm_ref_object_release()
443 int ttm_ref_object_base_unref(struct ttm_object_file *tfile, in ttm_ref_object_base_unref() argument
446 struct drm_open_hash *ht = &tfile->ref_hash[ref_type]; in ttm_ref_object_base_unref()
451 spin_lock(&tfile->lock); in ttm_ref_object_base_unref()
454 spin_unlock(&tfile->lock); in ttm_ref_object_base_unref()
459 spin_unlock(&tfile->lock); in ttm_ref_object_base_unref()
468 struct ttm_object_file *tfile = *p_tfile; in ttm_object_file_release() local
471 spin_lock(&tfile->lock); in ttm_object_file_release()
478 while (!list_empty(&tfile->ref_list)) { in ttm_object_file_release()
479 list = tfile->ref_list.next; in ttm_object_file_release()
484 spin_unlock(&tfile->lock); in ttm_object_file_release()
486 drm_ht_remove(&tfile->ref_hash[i]); in ttm_object_file_release()
488 ttm_object_file_unref(&tfile); in ttm_object_file_release()
494 struct ttm_object_file *tfile = kmalloc(sizeof(*tfile), GFP_KERNEL); in ttm_object_file_init() local
499 if (unlikely(tfile == NULL)) in ttm_object_file_init()
502 spin_lock_init(&tfile->lock); in ttm_object_file_init()
503 tfile->tdev = tdev; in ttm_object_file_init()
504 kref_init(&tfile->refcount); in ttm_object_file_init()
505 INIT_LIST_HEAD(&tfile->ref_list); in ttm_object_file_init()
508 ret = drm_ht_create(&tfile->ref_hash[i], hash_order); in ttm_object_file_init()
515 return tfile; in ttm_object_file_init()
518 drm_ht_remove(&tfile->ref_hash[i]); in ttm_object_file_init()
520 kfree(tfile); in ttm_object_file_init()
625 struct ttm_object_device *tdev = base->tfile->tdev; in ttm_prime_dmabuf_release()
648 int ttm_prime_fd_to_handle(struct ttm_object_file *tfile, in ttm_prime_fd_to_handle() argument
651 struct ttm_object_device *tdev = tfile->tdev; in ttm_prime_fd_to_handle()
667 ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false); in ttm_prime_fd_to_handle()
683 int ttm_prime_handle_to_fd(struct ttm_object_file *tfile, in ttm_prime_handle_to_fd() argument
687 struct ttm_object_device *tdev = tfile->tdev; in ttm_prime_handle_to_fd()
693 base = ttm_base_object_lookup(tfile, handle); in ttm_prime_handle_to_fd()
778 int ttm_prime_object_init(struct ttm_object_file *tfile, size_t size, in ttm_prime_object_init() argument
790 return ttm_base_object_init(tfile, &prime->base, shareable, in ttm_prime_object_init()