Home | History | Annotate | Download | only in vgem

Lines Matching refs:fence

43 static const char *vgem_fence_get_driver_name(struct dma_fence *fence)
48 static const char *vgem_fence_get_timeline_name(struct dma_fence *fence)
55 struct vgem_fence *fence = container_of(base, typeof(*fence), base);
57 del_timer_sync(&fence->timer);
58 dma_fence_free(&fence->base);
61 static void vgem_fence_value_str(struct dma_fence *fence, char *str, int size)
63 snprintf(str, size, "%llu", fence->seqno);
66 static void vgem_fence_timeline_value_str(struct dma_fence *fence, char *str,
70 dma_fence_is_signaled(fence) ? fence->seqno : 0);
84 struct vgem_fence *fence = from_timer(fence, t, timer);
86 dma_fence_signal(&fence->base);
92 struct vgem_fence *fence;
94 fence = kzalloc(sizeof(*fence), GFP_KERNEL);
95 if (!fence)
98 spin_lock_init(&fence->lock);
99 dma_fence_init(&fence->base, &vgem_fence_ops, &fence->lock,
102 timer_setup(&fence->timer, vgem_fence_timeout, 0);
104 /* We force the fence to expire within 10s to prevent driver hangs */
105 mod_timer(&fence->timer, jiffies + VGEM_FENCE_TIMEOUT);
107 return &fence->base;
113 * Create and attach a fence to the vGEM handle. This fence is then exposed
115 * dma-buf. If the flags contain VGEM_FENCE_WRITE, the fence indicates the
117 * fence, otherwise the fence indicates the client is current reading from the
119 * completion. Note that if a conflicting fence is already on the dma-buf (i.e.
120 * an exclusive fence when adding a read, or any fence when adding a write),
124 * This returns the handle for the new fence that must be signaled within 10
138 struct dma_fence *fence;
151 fence = vgem_fence_create(vfile, arg->flags);
152 if (!fence) {
157 /* Check for a conflicting fence */
165 /* Expose the fence via the dma-buf */
169 dma_resv_add_excl_fence(resv, fence);
171 dma_resv_add_shared_fence(resv, fence);
174 /* Record the fence in our idr for later signaling */
178 ret = idr_alloc(&vfile->fence_idr, fence, 1, 0, GFP_KERNEL);
188 dma_fence_signal(fence);
189 dma_fence_put(fence);
199 * Signal and consume a fence ealier attached to a vGEM handle using
205 * Signaling a fence indicates to all consumers of the dma-buf that the
206 * client has completed the operation associated with the fence, and that the
209 * If the fence does not exist (or has already been signaled by the client),
218 struct dma_fence *fence;
225 fence = idr_replace(&vfile->fence_idr, NULL, arg->fence);
227 if (!fence)
229 if (IS_ERR(fence))
230 return PTR_ERR(fence);
232 if (dma_fence_is_signaled(fence))
235 dma_fence_signal(fence);
236 dma_fence_put(fence);