Lines Matching refs:base
73 * for fast lookup of ref objects given a base object.
118 * that way, one can easily detect whether a base object is referenced by
120 * multiple ref objects if a ttm_object_file references the same base
191 struct ttm_base_object *base,
199 base->shareable = shareable;
200 base->tfile = ttm_object_file_ref(tfile);
201 base->refcount_release = refcount_release;
202 base->object_type = object_type;
203 kref_init(&base->refcount);
206 ret = idr_alloc(&tdev->idr, base, 1, 0, GFP_NOWAIT);
212 base->handle = ret;
213 ret = ttm_ref_object_add(tfile, base, NULL, false);
217 ttm_base_object_unref(&base);
222 idr_remove(&tdev->idr, base->handle);
229 struct ttm_base_object *base =
231 struct ttm_object_device *tdev = base->tfile->tdev;
234 idr_remove(&tdev->idr, base->handle);
243 ttm_object_file_unref(&base->tfile);
244 if (base->refcount_release)
245 base->refcount_release(&base);
250 struct ttm_base_object *base = *p_base;
254 kref_put(&base->refcount, ttm_release_base);
260 struct ttm_base_object *base = NULL;
268 base = hlist_entry(hash, struct ttm_ref_object, hash)->obj;
269 if (!kref_get_unless_zero(&base->refcount))
270 base = NULL;
275 return base;
281 struct ttm_base_object *base;
284 base = idr_find(&tdev->idr, key);
286 if (base && !kref_get_unless_zero(&base->refcount))
287 base = NULL;
290 return base;
294 struct ttm_base_object *base,
302 if (base->tfile != tfile && !base->shareable)
310 ret = ttm_tfile_find_ref_rcu(tfile, base->handle, &hash);
329 ref->hash.key = base->handle;
330 ref->obj = base;
339 kref_get(&base->refcount);
437 * Our base is at VMWGFX_NUM_MOB + 1 because we want to create
488 * This function is called when all references to the base object we
493 struct ttm_base_object *base = *p_base;
497 prime = container_of(base, struct ttm_prime_object, base);
501 prime->refcount_release(&base);
511 * and finally releases the reference the dma_buf has on our base
518 struct ttm_base_object *base = &prime->base;
519 struct ttm_object_device *tdev = base->tfile->tdev;
527 ttm_base_object_unref(&base);
531 * ttm_prime_fd_to_handle - Get a base object handle from a prime fd
547 struct ttm_base_object *base;
558 base = &prime->base;
559 *handle = base->handle;
560 ret = ttm_ref_object_add(tfile, base, NULL, false);
581 struct ttm_base_object *base;
586 base = ttm_base_object_lookup(tfile, handle);
587 if (unlikely(base == NULL ||
588 base->object_type != ttm_prime_type)) {
593 prime = container_of(base, struct ttm_prime_object, base);
594 if (unlikely(!base->shareable)) {
625 * dma_buf has taken the base object reference
627 base = NULL;
640 if (base)
641 ttm_base_object_unref(&base);
668 return ttm_base_object_init(tfile, &prime->base, shareable,