Lines Matching refs:fctx
16 struct msm_fence_context *fctx;
18 fctx = kzalloc(sizeof(*fctx), GFP_KERNEL);
19 if (!fctx)
22 fctx->dev = dev;
23 strscpy(fctx->name, name, sizeof(fctx->name));
24 fctx->context = dma_fence_context_alloc(1);
25 init_waitqueue_head(&fctx->event);
26 spin_lock_init(&fctx->spinlock);
28 return fctx;
31 void msm_fence_context_free(struct msm_fence_context *fctx)
33 kfree(fctx);
36 static inline bool fence_completed(struct msm_fence_context *fctx, uint32_t fence)
38 return (int32_t)(fctx->completed_fence - fence) >= 0;
42 int msm_wait_fence(struct msm_fence_context *fctx, uint32_t fence,
47 if (fence > fctx->last_fence) {
49 fctx->name, fence, fctx->last_fence);
55 ret = fence_completed(fctx, fence) ? 0 : -EBUSY;
60 ret = wait_event_interruptible_timeout(fctx->event,
61 fence_completed(fctx, fence),
64 ret = wait_event_timeout(fctx->event,
65 fence_completed(fctx, fence),
70 fence, fctx->completed_fence);
81 void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence)
83 spin_lock(&fctx->spinlock);
84 fctx->completed_fence = max(fence, fctx->completed_fence);
85 spin_unlock(&fctx->spinlock);
87 wake_up_all(&fctx->event);
92 struct msm_fence_context *fctx;
108 return f->fctx->name;
114 return fence_completed(f->fctx, f->base.seqno);
124 msm_fence_alloc(struct msm_fence_context *fctx)
132 f->fctx = fctx;
134 dma_fence_init(&f->base, &msm_fence_ops, &fctx->spinlock,
135 fctx->context, ++fctx->last_fence);