From 1bfa0d6ccca9bf5a9e6347bfe9fb5d640cf476b2 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 21 May 2019 04:09:43 +0000 Subject: [PATCH] panfrost/midgard: Misc. cleanup for readibility Mostly, this fixes a number of instances of lines >> 80 chars, refactoring them into something legible. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Ryan Houdek --- .../drivers/panfrost/midgard/compiler.h | 38 ++++++++++++++----- .../panfrost/midgard/midgard_compile.c | 12 +++--- 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/panfrost/midgard/compiler.h b/src/gallium/drivers/panfrost/midgard/compiler.h index 48c6db542a5..79333a4f8d3 100644 --- a/src/gallium/drivers/panfrost/midgard/compiler.h +++ b/src/gallium/drivers/panfrost/midgard/compiler.h @@ -313,17 +313,37 @@ mir_next_op(struct midgard_instruction *ins) return list_first_entry(&(ins->link), midgard_instruction, link); } -#define mir_foreach_block(ctx, v) list_for_each_entry(struct midgard_block, v, &ctx->blocks, link) -#define mir_foreach_block_from(ctx, from, v) list_for_each_entry_from(struct midgard_block, v, from, &ctx->blocks, link) +#define mir_foreach_block(ctx, v) \ + list_for_each_entry(struct midgard_block, v, &ctx->blocks, link) -#define mir_foreach_instr(ctx, v) list_for_each_entry(struct midgard_instruction, v, &ctx->current_block->instructions, link) -#define mir_foreach_instr_safe(ctx, v) list_for_each_entry_safe(struct midgard_instruction, v, &ctx->current_block->instructions, link) -#define mir_foreach_instr_in_block(block, v) list_for_each_entry(struct midgard_instruction, v, &block->instructions, link) -#define mir_foreach_instr_in_block_safe(block, v) list_for_each_entry_safe(struct midgard_instruction, v, &block->instructions, link) -#define mir_foreach_instr_in_block_safe_rev(block, v) list_for_each_entry_safe_rev(struct midgard_instruction, v, &block->instructions, link) -#define mir_foreach_instr_in_block_from(block, v, from) list_for_each_entry_from(struct midgard_instruction, v, from, &block->instructions, link) -#define mir_foreach_instr_in_block_from_rev(block, v, from) list_for_each_entry_from_rev(struct midgard_instruction, v, from, &block->instructions, link) +#define mir_foreach_block_from(ctx, from, v) \ + list_for_each_entry_from(struct midgard_block, v, from, &ctx->blocks, link) +/* The following routines are for use before the scheduler has run */ + +#define mir_foreach_instr(ctx, v) \ + list_for_each_entry(struct midgard_instruction, v, &ctx->current_block->instructions, link) + +#define mir_foreach_instr_safe(ctx, v) \ + list_for_each_entry_safe(struct midgard_instruction, v, &ctx->current_block->instructions, link) + +#define mir_foreach_instr_in_block(block, v) \ + list_for_each_entry(struct midgard_instruction, v, &block->instructions, link) + +#define mir_foreach_instr_in_block_safe(block, v) \ + list_for_each_entry_safe(struct midgard_instruction, v, &block->instructions, link) + +#define mir_foreach_instr_in_block_safe_rev(block, v) \ + list_for_each_entry_safe_rev(struct midgard_instruction, v, &block->instructions, link) + +#define mir_foreach_instr_in_block_from(block, v, from) \ + list_for_each_entry_from(struct midgard_instruction, v, from, &block->instructions, link) + +#define mir_foreach_instr_in_block_from_rev(block, v, from) \ + list_for_each_entry_from_rev(struct midgard_instruction, v, from, &block->instructions, link) + +#define mir_foreach_bundle_in_block(block, v) \ + util_dynarray_foreach(&block->bundles, midgard_bundle, v) static inline midgard_instruction * mir_last_in_block(struct midgard_block *block) diff --git a/src/gallium/drivers/panfrost/midgard/midgard_compile.c b/src/gallium/drivers/panfrost/midgard/midgard_compile.c index 516fb2f67f9..5065ef80d64 100644 --- a/src/gallium/drivers/panfrost/midgard/midgard_compile.c +++ b/src/gallium/drivers/panfrost/midgard/midgard_compile.c @@ -1785,8 +1785,10 @@ schedule_bundle(compiler_context *ctx, midgard_block *block, midgard_instruction int op = ains->alu.op; int units = alu_opcode_props[op].props; - /* TODO: Promotion of scalars to vectors */ - int vector = ((!is_single_component_mask(ains->alu.mask)) || ((units & UNITS_SCALAR) == 0)) && (units & UNITS_ANY_VECTOR); + bool vectorable = units & UNITS_ANY_VECTOR; + bool scalarable = units & UNITS_SCALAR; + bool could_scalar = is_single_component_mask(ains->alu.mask); + bool vector = vectorable && !(could_scalar && scalarable); if (!vector) assert(units & UNITS_SCALAR); @@ -1932,11 +1934,9 @@ schedule_bundle(compiler_context *ctx, midgard_block *block, midgard_instruction } - /* ERRATA (?): In a bundle ending in a fragment writeout, the register dependencies of r0 cannot be written within this bundle (discovered in -bshading:shading=phong) */ - if (register_dep_mask & written_mask) { - DBG("ERRATA WORKAROUND: Breakup for writeout dependency masks %X vs %X (common %X)\n", register_dep_mask, written_mask, register_dep_mask & written_mask); + /* Register dependencies of r0 must be out of fragment writeout bundle */ + if (register_dep_mask & written_mask) break; - } if (written_late) break; -- 2.30.2