summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_fence.c
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2017-10-22 17:38:53 +0200
committerNicolai Hähnle <[email protected]>2017-11-09 14:00:50 +0100
commite4627ac8fb5422e98311724cce04f31b65cc2b3e (patch)
tree07ca6360c2a806d41fe4d9c032b3cb98d9fd7b0d /src/gallium/drivers/radeonsi/si_fence.c
parent14b9fa75e4c35ccccb767004ba19212901aae404 (diff)
radeonsi: document some subtle details of fence_finish & fence_server_sync
v2: remove the change to si_fence_server_sync, we'll handle that more robustly Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_fence.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_fence.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/si_fence.c b/src/gallium/drivers/radeonsi/si_fence.c
index 701e8df9cfc..81007192994 100644
--- a/src/gallium/drivers/radeonsi/si_fence.c
+++ b/src/gallium/drivers/radeonsi/si_fence.c
@@ -175,6 +175,28 @@ static boolean si_fence_finish(struct pipe_screen *screen,
if (rctx &&
rfence->gfx_unflushed.ctx == rctx &&
rfence->gfx_unflushed.ib_index == rctx->num_gfx_cs_flushes) {
+ /* Section 4.1.2 (Signaling) of the OpenGL 4.6 (Core profile)
+ * spec says:
+ *
+ * "If the sync object being blocked upon will not be
+ * signaled in finite time (for example, by an associated
+ * fence command issued previously, but not yet flushed to
+ * the graphics pipeline), then ClientWaitSync may hang
+ * forever. To help prevent this behavior, if
+ * ClientWaitSync is called and all of the following are
+ * true:
+ *
+ * * the SYNC_FLUSH_COMMANDS_BIT bit is set in flags,
+ * * sync is unsignaled when ClientWaitSync is called,
+ * * and the calls to ClientWaitSync and FenceSync were
+ * issued from the same context,
+ *
+ * then the GL will behave as if the equivalent of Flush
+ * were inserted immediately after the creation of sync."
+ *
+ * This means we need to flush for such fences even when we're
+ * not going to wait.
+ */
rctx->gfx.flush(rctx, timeout ? 0 : RADEON_FLUSH_ASYNC, NULL);
rfence->gfx_unflushed.ctx = NULL;