Lines Matching refs:ref
260 struct ttm_ref_object *ref; in ttm_ref_object_add() local
273 ref = drm_hash_entry(hash, struct ttm_ref_object, hash); in ttm_ref_object_add()
274 refcount_acquire(&ref->kref); in ttm_ref_object_add()
280 ret = ttm_mem_global_alloc(mem_glob, sizeof(*ref), in ttm_ref_object_add()
284 ref = malloc(sizeof(*ref), M_TTM_OBJ_REF, M_WAITOK); in ttm_ref_object_add()
285 ref->hash.key = base->hash.key; in ttm_ref_object_add()
286 ref->obj = base; in ttm_ref_object_add()
287 ref->tfile = tfile; in ttm_ref_object_add()
288 ref->ref_type = ref_type; in ttm_ref_object_add()
289 refcount_init(&ref->kref, 1); in ttm_ref_object_add()
292 ret = drm_ht_insert_item(ht, &ref->hash); in ttm_ref_object_add()
295 list_add_tail(&ref->head, &tfile->ref_list); in ttm_ref_object_add()
306 ttm_mem_global_free(mem_glob, sizeof(*ref)); in ttm_ref_object_add()
307 free(ref, M_TTM_OBJ_REF); in ttm_ref_object_add()
313 static void ttm_ref_object_release(struct ttm_ref_object *ref) in ttm_ref_object_release() argument
315 struct ttm_base_object *base = ref->obj; in ttm_ref_object_release()
316 struct ttm_object_file *tfile = ref->tfile; in ttm_ref_object_release()
320 ht = &tfile->ref_hash[ref->ref_type]; in ttm_ref_object_release()
321 (void)drm_ht_remove_item(ht, &ref->hash); in ttm_ref_object_release()
322 list_del(&ref->head); in ttm_ref_object_release()
325 if (ref->ref_type != TTM_REF_USAGE && base->ref_obj_release) in ttm_ref_object_release()
326 base->ref_obj_release(base, ref->ref_type); in ttm_ref_object_release()
328 ttm_base_object_unref(&ref->obj); in ttm_ref_object_release()
329 ttm_mem_global_free(mem_glob, sizeof(*ref)); in ttm_ref_object_release()
330 free(ref, M_TTM_OBJ_REF); in ttm_ref_object_release()
338 struct ttm_ref_object *ref; in ttm_ref_object_base_unref() local
348 ref = drm_hash_entry(hash, struct ttm_ref_object, hash); in ttm_ref_object_base_unref()
349 if (refcount_release(&ref->kref)) in ttm_ref_object_base_unref()
350 ttm_ref_object_release(ref); in ttm_ref_object_base_unref()
357 struct ttm_ref_object *ref; in ttm_object_file_release() local
372 ref = list_entry(list, struct ttm_ref_object, head); in ttm_object_file_release()
373 ttm_ref_object_release(ref); in ttm_object_file_release()