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

Author: Asahi Lina <[email protected]>
Date:   Wed May  3 20:32:00 2023 +0900

asahi: Implement memory_barrier

Cargo culted from panfrost.

Signed-off-by: Asahi Lina <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22971>

---

 src/gallium/drivers/asahi/agx_pipe.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/drivers/asahi/agx_pipe.c 
b/src/gallium/drivers/asahi/agx_pipe.c
index 6ce37d9396b..16f53ef8bac 100644
--- a/src/gallium/drivers/asahi/agx_pipe.c
+++ b/src/gallium/drivers/asahi/agx_pipe.c
@@ -1353,6 +1353,13 @@ agx_invalidate_resource(struct pipe_context *pctx,
    }
 }
 
+static void
+agx_memory_barrier(struct pipe_context *pctx, unsigned flags)
+{
+   /* Be conservative for now, we can try to optimize this more later */
+   agx_flush_all(agx_context(pctx), "Memory barrier");
+}
+
 static struct pipe_context *
 agx_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
 {
@@ -1394,6 +1401,7 @@ agx_create_context(struct pipe_screen *screen, void 
*priv, unsigned flags)
    pctx->set_debug_callback = u_default_set_debug_callback;
    pctx->get_sample_position = u_default_get_sample_position;
    pctx->invalidate_resource = agx_invalidate_resource;
+   pctx->memory_barrier = agx_memory_barrier;
 
    agx_init_state_functions(pctx);
    agx_init_query_functions(pctx);

Reply via email to