From b102f045ab04ca302ac55a72eb64e117ad3510ca Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 24 Nov 2022 12:35:22 -0500 Subject: [PATCH] asahi: Set GPR count accurately for background/EOT Better occupancy, which is especially important when the background shader does memory access (for reloads). On my 4K monitor, glmark2 -bdesktop fullscreen from 95fps to 133fps. At default settings, glmark2 -bterrain from 63fps to 71fps. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/lib/agx_meta.c | 5 ++--- src/asahi/lib/agx_meta.h | 2 ++ src/gallium/drivers/asahi/agx_state.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/asahi/lib/agx_meta.c b/src/asahi/lib/agx_meta.c index 047051c5494..8e624c60a96 100644 --- a/src/asahi/lib/agx_meta.c +++ b/src/asahi/lib/agx_meta.c @@ -14,7 +14,6 @@ agx_compile_meta_shader(struct agx_meta_cache *cache, nir_shader *shader, struct agx_shader_key *key, struct agx_tilebuffer_layout *tib) { - struct agx_shader_info info = { 0 }; struct util_dynarray binary; util_dynarray_init(&binary, NULL); @@ -22,9 +21,9 @@ agx_compile_meta_shader(struct agx_meta_cache *cache, nir_shader *shader, if (tib) agx_nir_lower_tilebuffer(shader, tib); - agx_compile_shader_nir(shader, key, NULL, &binary, &info); - struct agx_meta_shader *res = rzalloc(cache->ht, struct agx_meta_shader); + agx_compile_shader_nir(shader, key, NULL, &binary, &res->info); + res->ptr = agx_pool_upload_aligned_with_bo(&cache->pool, binary.data, binary.size, 128, &res->bo); diff --git a/src/asahi/lib/agx_meta.h b/src/asahi/lib/agx_meta.h index 736f2447584..1b1b1231c20 100644 --- a/src/asahi/lib/agx_meta.h +++ b/src/asahi/lib/agx_meta.h @@ -6,6 +6,7 @@ #ifndef __AGX_META_H #define __AGX_META_H +#include "asahi/compiler/agx_compile.h" #include "agx_tilebuffer.h" #include "pool.h" @@ -29,6 +30,7 @@ struct agx_meta_key { }; struct agx_meta_shader { + struct agx_shader_info info; struct agx_bo *bo; uint32_t ptr; }; diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 6d73ae4957c..6b88d7ecd22 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -1532,7 +1532,7 @@ agx_build_meta(struct agx_batch *batch, bool store, bool partial_render) cfg.unk_2 = 0; } - agx_usc_pack(&b, REGISTERS, cfg) cfg.register_count = 256; + agx_usc_pack(&b, REGISTERS, cfg) cfg.register_count = shader->info.nr_gprs; agx_usc_pack(&b, NO_PRESHADER, cfg); return agx_usc_fini(&b);