Mesa (staging/20.1): radeonsi: don't flush in fence_server_sync

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 30 22:31:51 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: c73dd77f6ec42e8353905c342b8d1c1fcb708025
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c73dd77f6ec42e8353905c342b8d1c1fcb708025

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Jun 22 23:54:59 2020 -0400

radeonsi: don't flush in fence_server_sync

This reverts commit 50b06cbc10dbca1dfee89b529ba9b564cc4ea6f6 and fixes
an Android performance regression.

Fixes: 50b06cbc10dbca1dfee89b529ba9b564cc4ea6f6 "radeonsi: fix fence_server_sync() holding up extra work v2"

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5602>
(cherry picked from commit 1401fc055c5496933318e87503144392ad3b6811)

---

 .pick_status.json                       |  2 +-
 src/gallium/drivers/radeonsi/si_fence.c | 13 ++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 273013849d5..db471046295 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -130,7 +130,7 @@
         "description": "radeonsi: don't flush in fence_server_sync",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "50b06cbc10dbca1dfee89b529ba9b564cc4ea6f6"
     },
diff --git a/src/gallium/drivers/radeonsi/si_fence.c b/src/gallium/drivers/radeonsi/si_fence.c
index 91d1bed505d..86b25b5fae4 100644
--- a/src/gallium/drivers/radeonsi/si_fence.c
+++ b/src/gallium/drivers/radeonsi/si_fence.c
@@ -589,13 +589,16 @@ static void si_fence_server_sync(struct pipe_context *ctx, struct pipe_fence_han
    if (sfence->gfx_unflushed.ctx && sfence->gfx_unflushed.ctx == sctx)
       return;
 
-   /* All unflushed commands will not start execution before
-    * this fence dependency is signalled.
+   /* All unflushed commands will not start execution before this fence
+    * dependency is signalled. That's fine. Flushing is very expensive
+    * if we get fence_server_sync after every draw call. (which happens
+    * with Android/SurfaceFlinger)
     *
-    * Therefore we must flush before inserting the dependency
+    * In a nutshell, when CPU overhead is greater than GPU overhead,
+    * or when the time it takes to execute an IB on the GPU is less than
+    * the time it takes to create and submit that IB, flushing decreases
+    * performance. Therefore, DO NOT FLUSH.
     */
-   si_flush_from_st(ctx, NULL, PIPE_FLUSH_ASYNC);
-
    if (sfence->sdma)
       si_add_fence_dependency(sctx, sfence->sdma);
    if (sfence->gfx)



More information about the mesa-commit mailing list