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

Author: Alyssa Rosenzweig <aly...@rosenzweig.io>
Date:   Sun May  9 21:01:34 2021 -0400

agx: Condition writeout ops on already being emitted

There's a lot of r/e waiting here, but will be needed for ld_tile. Match
the Metal blob.

Signed-off-by: Alyssa Rosenzweig <aly...@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10720>

---

 src/asahi/compiler/agx_compile.c  | 9 +++++++--
 src/asahi/compiler/agx_compiler.h | 3 +++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/asahi/compiler/agx_compile.c b/src/asahi/compiler/agx_compile.c
index b344ecce532..f4b6d059524 100644
--- a/src/asahi/compiler/agx_compile.c
+++ b/src/asahi/compiler/agx_compile.c
@@ -172,9 +172,14 @@ agx_emit_fragment_out(agx_builder *b, nir_intrinsic_instr 
*instr)
    unsigned rt = (loc - FRAG_RESULT_DATA0);
 
    /* TODO: Reverse-engineer interactions with MRT */
-   agx_writeout(b, 0xC200);
-   agx_writeout(b, 0x000C);
+   if (b->shader->did_writeout) {
+          agx_writeout(b, 0x0004);
+   } else {
+          agx_writeout(b, 0xC200);
+          agx_writeout(b, 0x000C);
+   }
 
+   b->shader->did_writeout = true;
    return agx_st_tile(b, agx_src_index(&instr->src[0]),
              b->shader->key->fs.tib_formats[rt]);
 }
diff --git a/src/asahi/compiler/agx_compiler.h 
b/src/asahi/compiler/agx_compiler.h
index 030cb26585b..0c45c0e0b60 100644
--- a/src/asahi/compiler/agx_compiler.h
+++ b/src/asahi/compiler/agx_compiler.h
@@ -318,6 +318,9 @@ typedef struct {
    /* For creating temporaries */
    unsigned alloc;
 
+   /* I don't really understand how writeout ops work yet */
+   bool did_writeout;
+
    /* Stats for shader-db */
    unsigned loop_count;
    unsigned spills;

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to