Lines Matching full:fence
36 * Create a new fence object.
39 * thread hits a fence command, it'll increment the fence counter. When
40 * the counter == the rank, the fence is finished.
42 * \param rank the expected finished value of the fence counter.
48 struct lp_fence *fence = CALLOC_STRUCT(lp_fence);
50 if (!fence)
53 pipe_reference_init(&fence->reference, 1);
55 pipe_mutex_init(fence->mutex);
56 pipe_condvar_init(fence->signalled);
58 fence->id = fence_id++;
59 fence->rank = rank;
62 debug_printf("%s %d\n", __FUNCTION__, fence->id);
64 return fence;
68 /** Destroy a fence. Called when refcount hits zero. */
70 lp_fence_destroy(struct lp_fence *fence)
73 debug_printf("%s %d\n", __FUNCTION__, fence->id);
75 pipe_mutex_destroy(fence->mutex);
76 pipe_condvar_destroy(fence->signalled);
77 FREE(fence);
82 * Called by the rendering threads to increment the fence counter.
83 * When the counter == the rank, the fence is finished.
86 lp_fence_signal(struct lp_fence *fence)
89 debug_printf("%s %d\n", __FUNCTION__, fence->id);
91 pipe_mutex_lock(fence->mutex);
93 fence->count++;
94 assert(fence->count <= fence->rank);
98 fence->count, fence->rank);
102 pipe_condvar_broadcast(fence->signalled);
104 pipe_mutex_unlock(fence->mutex);