Lines Matching refs:fence
38 * Create a new fence object.
41 * thread hits a fence command, it'll increment the fence counter. When
42 * the counter == the rank, the fence is finished.
44 * \param rank the expected finished value of the fence counter.
50 struct lp_fence *fence = CALLOC_STRUCT(lp_fence);
52 if (!fence)
55 pipe_reference_init(&fence->reference, 1);
57 (void) mtx_init(&fence->mutex, mtx_plain);
58 cnd_init(&fence->signalled);
60 fence->id = p_atomic_inc_return(&fence_id) - 1;
61 fence->rank = rank;
64 debug_printf("%s %d\n", __FUNCTION__, fence->id);
66 return fence;
70 /** Destroy a fence. Called when refcount hits zero. */
72 lp_fence_destroy(struct lp_fence *fence)
75 debug_printf("%s %d\n", __FUNCTION__, fence->id);
77 mtx_destroy(&fence->mutex);
78 cnd_destroy(&fence->signalled);
79 FREE(fence);
84 * Called by the rendering threads to increment the fence counter.
85 * When the counter == the rank, the fence is finished.
88 lp_fence_signal(struct lp_fence *fence)
91 debug_printf("%s %d\n", __FUNCTION__, fence->id);
93 mtx_lock(&fence->mutex);
95 fence->count++;
96 assert(fence->count <= fence->rank);
100 fence->count, fence->rank);
104 cnd_broadcast(&fence->signalled);
106 mtx_unlock(&fence->mutex);