Mesa (master): etnaviv: generalize FE stall before loading shader and sampler states

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 12 14:41:37 UTC 2020


Module: Mesa
Branch: master
Commit: dc6c42dc77e4bf0cb07037e038c4a50afa5a8143
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dc6c42dc77e4bf0cb07037e038c4a50afa5a8143

Author: Lucas Stach <l.stach at pengutronix.de>
Date:   Thu Feb  6 17:11:03 2020 +0100

etnaviv: generalize FE stall before loading shader and sampler states

It seems that some of the new shader and sampler states added with
Halti0 are not self-synchronizing anymore. Make sure to stall the FE
before loading those new states to avoid corruption of the in-flight
draw state.

Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
Reviewed-by: Jonathan Marek <jonathan at marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3963>

---

 src/gallium/drivers/etnaviv/etnaviv_emit.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/etnaviv/etnaviv_emit.c b/src/gallium/drivers/etnaviv/etnaviv_emit.c
index cb55b2eb497..de36aeb7f9b 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_emit.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_emit.c
@@ -534,18 +534,18 @@ etna_emit_state(struct etna_context *ctx)
    else
       emit_pre_halti5_state(ctx);
 
-   ctx->emit_texture_state(ctx);
-
-   /* Insert a FE/PE stall as changing the shader instructions (and maybe
-    * the uniforms) can corrupt the previous in-progress draw operation.
-    * Observed with amoeba on GC2000 during the right-to-left rendering
-    * of PI, and can cause GPU hangs immediately after.
-    * I summise that this is because the "new" locations at 0xc000 are not
-    * properly protected against updates as other states seem to be. Hence,
-    * we detect the "new" vertex shader instruction offset to apply this. */
-   if (ctx->dirty & (ETNA_DIRTY_SHADER | ETNA_DIRTY_CONSTBUF) && screen->specs.vs_offset > 0x4000)
+   /* Beginning from Halti0 some of the new shader and sampler states are not
+    * self-synchronizing anymore. Thus we need to stall the FE on PE completion
+    * before loading the new states to avoid corrupting the state of the
+    * in-flight draw.
+    */
+   if (screen->specs.halti >= 0 &&
+       (ctx->dirty & (ETNA_DIRTY_SHADER | ETNA_DIRTY_CONSTBUF |
+                      ETNA_DIRTY_SAMPLERS | ETNA_DIRTY_SAMPLER_VIEWS)))
       etna_stall(ctx->stream, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE);
 
+   ctx->emit_texture_state(ctx);
+
    /* We need to update the uniform cache only if one of the following bits are
     * set in ctx->dirty:
     * - ETNA_DIRTY_SHADER



More information about the mesa-commit mailing list