Lines Matching refs:fctx

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