path: root/src
diff options
authorBruce Cherniak <>2019-01-04 14:53:59 -0600
committerAlok Hota <>2019-01-16 09:26:36 -0600
commited7673afd2d1a31bfcec0520743acd2681b462e6 (patch)
tree56515968e0518ec31c38efa1f74a1c094060d0e4 /src
parentd5d7b5e950a60827f65410b4d4cc7dbfa571952b (diff)
gallium/swr: Fix multi-context sync fence deadlock.
Various recreation scenarios lead to API thread getting stuck in swr_fence_finish(). This is a multi-context issue, whereby one context overwrites the fence read-value with a previous sync's lesser value. The fence sync value is supposed to be always increasing. In swr_fence_cb(), only update the "read" value if the new value is greater. (This may seem like we're not waiting on the other context to finish, but had we needed for it to finish there would have been a wait prior to submitting a new sync.) cc:
Diffstat (limited to 'src')
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gallium/drivers/swr/swr_fence.cpp b/src/gallium/drivers/swr/swr_fence.cpp
index b05ac8cec02..074d82a3b47 100644
--- a/src/gallium/drivers/swr/swr_fence.cpp
+++ b/src/gallium/drivers/swr/swr_fence.cpp
@@ -50,7 +50,9 @@ swr_fence_cb(uint64_t userData, uint64_t userData2, uint64_t userData3)
/* Correct value is in SwrSync data, and not the fence write field. */
- fence->read = userData2;
+ /* Contexts may not finish in order, but fence value always increases */
+ if (fence->read < userData2)
+ fence->read = userData2;