Lines Matching refs:fctx

63 		struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
65 if (!--fctx->notify_ref)
84 nouveau_fence_context_kill(struct nouveau_fence_chan *fctx, int error)
89 spin_lock_irqsave(&fctx->lock, flags);
90 while (!list_empty(&fctx->pending)) {
91 fence = list_entry(fctx->pending.next, typeof(*fence), head);
97 nvif_event_block(&fctx->event);
99 fctx->killed = 1;
100 spin_unlock_irqrestore(&fctx->lock, flags);
104 nouveau_fence_context_del(struct nouveau_fence_chan *fctx)
106 cancel_work_sync(&fctx->uevent_work);
107 nouveau_fence_context_kill(fctx, 0);
108 nvif_event_dtor(&fctx->event);
109 fctx->dead = 1;
125 nouveau_fence_context_free(struct nouveau_fence_chan *fctx)
127 kref_put(&fctx->fence_ref, nouveau_fence_context_put);
131 nouveau_fence_update(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx)
135 u32 seq = fctx->read(chan);
137 while (!list_empty(&fctx->pending)) {
138 fence = list_entry(fctx->pending.next, typeof(*fence), head);
152 struct nouveau_fence_chan *fctx = container_of(work, struct nouveau_fence_chan,
157 spin_lock_irqsave(&fctx->lock, flags);
158 if (!list_empty(&fctx->pending)) {
162 fence = list_entry(fctx->pending.next, typeof(*fence), head);
163 chan = rcu_dereference_protected(fence->channel, lockdep_is_held(&fctx->lock));
164 if (nouveau_fence_update(chan, fctx))
168 nvif_event_block(&fctx->event);
170 spin_unlock_irqrestore(&fctx->lock, flags);
176 struct nouveau_fence_chan *fctx = container_of(event, typeof(*fctx), event);
177 schedule_work(&fctx->uevent_work);
182 nouveau_fence_context_new(struct nouveau_channel *chan, struct nouveau_fence_chan *fctx)
192 INIT_WORK(&fctx->uevent_work, nouveau_fence_uevent_work);
193 INIT_LIST_HEAD(&fctx->flip);
194 INIT_LIST_HEAD(&fctx->pending);
195 spin_lock_init(&fctx->lock);
196 fctx->context = chan->drm->runl[chan->runlist].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 &args.base, sizeof(args), &fctx->event);
223 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);
237 ret = fctx->emit(fence);
240 spin_lock_irq(&fctx->lock);
242 if (unlikely(fctx->killed)) {
243 spin_unlock_irq(&fctx->lock);
248 if (nouveau_fence_update(chan, fctx))
249 nvif_event_block(&fctx->event);
251 list_add_tail(&fence->head, &fctx->pending);
252 spin_unlock_irq(&fctx->lock);
263 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
270 spin_lock_irqsave(&fctx->lock, flags);
271 chan = rcu_dereference_protected(fence->channel, lockdep_is_held(&fctx->lock));
272 if (chan && nouveau_fence_update(chan, fctx))
273 nvif_event_block(&fctx->event);
274 spin_unlock_irqrestore(&fctx->lock, flags);
360 struct nouveau_fence_chan *fctx = chan->fence;
393 fctx->sync(f, prev, chan) == 0))
461 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
463 return !fctx->dead ? fctx->name : "dead channel";
475 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
482 ret = (int)(fctx->read(chan) - fence->base.seqno) >= 0;
516 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
518 kref_put(&fctx->fence_ref, nouveau_fence_context_put);
534 struct nouveau_fence_chan *fctx = nouveau_fctx(fence);
537 if (!fctx->notify_ref++)
538 nvif_event_allow(&fctx->event);
543 else if (!--fctx->notify_ref)
544 nvif_event_block(&fctx->event);