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()
332 * @replacement: the new fence to use instead
333 * @usage: how the new fence is used, see enum dma_resv_usage
335 * Replace fences with a specified context with a new fence. Only valid if the
336 * operation represented by the original fence has no longer access to the
337 * resources represented by the dma_resv object when the new fence completes.
339 * And example for using this is replacing a preemption fence with a page table
340 * update fence which makes the resource inaccessible.
376 /* Walk to the next not signaled fence and grab a reference to it */
384 dma_fence_put(cursor->fence); in dma_resv_iter_walk_unlocked()
387 cursor->fence = NULL; in dma_resv_iter_walk_unlocked()
393 cursor->obj, &cursor->fence, in dma_resv_iter_walk_unlocked()
395 cursor->fence = dma_fence_get_rcu(cursor->fence); in dma_resv_iter_walk_unlocked()
396 if (!cursor->fence) { in dma_resv_iter_walk_unlocked()
401 if (!dma_fence_is_signaled(cursor->fence) && in dma_resv_iter_walk_unlocked()
408 * dma_resv_iter_first_unlocked - first fence in an unlocked dma_resv obj.
417 * Returns the first fence from an unlocked dma_resv obj.
428 return cursor->fence; in dma_resv_iter_first_unlocked()
433 * dma_resv_iter_next_unlocked - next fence in an unlocked dma_resv obj.
440 * Returns the next fence from an unlocked dma_resv obj.
457 return cursor->fence; in dma_resv_iter_next_unlocked()
462 * dma_resv_iter_first - first fence from a locked dma_resv object
467 * Return the first fence in the dma_resv object while holding the
472 struct dma_fence *fence; in dma_resv_iter_first() local
479 fence = dma_resv_iter_next(cursor); in dma_resv_iter_first()
481 return fence; in dma_resv_iter_first()
486 * dma_resv_iter_next - next fence from a locked dma_resv object
494 struct dma_fence *fence; in dma_resv_iter_next() local
506 cursor->obj, &fence, &cursor->fence_usage); in dma_resv_iter_next()
509 return fence; in dma_resv_iter_next()
562 * @fences: the array of fence ptrs returned (array is krealloc'd to the
572 struct dma_fence *fence; in dma_resv_get_fences() local
578 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_get_fences()
603 (*fences)[(*num_fences)++] = dma_fence_get(fence); in dma_resv_get_fences()
612 * dma_resv_get_singleton - Get a single fence for all the fences
615 * @fence: the resulting fence
617 * Get a single fence representing all the fences inside the resv object.
620 * Warning: This can't be used like this when adding the fence back to the resv
627 struct dma_fence **fence) in dma_resv_get_singleton() argument
639 *fence = NULL; in dma_resv_get_singleton()
644 *fence = fences[0]; in dma_resv_get_singleton()
659 *fence = &array->base; in dma_resv_get_singleton()
682 struct dma_fence *fence; in dma_resv_wait_timeout() local
685 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_wait_timeout()
687 ret = dma_fence_wait_timeout(fence, intr, ret); in dma_resv_wait_timeout()
712 struct dma_fence *fence; in dma_resv_set_deadline() local
715 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_set_deadline()
716 dma_fence_set_deadline(fence, deadline); in dma_resv_set_deadline()
738 struct dma_fence *fence; in dma_resv_test_signaled() local
741 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_test_signaled()
762 struct dma_fence *fence; in dma_resv_describe() local
764 dma_resv_for_each_fence(&cursor, obj, DMA_RESV_USAGE_READ, fence) { in dma_resv_describe()
765 seq_printf(seq, "\t%s fence:", in dma_resv_describe()
767 dma_fence_describe(fence, seq); in dma_resv_describe()