Module: Mesa
Branch: staging/20.0
Commit: 6923ae24f4cab2786f1f17b0955c8b350293eec5
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6923ae24f4cab2786f1f17b0955c8b350293eec5

Author: Pierre-Eric Pelloux-Prayer <[email protected]>
Date:   Mon Mar 16 15:10:23 2020 +0100

st/mesa: disallow deferred flush if there are multiple contexts

u_threaded can hang in these situation, with one context waiting on a
deferred fence from the other context.
But the other context isn't flushing its pending work (because it's waiting
for more work to pushed) so everything is stuck.

Fixes: d17b35e671a ("gallium: add PIPE_FLUSH_DEFERRED")
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1430
Reviewed-by: Marek Olšák <[email protected]>
Tested-by: Marge Bot 
<https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4213>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4213>
(cherry picked from commit e7f3a8d6959c74f63c877dd8776fe519d54f946f)

---

 .pick_status.json                      | 2 +-
 src/mesa/state_tracker/st_cb_syncobj.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index b4d8705991d..44168c83790 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -607,7 +607,7 @@
         "description": "st/mesa: disallow deferred flush if there are multiple 
contexts",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "d17b35e671ae7c6ab6b89973506d12b958d2264d"
     },
diff --git a/src/mesa/state_tracker/st_cb_syncobj.c 
b/src/mesa/state_tracker/st_cb_syncobj.c
index 48e7647b602..2cbbc580c8c 100644
--- a/src/mesa/state_tracker/st_cb_syncobj.c
+++ b/src/mesa/state_tracker/st_cb_syncobj.c
@@ -74,7 +74,8 @@ static void st_fence_sync(struct gl_context *ctx, struct 
gl_sync_object *obj,
    assert(condition == GL_SYNC_GPU_COMMANDS_COMPLETE && flags == 0);
    assert(so->fence == NULL);
 
-   pipe->flush(pipe, &so->fence, PIPE_FLUSH_DEFERRED);
+   /* Deferred flush are only allowed when there's a single context. See issue 
1430 */
+   pipe->flush(pipe, &so->fence, ctx->Shared->RefCount == 1 ? 
PIPE_FLUSH_DEFERRED : 0);
 }
 
 static void st_client_wait_sync(struct gl_context *ctx,

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to