summaryrefslogtreecommitdiff
path: root/src/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-08-26 15:06:38 -0700
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-08-30 15:50:23 -0700
commit3f757425a4ec05f9fb27914bfc17661c2ea53af4 (patch)
tree262e14e39b91f2673feda28d3eeb46394555e7b2 /src/panfrost
parentbbe29149670c06a5cb5bdbd17503aae1b1219788 (diff)
downloadmesa-3f757425a4ec05f9fb27914bfc17661c2ea53af4.tar.gz
pan/midgard: Extract instruction sizing helper
The scheduler shouldn't need to worry about this. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/midgard/midgard_schedule.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c
index 79b9b47b104..8d055f086c9 100644
--- a/src/panfrost/midgard/midgard_schedule.c
+++ b/src/panfrost/midgard/midgard_schedule.c
@@ -236,6 +236,21 @@ mir_is_scalar(midgard_instruction *ains)
return could_scalar;
}
+/* How many bytes does this ALU instruction add to the bundle? */
+
+static unsigned
+bytes_for_instruction(midgard_instruction *ains)
+{
+ if (ains->unit & UNITS_ANY_VECTOR)
+ return sizeof(midgard_reg_info) + sizeof(midgard_vector_alu);
+ else if (ains->unit == ALU_ENAB_BRANCH)
+ return sizeof(midgard_branch_extended);
+ else if (ains->compact_branch)
+ return sizeof(ains->br_compact);
+ else
+ return sizeof(midgard_reg_info) + sizeof(midgard_scalar_alu);
+}
+
/* Schedules, but does not emit, a single basic block. After scheduling, the
* final tag and size of the block are known, which are necessary for branching
* */
@@ -468,10 +483,7 @@ schedule_bundle(compiler_context *ctx, midgard_block *block, midgard_instruction
bundle.has_embedded_constants = true;
}
- if (ains->unit & UNITS_ANY_VECTOR) {
- bytes_emitted += sizeof(midgard_reg_info);
- bytes_emitted += sizeof(midgard_vector_alu);
- } else if (ains->compact_branch) {
+ if (ains->compact_branch) {
/* All of r0 has to be written out along with
* the branch writeout */
@@ -490,21 +502,13 @@ schedule_bundle(compiler_context *ctx, midgard_block *block, midgard_instruction
/* TODO don't leak */
midgard_instruction *move =
mem_dup(&ins, sizeof(midgard_instruction));
- bytes_emitted += sizeof(midgard_reg_info);
- bytes_emitted += sizeof(midgard_vector_alu);
+ bytes_emitted += bytes_for_instruction(move);
bundle.instructions[packed_idx++] = move;
}
-
- if (ains->unit == ALU_ENAB_BRANCH) {
- bytes_emitted += sizeof(midgard_branch_extended);
- } else {
- bytes_emitted += sizeof(ains->br_compact);
- }
- } else {
- bytes_emitted += sizeof(midgard_reg_info);
- bytes_emitted += sizeof(midgard_scalar_alu);
}
+ bytes_emitted += bytes_for_instruction(ains);
+
/* Defer marking until after writing to allow for break */
scheduled[index] = ains;
control |= ains->unit;