Lines Matching refs:ref

52  * @ref_hash: Hash tables of ref objects, one per ttm_ref_type,
53 * for fast lookup of ref objects given a base object.
96 * @head: List entry for the per-file list of ref-objects.
100 * @obj: Base object this ref object is referencing.
102 * @ref_type: Type of ref object.
107 * a particular ttm_object_file. It also carries a ref count to avoid creating
108 * multiple ref objects if a ttm_object_file references the same base
262 struct ttm_ref_object *ref;
275 ref = drm_hash_entry(hash, struct ttm_ref_object, hash);
276 refcount_acquire(&ref->kref);
282 ret = ttm_mem_global_alloc(mem_glob, sizeof(*ref),
286 ref = malloc(sizeof(*ref), M_TTM_OBJ_REF, M_WAITOK);
287 if (unlikely(ref == NULL)) {
288 ttm_mem_global_free(mem_glob, sizeof(*ref));
292 ref->hash.key = base->hash.key;
293 ref->obj = base;
294 ref->tfile = tfile;
295 ref->ref_type = ref_type;
296 refcount_init(&ref->kref, 1);
299 ret = drm_ht_insert_item(ht, &ref->hash);
302 list_add_tail(&ref->head, &tfile->ref_list);
313 ttm_mem_global_free(mem_glob, sizeof(*ref));
314 free(ref, M_TTM_OBJ_REF);
320 static void ttm_ref_object_release(struct ttm_ref_object *ref)
322 struct ttm_base_object *base = ref->obj;
323 struct ttm_object_file *tfile = ref->tfile;
327 ht = &tfile->ref_hash[ref->ref_type];
328 (void)drm_ht_remove_item(ht, &ref->hash);
329 list_del(&ref->head);
332 if (ref->ref_type != TTM_REF_USAGE && base->ref_obj_release)
333 base->ref_obj_release(base, ref->ref_type);
335 ttm_base_object_unref(&ref->obj);
336 ttm_mem_global_free(mem_glob, sizeof(*ref));
337 free(ref, M_TTM_OBJ_REF);
345 struct ttm_ref_object *ref;
355 ref = drm_hash_entry(hash, struct ttm_ref_object, hash);
356 if (refcount_release(&ref->kref))
357 ttm_ref_object_release(ref);
364 struct ttm_ref_object *ref;
379 ref = list_entry(list, struct ttm_ref_object, head);
380 ttm_ref_object_release(ref);