Lines Matching refs:fence

42 from_fence(struct dma_fence *fence)  in from_fence()  argument
44 return container_of(fence, struct nouveau_fence, base); in from_fence()
48 nouveau_fctx(struct nouveau_fence *fence) in nouveau_fctx() argument
50 return container_of(fence->base.lock, struct nouveau_fence_chan, lock); in nouveau_fctx()
54 nouveau_fence_signal(struct nouveau_fence *fence) in nouveau_fence_signal() argument
58 dma_fence_signal_locked(&fence->base); in nouveau_fence_signal()
59 list_del(&fence->head); in nouveau_fence_signal()
60 rcu_assign_pointer(fence->channel, NULL); in nouveau_fence_signal()
62 if (test_bit(DMA_FENCE_FLAG_USER_BITS, &fence->base.flags)) { in nouveau_fence_signal()
63 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); in nouveau_fence_signal()
69 dma_fence_put(&fence->base); in nouveau_fence_signal()
74 nouveau_local_fence(struct dma_fence *fence, struct nouveau_drm *drm) in nouveau_local_fence() argument
76 if (fence->ops != &nouveau_fence_ops_legacy && in nouveau_local_fence()
77 fence->ops != &nouveau_fence_ops_uevent) in nouveau_local_fence()
80 return from_fence(fence); in nouveau_local_fence()
86 struct nouveau_fence *fence; in nouveau_fence_context_kill() local
91 fence = list_entry(fctx->pending.next, typeof(*fence), head); in nouveau_fence_context_kill()
94 dma_fence_set_error(&fence->base, error); in nouveau_fence_context_kill()
96 if (nouveau_fence_signal(fence)) in nouveau_fence_context_kill()
133 struct nouveau_fence *fence; in nouveau_fence_update() local
138 fence = list_entry(fctx->pending.next, typeof(*fence), head); in nouveau_fence_update()
140 if ((int)(seq - fence->base.seqno) < 0) in nouveau_fence_update()
143 drop |= nouveau_fence_signal(fence); in nouveau_fence_update()
159 struct nouveau_fence *fence; in nouveau_fence_uevent_work() local
162 fence = list_entry(fctx->pending.next, typeof(*fence), head); in nouveau_fence_uevent_work()
163 chan = rcu_dereference_protected(fence->channel, lockdep_is_held(&fctx->lock)); in nouveau_fence_uevent_work()
184 struct nouveau_fence_priv *priv = (void*)chan->drm->fence; in nouveau_fence_context_new()
220 nouveau_fence_emit(struct nouveau_fence *fence) in nouveau_fence_emit() argument
222 struct nouveau_channel *chan = unrcu_pointer(fence->channel); in nouveau_fence_emit()
223 struct nouveau_fence_chan *fctx = chan->fence; in nouveau_fence_emit()
224 struct nouveau_fence_priv *priv = (void*)chan->drm->fence; in nouveau_fence_emit()
227 fence->timeout = jiffies + (15 * HZ); in nouveau_fence_emit()
230 dma_fence_init(&fence->base, &nouveau_fence_ops_uevent, in nouveau_fence_emit()
233 dma_fence_init(&fence->base, &nouveau_fence_ops_legacy, in nouveau_fence_emit()
237 ret = fctx->emit(fence); in nouveau_fence_emit()
239 dma_fence_get(&fence->base); in nouveau_fence_emit()
244 dma_fence_put(&fence->base); in nouveau_fence_emit()
251 list_add_tail(&fence->head, &fctx->pending); in nouveau_fence_emit()
259 nouveau_fence_done(struct nouveau_fence *fence) in nouveau_fence_done() argument
261 if (fence->base.ops == &nouveau_fence_ops_legacy || in nouveau_fence_done()
262 fence->base.ops == &nouveau_fence_ops_uevent) { in nouveau_fence_done()
263 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); in nouveau_fence_done()
267 if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->base.flags)) in nouveau_fence_done()
271 chan = rcu_dereference_protected(fence->channel, lockdep_is_held(&fctx->lock)); in nouveau_fence_done()
276 return dma_fence_is_signaled(&fence->base); in nouveau_fence_done()
282 struct nouveau_fence *fence = from_fence(f); in nouveau_fence_wait_legacy() local
286 while (!nouveau_fence_done(fence)) { in nouveau_fence_wait_legacy()
315 nouveau_fence_wait_busy(struct nouveau_fence *fence, bool intr) in nouveau_fence_wait_busy() argument
319 while (!nouveau_fence_done(fence)) { in nouveau_fence_wait_busy()
320 if (time_after_eq(jiffies, fence->timeout)) { in nouveau_fence_wait_busy()
340 nouveau_fence_wait(struct nouveau_fence *fence, bool lazy, bool intr) in nouveau_fence_wait() argument
345 return nouveau_fence_wait_busy(fence, intr); in nouveau_fence_wait()
347 ret = dma_fence_wait_timeout(&fence->base, intr, 15 * HZ); in nouveau_fence_wait()
360 struct nouveau_fence_chan *fctx = chan->fence; in nouveau_fence_sync()
373 struct dma_fence *fence; in nouveau_fence_sync() local
377 fence) { in nouveau_fence_sync()
385 f = nouveau_local_fence(fence, chan->drm); in nouveau_fence_sync()
400 ret = dma_fence_wait(fence, intr); in nouveau_fence_sync()
421 struct nouveau_fence *fence; in nouveau_fence_create() local
423 if (unlikely(!chan->fence)) in nouveau_fence_create()
426 fence = kzalloc(sizeof(*fence), GFP_KERNEL); in nouveau_fence_create()
427 if (!fence) in nouveau_fence_create()
430 fence->channel = chan; in nouveau_fence_create()
432 *pfence = fence; in nouveau_fence_create()
453 static const char *nouveau_fence_get_get_driver_name(struct dma_fence *fence) in nouveau_fence_get_get_driver_name() argument
460 struct nouveau_fence *fence = from_fence(f); in nouveau_fence_get_timeline_name() local
461 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); in nouveau_fence_get_timeline_name()
474 struct nouveau_fence *fence = from_fence(f); in nouveau_fence_is_signaled() local
475 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); in nouveau_fence_is_signaled()
480 chan = rcu_dereference(fence->channel); in nouveau_fence_is_signaled()
482 ret = (int)(fctx->read(chan) - fence->base.seqno) >= 0; in nouveau_fence_is_signaled()
490 struct nouveau_fence *fence = from_fence(f); in nouveau_fence_no_signaling() local
496 WARN_ON(kref_read(&fence->base.refcount) <= 1); in nouveau_fence_no_signaling()
504 list_del(&fence->head); in nouveau_fence_no_signaling()
506 dma_fence_put(&fence->base); in nouveau_fence_no_signaling()
515 struct nouveau_fence *fence = from_fence(f); in nouveau_fence_release() local
516 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); in nouveau_fence_release()
519 dma_fence_free(&fence->base); in nouveau_fence_release()
533 struct nouveau_fence *fence = from_fence(f); in nouveau_fence_enable_signaling() local
534 struct nouveau_fence_chan *fctx = nouveau_fctx(fence); in nouveau_fence_enable_signaling()
542 set_bit(DMA_FENCE_FLAG_USER_BITS, &fence->base.flags); in nouveau_fence_enable_signaling()