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()
203 * no need to bump fence refcounts, rcu_read access in dma_resv_reserve_fences()
210 struct dma_fence *fence; in dma_resv_reserve_fences() local
212 dma_resv_list_entry(old, i, obj, &fence, &usage); in dma_resv_reserve_fences()
213 if (dma_fence_is_signaled(fence)) in dma_resv_reserve_fences()
214 RCU_INIT_POINTER(new->table[--k], fence); in dma_resv_reserve_fences()
216 dma_resv_list_set(new, j++, fence, usage); in dma_resv_reserve_fences()
235 struct dma_fence *fence; in dma_resv_reserve_fences() local
237 fence = rcu_dereference_protected(new->table[i], in dma_resv_reserve_fences()
239 dma_fence_put(fence); in dma_resv_reserve_fences()
252 * Reset the number of pre-reserved fence slots to test that drivers do
262 /* Test fence slot reservation */ in dma_resv_reset_max_fences()
270 * dma_resv_add_fence - Add a fence to the dma_resv obj
272 * @fence: the fence to add
273 * @usage: how the fence is used, see enum dma_resv_usage
275 * Add a fence to a slot, @obj must be locked with dma_resv_lock(), and
278 * See also &dma_resv.fence for a discussion of the semantics.
280 void dma_resv_add_fence(struct dma_resv *obj, struct dma_fence *fence, in dma_resv_add_fence() argument
287 dma_fence_get(fence); in dma_resv_add_fence()
291 /* Drivers should not add containers here, instead add each fence in dma_resv_add_fence()
294 WARN_ON(dma_fence_is_container(fence)); in dma_resv_add_fence()
303 if ((old->context == fence->context && old_usage >= usage && in dma_resv_add_fence()
304 dma_fence_is_later_or_same(fence, old)) || in dma_resv_add_fence()
306 dma_resv_list_set(fobj, i, fence, usage); in dma_resv_add_fence()
315 dma_resv_list_set(fobj, i, fence, usage); in dma_resv_add_fence()
325 * @replacement: the new fence to use instead
326 * @usage: how the new fence is used, see enum dma_resv_usage
328 * Replace fences with a specified context with a new fence. Only valid if the
329 * operation represented by the original fence has no longer access to the
330 * resources represented by the dma_resv object when the new fence completes.
332 * And example for using this is replacing a preemption fence with a page table
333 * update fence which makes the resource inaccessible.
369 /* Walk to the next not signaled fence and grab a reference to it */
377 dma_fence_put(cursor->fence); in dma_resv_iter_walk_unlocked()
380 cursor->fence = NULL; in dma_resv_iter_walk_unlocked()
386 cursor->obj, &cursor->fence, in dma_resv_iter_walk_unlocked()
388 cursor->fence = dma_fence_get_rcu(cursor->fence); in dma_resv_iter_walk_unlocked()
389 if (!cursor->fence) { in dma_resv_iter_walk_unlocked()
394 if (!dma_fence_is_signaled(cursor->fence) && in dma_resv_iter_walk_unlocked()
401 * dma_resv_iter_first_unlocked - first fence in an unlocked dma_resv obj.
410 * Returns the first fence from an unlocked dma_resv obj.
421 return cursor->fence; in dma_resv_iter_first_unlocked()
426 * dma_resv_iter_next_unlocked - next fence in an unlocked dma_resv obj.
433 * Returns the next fence from an unlocked dma_resv obj.
450 return cursor->fence; in dma_resv_iter_next_unlocked()
455 * dma_resv_iter_first - first fence from a locked dma_resv object
460 * Return the first fence in the dma_resv object while holding the
465 struct dma_fence *fence; in dma_resv_iter_first() local
472 fence = dma_resv_iter_next(cursor); in dma_resv_iter_first()
474 return fence; in dma_resv_iter_first()
479 * dma_resv_iter_next - next fence from a locked dma_resv object
487 struct dma_fence *fence; in dma_resv_iter_next() local
499 cursor->obj, &fence, &cursor->fence_usage); in dma_resv_iter_next()
502 return fence; in dma_resv_iter_next()
555 * @fences: the array of fence ptrs returned (array is krealloc'd to the
565 struct dma_fence *fence; in dma_resv_get_fences() local
571 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_get_fences()
596 (*fences)[(*num_fences)++] = dma_fence_get(fence); in dma_resv_get_fences()
605 * dma_resv_get_singleton - Get a single fence for all the fences
608 * @fence: the resulting fence
610 * Get a single fence representing all the fences inside the resv object.
613 * Warning: This can't be used like this when adding the fence back to the resv
620 struct dma_fence **fence) in dma_resv_get_singleton() argument
632 *fence = NULL; in dma_resv_get_singleton()
637 *fence = fences[0]; in dma_resv_get_singleton()
652 *fence = &array->base; in dma_resv_get_singleton()
675 struct dma_fence *fence; in dma_resv_wait_timeout() local
678 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_wait_timeout()
680 ret = dma_fence_wait_timeout(fence, intr, ret); in dma_resv_wait_timeout()
705 struct dma_fence *fence; in dma_resv_set_deadline() local
708 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_set_deadline()
709 dma_fence_set_deadline(fence, deadline); in dma_resv_set_deadline()
731 struct dma_fence *fence; in dma_resv_test_signaled() local
734 dma_resv_for_each_fence_unlocked(&cursor, fence) { in dma_resv_test_signaled()
755 struct dma_fence *fence; in dma_resv_describe() local
757 dma_resv_for_each_fence(&cursor, obj, DMA_RESV_USAGE_READ, fence) { in dma_resv_describe()
758 seq_printf(seq, "\t%s fence:", in dma_resv_describe()
760 dma_fence_describe(fence, seq); in dma_resv_describe()