From 0d40460757b809c8c28ee78f79e87a01e79bc518 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 14 Oct 2020 14:10:14 +0200 Subject: [PATCH] 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 Reviewed-by: Alyssa Rosenzweig Part-of: --- 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;