Lines Matching refs:tfile

129 	struct ttm_object_file *tfile;  member
135 ttm_object_file_ref(struct ttm_object_file *tfile) in ttm_object_file_ref() argument
137 kref_get(&tfile->refcount); in ttm_object_file_ref()
138 return tfile; in ttm_object_file_ref()
143 struct ttm_object_file *tfile = in ttm_object_file_destroy() local
146 kfree(tfile); in ttm_object_file_destroy()
152 struct ttm_object_file *tfile = *p_tfile; in ttm_object_file_unref() local
155 kref_put(&tfile->refcount, ttm_object_file_destroy); in ttm_object_file_unref()
159 int ttm_base_object_init(struct ttm_object_file *tfile, in ttm_base_object_init() argument
165 struct ttm_object_device *tdev = tfile->tdev; in ttm_base_object_init()
169 base->tfile = ttm_object_file_ref(tfile); in ttm_base_object_init()
182 ret = ttm_ref_object_add(tfile, base, NULL, false); in ttm_base_object_init()
200 struct ttm_object_device *tdev = base->tfile->tdev; in ttm_release_base()
212 ttm_object_file_unref(&base->tfile); in ttm_release_base()
243 ttm_base_object_noref_lookup(struct ttm_object_file *tfile, uint32_t key) in ttm_base_object_noref_lookup() argument
246 struct vmwgfx_open_hash *ht = &tfile->ref_hash; in ttm_base_object_noref_lookup()
261 struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile, in ttm_base_object_lookup() argument
266 struct vmwgfx_open_hash *ht = &tfile->ref_hash; in ttm_base_object_lookup()
297 int ttm_ref_object_add(struct ttm_object_file *tfile, in ttm_ref_object_add() argument
302 struct vmwgfx_open_hash *ht = &tfile->ref_hash; in ttm_ref_object_add()
307 if (base->tfile != tfile && !base->shareable) in ttm_ref_object_add()
336 ref->tfile = tfile; in ttm_ref_object_add()
339 spin_lock(&tfile->lock); in ttm_ref_object_add()
343 list_add_tail(&ref->head, &tfile->ref_list); in ttm_ref_object_add()
345 spin_unlock(&tfile->lock); in ttm_ref_object_add()
351 spin_unlock(&tfile->lock); in ttm_ref_object_add()
360 static void __releases(tfile->lock) __acquires(tfile->lock)
365 struct ttm_object_file *tfile = ref->tfile; in ttm_ref_object_release() local
368 ht = &tfile->ref_hash; in ttm_ref_object_release()
371 spin_unlock(&tfile->lock); in ttm_ref_object_release()
375 spin_lock(&tfile->lock); in ttm_ref_object_release()
378 int ttm_ref_object_base_unref(struct ttm_object_file *tfile, in ttm_ref_object_base_unref() argument
381 struct vmwgfx_open_hash *ht = &tfile->ref_hash; in ttm_ref_object_base_unref()
386 spin_lock(&tfile->lock); in ttm_ref_object_base_unref()
389 spin_unlock(&tfile->lock); in ttm_ref_object_base_unref()
394 spin_unlock(&tfile->lock); in ttm_ref_object_base_unref()
402 struct ttm_object_file *tfile = *p_tfile; in ttm_object_file_release() local
405 spin_lock(&tfile->lock); in ttm_object_file_release()
412 while (!list_empty(&tfile->ref_list)) { in ttm_object_file_release()
413 list = tfile->ref_list.next; in ttm_object_file_release()
418 spin_unlock(&tfile->lock); in ttm_object_file_release()
419 vmwgfx_ht_remove(&tfile->ref_hash); in ttm_object_file_release()
421 ttm_object_file_unref(&tfile); in ttm_object_file_release()
427 struct ttm_object_file *tfile = kmalloc(sizeof(*tfile), GFP_KERNEL); in ttm_object_file_init() local
430 if (unlikely(tfile == NULL)) in ttm_object_file_init()
433 spin_lock_init(&tfile->lock); in ttm_object_file_init()
434 tfile->tdev = tdev; in ttm_object_file_init()
435 kref_init(&tfile->refcount); in ttm_object_file_init()
436 INIT_LIST_HEAD(&tfile->ref_list); in ttm_object_file_init()
438 ret = vmwgfx_ht_create(&tfile->ref_hash, hash_order); in ttm_object_file_init()
442 return tfile; in ttm_object_file_init()
444 vmwgfx_ht_remove(&tfile->ref_hash); in ttm_object_file_init()
446 kfree(tfile); in ttm_object_file_init()
555 struct ttm_object_device *tdev = base->tfile->tdev; in ttm_prime_dmabuf_release()
577 int ttm_prime_fd_to_handle(struct ttm_object_file *tfile, in ttm_prime_fd_to_handle() argument
580 struct ttm_object_device *tdev = tfile->tdev; in ttm_prime_fd_to_handle()
596 ret = ttm_ref_object_add(tfile, base, NULL, false); in ttm_prime_fd_to_handle()
612 int ttm_prime_handle_to_fd(struct ttm_object_file *tfile, in ttm_prime_handle_to_fd() argument
616 struct ttm_object_device *tdev = tfile->tdev; in ttm_prime_handle_to_fd()
622 base = ttm_base_object_lookup(tfile, handle); in ttm_prime_handle_to_fd()
694 int ttm_prime_object_init(struct ttm_object_file *tfile, size_t size, in ttm_prime_object_init() argument
704 return ttm_base_object_init(tfile, &prime->base, shareable, in ttm_prime_object_init()