Lines Matching defs: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 (void) mtx_init(&fence->mutex, mtx_plain);
56 cnd_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 mtx_destroy(&fence->mutex);
76 cnd_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 mtx_lock(&fence->mutex);
93 fence->count++;
94 assert(fence->count <= fence->rank);
98 fence->count, fence->rank);
102 cnd_broadcast(&fence->signalled);
104 mtx_unlock(&fence->mutex);