Mesa (main): freedreno/a6xx: Skip emitting tess BO pointers past the shader's constlen.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 2 02:28:46 UTC 2021


Module: Mesa
Branch: main
Commit: 5495359085ac60de970e2588d9052a1ff9f3b69f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5495359085ac60de970e2588d9052a1ff9f3b69f

Author: Emma Anholt <emma at anholt.net>
Date:   Wed Nov 17 14:37:29 2021 -0800

freedreno/a6xx: Skip emitting tess BO pointers past the shader's constlen.

Some shaders don't want these pointers, and going past the constlen would
potentially overwrite consts from other draws.  This is a port of a fix
from turnip.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13851>

---

 src/gallium/drivers/freedreno/a6xx/fd6_const.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_const.c b/src/gallium/drivers/freedreno/a6xx/fd6_const.c
index f774d52361a..edf1e3327ca 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_const.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_const.c
@@ -112,11 +112,14 @@ emit_tess_bos(struct fd_screen *screen, struct fd_ringbuffer *ring,
               struct ir3_shader_variant *s) assert_dt
 {
    const struct ir3_const_state *const_state = ir3_const_state(s);
-   const unsigned regid = const_state->offsets.primitive_param * 4 + 4;
+   const unsigned regid = const_state->offsets.primitive_param + 1;
    uint32_t dwords = 8;
 
+   if (regid >= s->constlen)
+      return;
+
    OUT_PKT7(ring, fd6_stage2opcode(s->type), 7);
-   OUT_RING(ring, CP_LOAD_STATE6_0_DST_OFF(regid / 4) |
+   OUT_RING(ring, CP_LOAD_STATE6_0_DST_OFF(regid) |
                      CP_LOAD_STATE6_0_STATE_TYPE(ST6_CONSTANTS) |
                      CP_LOAD_STATE6_0_STATE_SRC(SS6_DIRECT) |
                      CP_LOAD_STATE6_0_STATE_BLOCK(fd6_stage2shadersb(s->type)) |



More information about the mesa-commit mailing list