Lines Matching defs:fctx
72 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
74 if (!--fctx->notify_ref)
97 nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
101 spin_lock_irq(&fctx->lock);
102 while (!list_empty(&fctx->pending)) {
103 fence = list_entry(fctx->pending.next, typeof(*fence), head);
109 nvif_notify_put(&fctx->notify);
111 spin_unlock_irq(&fctx->lock);
115 nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
117 nouveau_fence_context_kill(fctx, 0);
118 nvif_notify_fini(&fctx->notify);
119 fctx->dead = 1;
131 struct nouveau_fence_chan *fctx =
134 spin_lock_destroy(&fctx->lock);
135 kfree(fctx);
139 nouveau_fence_context_free(struct nouveau_fence_chan *fctx)
141 kref_put(&fctx->fence_ref, nouveau_fence_context_put);
145 nouveau_fence_update(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx)
149 u32 seq = fctx->read(chan);
151 while (!list_empty(&fctx->pending)) {
152 fence = list_entry(fctx->pending.next, typeof(*fence), head);
166 struct nouveau_fence_chan *fctx =
167 container_of(notify, typeof(*fctx), notify);
171 spin_lock_irqsave(&fctx->lock, flags);
172 if (!list_empty(&fctx->pending)) {
176 fence = list_entry(fctx->pending.next, typeof(*fence), head);
177 chan = rcu_dereference_protected(fence->channel, lockdep_is_held(&fctx->lock));
178 if (nouveau_fence_update(chan, fctx))
181 spin_unlock_irqrestore(&fctx->lock, flags);
187 nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx)
193 INIT_LIST_HEAD(&fctx->flip);
194 INIT_LIST_HEAD(&fctx->pending);
195 spin_lock_init(&fctx->lock);
196 fctx->context = chan->drm->chan.context_base + chan->chid;
199 strcpy(fctx->name, "copy engine channel");
201 strcpy(fctx->name, "generic kernel channel");
203 strcpy(fctx->name, nvxx_client(&cli->base)->name);
205 kref_init(&fctx->fence_ref);
214 &fctx->notify);
222 struct nouveau_fence_chan *fctx = chan->fence;
231 &fctx->lock, fctx->context, ++fctx->sequence);
234 &fctx->lock, fctx->context, ++fctx->sequence);
235 kref_get(&fctx->fence_ref);
238 ret = fctx->emit(fence);
241 spin_lock_irq(&fctx->lock);
243 if (nouveau_fence_update(chan, fctx))
244 nvif_notify_put(&fctx->notify);
246 list_add_tail(&fence->head, &fctx->pending);
247 spin_unlock_irq(&fctx->lock);
258 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
265 spin_lock_irqsave(&fctx->lock, flags);
266 chan = rcu_dereference_protected(fence->channel, lockdep_is_held(&fctx->lock));
267 if (chan && nouveau_fence_update(chan, fctx))
268 nvif_notify_put(&fctx->notify);
269 spin_unlock_irqrestore(&fctx->lock, flags);
381 struct nouveau_fence_chan *fctx = chan->fence;
406 if (prev && (prev == chan || fctx->sync(f, prev, chan) == 0))
431 if (prev && (prev == chan || fctx->sync(f, prev, chan) == 0))
481 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
483 return !fctx->dead ? fctx->name : "dead channel";
495 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
502 ret = (int)(fctx->read(chan) - fence->base.seqno) >= 0;
536 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
538 kref_put(&fctx->fence_ref, nouveau_fence_context_put);
554 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
557 if (!fctx->notify_ref++)
558 nvif_notify_get(&fctx->notify);
563 else if (!--fctx->notify_ref)
564 nvif_notify_put(&fctx->notify);