Mesa (master): pan/bi: Reserve r0-r3 in blend shaders

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Oct 15 06:15:58 UTC 2020


Module: Mesa
Branch: master
Commit: 0d40460757b809c8c28ee78f79e87a01e79bc518
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0d40460757b809c8c28ee78f79e87a01e79bc518

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Wed Oct 14 14:10:14 2020 +0200

pan/bi: Reserve r0-r3 in blend shaders

Blend shaders are passed the source color through r0-r3. Let's avoid
allocating those. The is definitely not the right solution but is good
enough for now.

Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7151>

---

 src/panfrost/bifrost/bi_ra.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/panfrost/bifrost/bi_ra.c b/src/panfrost/bifrost/bi_ra.c
index 6760546f0aa..7a3b307eedc 100644
--- a/src/panfrost/bifrost/bi_ra.c
+++ b/src/panfrost/bifrost/bi_ra.c
@@ -69,8 +69,15 @@ bi_allocate_registers(bi_context *ctx, bool *success)
         struct lcra_state *l =
                 lcra_alloc_equations(node_count, 1);
 
-        l->class_start[BI_REG_CLASS_WORK] = 0;
-        l->class_size[BI_REG_CLASS_WORK] = 64 * 4; /* R0 - R63, all 32-bit */
+        if (ctx->is_blend) {
+                /* R0-R3 are reserved for the blend input */
+                l->class_start[BI_REG_CLASS_WORK] = 4 * 4;
+                l->class_size[BI_REG_CLASS_WORK] = 64 * 4;
+        } else {
+                /* R0 - R63, all 32-bit */
+                l->class_start[BI_REG_CLASS_WORK] = 0;
+                l->class_size[BI_REG_CLASS_WORK] = 64 * 4;
+        }
 
         bi_foreach_instr_global(ctx, ins) {
                 unsigned dest = ins->dest;



More information about the mesa-commit mailing list