Mesa (staging/20.2): radeonsi/gfx10: flush gfx cs on ngg -> legacy transition

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 1 19:52:30 UTC 2020


Module: Mesa
Branch: staging/20.2
Commit: 2a74f0ceb6066e7d8b3fb6537467e39a06c4b78e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a74f0ceb6066e7d8b3fb6537467e39a06c4b78e

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Mon Nov 23 13:48:42 2020 +0100

radeonsi/gfx10: flush gfx cs on ngg -> legacy transition

with a sequence like this:

  glClear(STENCIL)
  glBeginTransformFeedback()
  ...
  glEndTransformFeedback()
  glClear(STENCIL)

The second clear sometimes may produce an unexpected result.

Calling si_flush_gfx_cs() when doing ngg -> legacy transition seems to be a
valid workaround (both for the synthetic reproducer and the real Blender bug).

Using flush flags or events (BOTTOM_OF_PIPE_TS, RESET_TO_LOWEST_VGT) didn't help.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2941
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7750>
(cherry picked from commit 0b3bd7c5167c7d7a87ded47730641a4103996591)

---

 .pick_status.json                               | 2 +-
 src/gallium/drivers/radeonsi/si_state_shaders.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 0072732fcd7..fbf7a6a6280 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -2020,7 +2020,7 @@
         "description": "radeonsi/gfx10: flush gfx cs on ngg -> legacy transition",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index d9a71dc6776..0b20f3b5640 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -2954,8 +2954,13 @@ bool si_update_ngg(struct si_context *sctx)
        * VGT_FLUSH is also emitted at the beginning of IBs when legacy GS ring
        * pointers are set.
        */
-      if ((sctx->chip_class == GFX10 || sctx->family == CHIP_SIENNA_CICHLID) && !new_ngg)
+      if ((sctx->chip_class == GFX10 || sctx->family == CHIP_SIENNA_CICHLID) && !new_ngg) {
          sctx->flags |= SI_CONTEXT_VGT_FLUSH;
+         if (sctx->chip_class == GFX10) {
+            /* Workaround for https://gitlab.freedesktop.org/mesa/mesa/-/issues/2941 */
+            si_flush_gfx_cs(sctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL);
+         }
+      }
 
       sctx->ngg = new_ngg;
       sctx->last_gs_out_prim = -1; /* reset this so that it gets updated */



More information about the mesa-commit mailing list