Lines Matching full:fence
37 #include <linux/dma-fence-array.h>
49 * can have any number of fences attaches to it. Each fence carries an usage
50 * parameter determining how the operation represented by the fence is using the
60 /* Mask for the lower fence pointer bits */
69 /* Extract the fence and usage flags from an RCU protected entry in the list. */
71 struct dma_resv *resv, struct dma_fence **fence, in dma_resv_list_entry() argument
78 *fence = (struct dma_fence *)(tmp & ~DMA_RESV_LIST_MASK); in dma_resv_list_entry()
83 /* Set the fence and usage flags at the specific index in the list. */
86 struct dma_fence *fence, in dma_resv_list_set() argument
89 long tmp = ((long)fence) | usage; in dma_resv_list_set()
126 struct dma_fence *fence; in dma_resv_list_free() local
128 dma_resv_list_entry(list, i, NULL, &fence, NULL); in dma_resv_list_free()
129 dma_fence_put(fence); in dma_resv_list_free()
210 * no need to bump fence refcounts, rcu_read access in dma_resv_reserve_fences()
217 struct dma_fence *fence; in dma_resv_reserve_fences() local
219 dma_resv_list_entry(old, i, obj, &fence, &usage); in dma_resv_reserve_fences()
220 if (dma_fence_is_signaled(fence)) in dma_resv_reserve_fences()
221 RCU_INIT_POINTER(new->table[--k], fence); in dma_resv_reserve_fences()
223 dma_resv_list_set(new, j++, fence, usage); in dma_resv_reserve_fences()
242 struct dma_fence *fence; in dma_resv_reserve_fences() local
244 fence = rcu_dereference_protected(new->table[i], in dma_resv_reserve_fences()
246 dma_fence_put(fence); in dma_resv_reserve_fences()
259 * Reset the number of pre-reserved fence slots to test that drivers do
269 /* Test fence slot reservation */ in dma_resv_reset_max_fences()
277 * dma_resv_add_fence - Add a fence to the dma_resv obj
279 * @fence: the fence to add
280 * @usage: how the fence is used, see enum dma_resv_usage
282 * Add a fence to a slot, @obj must be locked with dma_resv_lock(), and
285 * See also &dma_resv.fence for a discussion of the semantics.
287 void dma_resv_add_fence(struct dma_resv *obj, struct dma_fence *fence, in dma_resv_add_fence() argument
294 dma_fence_get(fence); in dma_resv_add_fence()
298 /* Drivers should not add containers here, instead add each fence in dma_resv_add_fence()
301 WARN_ON(dma_fence_is_container(fence)); in dma_resv_add_fence()
310 if ((old->context == fence->context && old_usage >= usage && in dma_resv_add_fence()
311 dma_fence_is_later_or_same(fence, old)) || in dma_resv_add_fence()
313 dma_resv_list_set(fobj, i, fence, usage); in dma_resv_add_fence()
322 dma_resv_list_set(fobj, i, fence, usage); in dma_resv_add_fence()
323 /* fence update must be visible before we extend the num_fences */ in dma_resv_add_fence()
333 * @replacement: the new fence to use instead
334 * @usage: how the new fence is used, see enum dma_resv_usage
336 * Replace fences with a specified context with a new fence. Only valid if the
337 * operation represented by the original fence has no longer access to the
338 * resources represented by the dma_resv object when the new fence completes.
340 * And example for using this is replacing a preemption fence with a page table
341 * update fence which makes the resource inaccessible.
377 /* Walk to the next not signaled fence and grab a reference to it */
385 dma_fence_put(cursor->fence); in dma_resv_iter_walk_unlocked()
388 cursor->fence = NULL; in dma_resv_iter_walk_unlocked()
394 cursor->obj, &cursor->fence, in dma_resv_iter_walk_unlocked()
396 cursor->fence = dma_fence_get_rcu(cursor->fence); in dma_resv_iter_walk_unlocked()
397 if (!cursor->fence) { in dma_resv_iter_walk_unlocked()
402 if (!dma_fence_is_signaled(cursor->fence) && in dma_resv_iter_walk_unlocked()
409 * dma_resv_iter_first_unlocked - first fence in an unlocked dma_resv obj.
418 * Returns the first fence from an unlocked dma_resv obj.
429 return cursor->fence; in dma_resv_iter_first_unlocked()
434 * dma_resv_iter_next_unlocked - next fence in an unlocked dma_resv obj.
441 * Returns the next fence from an unlocked dma_resv obj.
458 return cursor->fence; in dma_resv_iter_next_unlocked()
463 * dma_resv_iter_first - first fence from a locked dma_resv object
468 * Return the first fence in the dma_resv object while holding the
473 struct dma_fence *fence; in dma_resv_iter_first() local
480 fence = dma_resv_iter_next(cursor); in dma_resv_iter_first()
482 return fence; in dma_resv_iter_first()
487 * dma_resv_iter_next - next fence from a locked dma_resv object
495 struct dma_fence *fence; in dma_resv_iter_next() local
507 cursor->obj, &fence, &cursor->fence_usage); in dma_resv_iter_next()
510 return fence; in dma_resv_iter_next()
563 * @fences: the array of fence ptrs returned (array is krealloc'd to the
573 struct dma_fence *fence; in dma_resv_get_fences() local
579 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_get_fences()
604 (*fences)[(*num_fences)++] = dma_fence_get(fence); in dma_resv_get_fences()
613 * dma_resv_get_singleton - Get a single fence for all the fences
616 * @fence: the resulting fence
618 * Get a single fence representing all the fences inside the resv object.
621 * Warning: This can't be used like this when adding the fence back to the resv
628 struct dma_fence **fence) in dma_resv_get_singleton() argument
640 *fence = NULL; in dma_resv_get_singleton()
645 *fence = fences[0]; in dma_resv_get_singleton()
660 *fence = &array->base; in dma_resv_get_singleton()
683 struct dma_fence *fence; in dma_resv_wait_timeout() local
686 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_wait_timeout()
688 ret = dma_fence_wait_timeout(fence, intr, ret); in dma_resv_wait_timeout()
713 struct dma_fence *fence; in dma_resv_set_deadline() local
716 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_set_deadline()
717 dma_fence_set_deadline(fence, deadline); in dma_resv_set_deadline()
739 struct dma_fence *fence; in dma_resv_test_signaled() local
742 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_test_signaled()
763 struct dma_fence *fence; in dma_resv_describe() local
765 dma_resv_for_each_fence(&cursor, obj, DMA_RESV_USAGE_READ, fence) { in dma_resv_describe()
766 seq_printf(seq, "\t%s fence:", in dma_resv_describe()
768 dma_fence_describe(fence, seq); in dma_resv_describe()