Mesa (staging/21.3): etnaviv: initialize vertex attributes on context reset

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 5 21:19:11 UTC 2022


Module: Mesa
Branch: staging/21.3
Commit: 6742bdec508f344638c02bc72649e7af7f2a3b3e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6742bdec508f344638c02bc72649e7af7f2a3b3e

Author: Lucas Stach <l.stach at pengutronix.de>
Date:   Tue Dec 21 21:58:07 2021 +0100

etnaviv: initialize vertex attributes on context reset

It seems that at least some GC400 come out of reset with random vertex
attributes enabled and also don't disable them on the write to the first
config register as normal. Enabling all attributes seems to provide the
GPU with the required edge to actually disable the unused attributes on
the next draw.

Cc: mesa-stable
Reported-by: Steven Walter
Signed-off-by: Lucas Stach <l.stach at pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14285>
(cherry picked from commit c1f8bc67e29e9b05d60e1354fa04927fce5f396b)

---

 .pick_status.json                             |  2 +-
 src/gallium/drivers/etnaviv/etnaviv_context.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index e1bf3c65fac..20d20b83e31 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -13,7 +13,7 @@
         "description": "etnaviv: initialize vertex attributes on context reset",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index f2ab4ecfe14..6b1327676d7 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -407,6 +407,7 @@ etna_reset_gpu_state(struct etna_context *ctx)
 {
    struct etna_cmd_stream *stream = ctx->stream;
    struct etna_screen *screen = ctx->screen;
+   uint32_t dummy_attribs[VIVS_NFE_GENERIC_ATTRIB__LEN] = { 0 };
 
    etna_set_state(stream, VIVS_GL_API_MODE, VIVS_GL_API_MODE_OPENGL);
    etna_set_state(stream, VIVS_GL_VERTEX_ELEMENT_CONFIG, 0x00000001);
@@ -467,6 +468,20 @@ etna_reset_gpu_state(struct etna_context *ctx)
             VIVS_VS_ICACHE_INVALIDATE_UNK4);
    }
 
+   /* It seems that some GPUs (at least some GC400 have shown this behavior)
+    * come out of reset with random vertex attributes enabled and also don't
+    * disable them on the write to the first config register as normal. Enabling
+    * all attributes seems to provide the GPU with the required edge to actually
+    * disable the unused attributes on the next draw.
+    */
+   if (screen->specs.halti >= 5) {
+      etna_set_state_multi(stream, VIVS_NFE_GENERIC_ATTRIB_CONFIG0(0),
+                           VIVS_NFE_GENERIC_ATTRIB__LEN, dummy_attribs);
+   } else {
+      etna_set_state_multi(stream, VIVS_FE_VERTEX_ELEMENT_CONFIG(0),
+                           screen->specs.halti >= 0 ? 16 : 12, dummy_attribs);
+   }
+
    ctx->dirty = ~0L;
    ctx->dirty_sampler_views = ~0L;
 }



More information about the mesa-commit mailing list