From: Icecream95 Date: Sun, 5 Jul 2020 12:22:22 +0000 (+1200) Subject: pan/mdg: Handle tilebuffer wait loops X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=61dfc3c693d27d2cdbd3cdf2ac33181c1af93b92;p=mesa.git pan/mdg: Handle tilebuffer wait loops Reviewed-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index fb3dff1c8d0..09b18c89895 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -51,6 +51,7 @@ struct midgard_block; #define TARGET_BREAK 1 #define TARGET_CONTINUE 2 #define TARGET_DISCARD 3 +#define TARGET_TILEBUF_WAIT 4 typedef struct midgard_branch { /* If conditional, the condition is specified in r31.w */ diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 9f365d0c69a..7da75d63f19 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -2851,13 +2851,17 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b bool is_conditional = ins->branch.conditional; bool is_inverted = ins->branch.invert_conditional; bool is_discard = ins->branch.target_type == TARGET_DISCARD; + bool is_tilebuf_wait = ins->branch.target_type == TARGET_TILEBUF_WAIT; + bool is_special = is_discard || is_tilebuf_wait; bool is_writeout = ins->writeout; /* Determine the block we're jumping to */ int target_number = ins->branch.target_block; /* Report the destination tag */ - int dest_tag = is_discard ? 0 : midgard_get_first_tag_from_block(ctx, target_number); + int dest_tag = is_discard ? 0 : + is_tilebuf_wait ? bundle->tag : + midgard_get_first_tag_from_block(ctx, target_number); /* Count up the number of quadwords we're * jumping over = number of quadwords until @@ -2867,6 +2871,8 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b if (is_discard) { /* Ignored */ + } else if (is_tilebuf_wait) { + quadword_offset = -1; } else if (target_number > br_block_idx) { /* Jump forward */ @@ -2901,6 +2907,7 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b midgard_jmp_writeout_op op = is_discard ? midgard_jmp_writeout_op_discard : + is_tilebuf_wait ? midgard_jmp_writeout_op_tilebuffer_pending : is_writeout ? midgard_jmp_writeout_op_writeout : (is_compact && !is_conditional) ? midgard_jmp_writeout_op_branch_uncond : midgard_jmp_writeout_op_branch_cond; @@ -2913,7 +2920,7 @@ midgard_compile_shader_nir(nir_shader *nir, panfrost_program *program, bool is_b quadword_offset); memcpy(&ins->branch_extended, &branch, sizeof(branch)); - } else if (is_conditional || is_discard) { + } else if (is_conditional || is_special) { midgard_branch_cond branch = { .op = op, .dest_tag = dest_tag,