mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
util/u_queue: Fix data race on num_threads during finish.
This should fix a deadlock I saw on dEQP-EGL.functional.sharing.gles2.multithread.random.programs.link.7 on radeonsi, where we were waiting on an invalid fence[1] value. This was probably because between when we started setting up the fences for u_queue_finish and when we waited on those fences, a second thread was created. Closes: #13738 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36919>
This commit is contained in:
parent
1f79ba9a51
commit
d1a6be75db
1 changed files with 2 additions and 1 deletions
|
|
@ -708,6 +708,7 @@ util_queue_finish(struct util_queue *queue)
|
|||
queue->create_threads_on_demand = false;
|
||||
|
||||
fences = malloc(queue->num_threads * sizeof(*fences));
|
||||
unsigned num_fences = queue->num_threads;
|
||||
util_barrier_init(&barrier, queue->num_threads);
|
||||
|
||||
for (unsigned i = 0; i < queue->num_threads; ++i) {
|
||||
|
|
@ -718,7 +719,7 @@ util_queue_finish(struct util_queue *queue)
|
|||
queue->create_threads_on_demand = true;
|
||||
mtx_unlock(&queue->lock);
|
||||
|
||||
for (unsigned i = 0; i < queue->num_threads; ++i) {
|
||||
for (unsigned i = 0; i < num_fences; ++i) {
|
||||
util_queue_fence_wait(&fences[i]);
|
||||
util_queue_fence_destroy(&fences[i]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue