Lines Matching defs:tfile
128 struct ttm_object_file *tfile;
134 ttm_object_file_ref(struct ttm_object_file *tfile)
136 kref_get(&tfile->refcount);
137 return tfile;
142 struct ttm_object_file *tfile =
145 kfree(tfile);
151 struct ttm_object_file *tfile = *p_tfile;
154 kref_put(&tfile->refcount, ttm_object_file_destroy);
158 int ttm_base_object_init(struct ttm_object_file *tfile,
166 struct ttm_object_device *tdev = tfile->tdev;
170 base->tfile = ttm_object_file_ref(tfile);
184 ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false);
202 struct ttm_object_device *tdev = base->tfile->tdev;
214 ttm_object_file_unref(&base->tfile);
230 * @tfile: The struct ttm_object_file the object is registered with.
245 ttm_base_object_noref_lookup(struct ttm_object_file *tfile, uint32_t key)
248 struct drm_open_hash *ht = &tfile->ref_hash[TTM_REF_USAGE];
263 struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile,
268 struct drm_open_hash *ht = &tfile->ref_hash[TTM_REF_USAGE];
303 * @tfile: Pointer to a struct ttm_object_file identifying the caller.
306 * Checks wether the caller identified by @tfile has put a valid USAGE
309 bool ttm_ref_object_exists(struct ttm_object_file *tfile,
312 struct drm_open_hash *ht = &tfile->ref_hash[TTM_REF_USAGE];
344 int ttm_ref_object_add(struct ttm_object_file *tfile,
349 struct drm_open_hash *ht = &tfile->ref_hash[ref_type];
352 struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob;
359 if (base->tfile != tfile && !base->shareable)
393 ref->tfile = tfile;
397 spin_lock(&tfile->lock);
401 list_add_tail(&ref->head, &tfile->ref_list);
403 spin_unlock(&tfile->lock);
409 spin_unlock(&tfile->lock);
419 static void __releases(tfile->lock) __acquires(tfile->lock)
425 struct ttm_object_file *tfile = ref->tfile;
427 struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob;
429 ht = &tfile->ref_hash[ref->ref_type];
432 spin_unlock(&tfile->lock);
440 spin_lock(&tfile->lock);
443 int ttm_ref_object_base_unref(struct ttm_object_file *tfile,
446 struct drm_open_hash *ht = &tfile->ref_hash[ref_type];
451 spin_lock(&tfile->lock);
454 spin_unlock(&tfile->lock);
459 spin_unlock(&tfile->lock);
468 struct ttm_object_file *tfile = *p_tfile;
471 spin_lock(&tfile->lock);
478 while (!list_empty(&tfile->ref_list)) {
479 list = tfile->ref_list.next;
484 spin_unlock(&tfile->lock);
486 drm_ht_remove(&tfile->ref_hash[i]);
488 ttm_object_file_unref(&tfile);
494 struct ttm_object_file *tfile = kmalloc(sizeof(*tfile), GFP_KERNEL);
499 if (unlikely(tfile == NULL))
502 spin_lock_init(&tfile->lock);
503 tfile->tdev = tdev;
504 kref_init(&tfile->refcount);
505 INIT_LIST_HEAD(&tfile->ref_list);
508 ret = drm_ht_create(&tfile->ref_hash[i], hash_order);
515 return tfile;
518 drm_ht_remove(&tfile->ref_hash[i]);
520 kfree(tfile);
625 struct ttm_object_device *tdev = base->tfile->tdev;
640 * @tfile: A struct ttm_object_file identifying the caller.
648 int ttm_prime_fd_to_handle(struct ttm_object_file *tfile,
651 struct ttm_object_device *tdev = tfile->tdev;
667 ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false);
677 * @tfile: Struct ttm_object_file identifying the caller.
683 int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
687 struct ttm_object_device *tdev = tfile->tdev;
693 base = ttm_base_object_lookup(tfile, handle);
767 * @tfile: struct ttm_object_file identifying the caller
778 int ttm_prime_object_init(struct ttm_object_file *tfile, size_t size,
790 return ttm_base_object_init(tfile, &prime->base, shareable,