Lines Matching full:ref

50  * @ref_hash: Hash tables of ref objects, one per ttm_ref_type,
51 * for fast lookup of ref objects given a base object.
94 * @head: List entry for the per-file list of ref-objects.
96 * @kref: Ref count.
98 * @obj: Base object this ref object is referencing.
100 * @ref_type: Type of ref object.
105 * a particular ttm_object_file. It also carries a ref count to avoid creating
106 * multiple ref objects if a ttm_object_file references the same base
253 MALLOC_DEFINE(M_TTM_OBJ_REF, "ttm_obj_ref", "TTM Ref Objects");
260 struct ttm_ref_object *ref;
273 ref = drm_hash_entry(hash, struct ttm_ref_object, hash);
274 refcount_acquire(&ref->kref);
280 ret = ttm_mem_global_alloc(mem_glob, sizeof(*ref),
284 ref = malloc(sizeof(*ref), M_TTM_OBJ_REF, M_WAITOK);
285 ref->hash.key = base->hash.key;
286 ref->obj = base;
287 ref->tfile = tfile;
288 ref->ref_type = ref_type;
289 refcount_init(&ref->kref, 1);
292 ret = drm_ht_insert_item(ht, &ref->hash);
295 list_add_tail(&ref->head, &tfile->ref_list);
306 ttm_mem_global_free(mem_glob, sizeof(*ref));
307 free(ref, M_TTM_OBJ_REF);
313 static void ttm_ref_object_release(struct ttm_ref_object *ref)
315 struct ttm_base_object *base = ref->obj;
316 struct ttm_object_file *tfile = ref->tfile;
320 ht = &tfile->ref_hash[ref->ref_type];
321 (void)drm_ht_remove_item(ht, &ref->hash);
322 list_del(&ref->head);
325 if (ref->ref_type != TTM_REF_USAGE && base->ref_obj_release)
326 base->ref_obj_release(base, ref->ref_type);
328 ttm_base_object_unref(&ref->obj);
329 ttm_mem_global_free(mem_glob, sizeof(*ref));
330 free(ref, M_TTM_OBJ_REF);
338 struct ttm_ref_object *ref;
348 ref = drm_hash_entry(hash, struct ttm_ref_object, hash);
349 if (refcount_release(&ref->kref))
350 ttm_ref_object_release(ref);
357 struct ttm_ref_object *ref;
372 ref = list_entry(list, struct ttm_ref_object, head);
373 ttm_ref_object_release(ref);