Lines Matching refs:fctx
65 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
67 if (!--fctx->notify_ref)
90 nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
94 spin_lock_irq(&fctx->lock);
95 while (!list_empty(&fctx->pending)) {
96 fence = list_entry(fctx->pending.next, typeof(*fence), head);
102 nvif_notify_put(&fctx->notify);
104 spin_unlock_irq(&fctx->lock);
108 nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
110 nouveau_fence_context_kill(fctx, 0);
111 nvif_notify_dtor(&fctx->notify);
112 fctx->dead = 1;
128 nouveau_fence_context_free(struct nouveau_fence_chan *fctx)
130 kref_put(&fctx->fence_ref, nouveau_fence_context_put);
134 nouveau_fence_update(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx)
138 u32 seq = fctx->read(chan);
140 while (!list_empty(&fctx->pending)) {
141 fence = list_entry(fctx->pending.next, typeof(*fence), head);
155 struct nouveau_fence_chan *fctx =
156 container_of(notify, typeof(*fctx), notify);
160 spin_lock_irqsave(&fctx->lock, flags);
161 if (!list_empty(&fctx->pending)) {
165 fence = list_entry(fctx->pending.next, typeof(*fence), head);
166 chan = rcu_dereference_protected(fence->channel, lockdep_is_held(&fctx->lock));
167 if (nouveau_fence_update(chan, fctx))
170 spin_unlock_irqrestore(&fctx->lock, flags);
176 nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx)
182 INIT_LIST_HEAD(&fctx->flip);
183 INIT_LIST_HEAD(&fctx->pending);
184 spin_lock_init(&fctx->lock);
185 fctx->context = chan->drm->chan.context_base + chan->chid;
188 strcpy(fctx->name, "copy engine channel");
190 strcpy(fctx->name, "generic kernel channel");
192 strcpy(fctx->name, nvxx_client(&cli->base)->name);
194 kref_init(&fctx->fence_ref);
204 &fctx->notify);
212 struct nouveau_fence_chan *fctx = chan->fence;
221 &fctx->lock, fctx->context, ++fctx->sequence);
224 &fctx->lock, fctx->context, ++fctx->sequence);
225 kref_get(&fctx->fence_ref);
228 ret = fctx->emit(fence);
231 spin_lock_irq(&fctx->lock);
233 if (nouveau_fence_update(chan, fctx))
234 nvif_notify_put(&fctx->notify);
236 list_add_tail(&fence->head, &fctx->pending);
237 spin_unlock_irq(&fctx->lock);
248 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
255 spin_lock_irqsave(&fctx->lock, flags);
256 chan = rcu_dereference_protected(fence->channel, lockdep_is_held(&fctx->lock));
257 if (chan && nouveau_fence_update(chan, fctx))
258 nvif_notify_put(&fctx->notify);
259 spin_unlock_irqrestore(&fctx->lock, flags);
344 struct nouveau_fence_chan *fctx = chan->fence;
369 if (prev && (prev == chan || fctx->sync(f, prev, chan) == 0))
394 if (prev && (prev == chan || fctx->sync(f, prev, chan) == 0))
444 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
446 return !fctx->dead ? fctx->name : "dead channel";
458 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
465 ret = (int)(fctx->read(chan) - fence->base.seqno) >= 0;
499 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
501 kref_put(&fctx->fence_ref, nouveau_fence_context_put);
517 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
520 if (!fctx->notify_ref++)
521 nvif_notify_get(&fctx->notify);
526 else if (!--fctx->notify_ref)
527 nvif_notify_put(&fctx->notify);