[Mesa-dev] [PATCH] i965/fs: Pass block to insert and remove functions missed earlier.
Kenneth Graunke
kenneth at whitecape.org
Thu Sep 4 00:43:52 PDT 2014
From: Matt Turner <mattst88 at gmail.com>
Otherwise, the basic block start/end IPs don't get updated properly,
leading to a broken CFG. This usually results in the following
assertion failure:
brw_fs_live_variables.cpp:141:
void brw::fs_live_variables::setup_def_use():
Assertion `ip == block->start_ip' failed.
Fixes KWin, WebGL demos, and a score of Piglit tests on Sandybridge and
earlier hardware.
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
Here's a patch I cooked up that fixes all of the ip == block->start_ip
assertion failures that have shown up in all kinds of programs on
Sandybridge and earlier hardware. Those platforms are basically unusable
without this patch.
I put Matt's authorship on it, because it's basically his patch with the
same name from his recent 20 patch series (awaiting review on the list),
but in a form that we can apply now, without taking the other 19 patches
(which could cause other regressions). It seems worth fixing the major
problems now, and then evaluating the rest of the patches as usual.
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 5f98287..69982c5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -2151,7 +2151,7 @@ fs_visitor::compute_to_mrf()
calculate_live_intervals();
- foreach_in_list_safe(fs_inst, inst, &instructions) {
+ foreach_block_and_inst_safe(block, fs_inst, inst, cfg) {
int ip = next_ip;
next_ip++;
@@ -2229,7 +2229,7 @@ fs_visitor::compute_to_mrf()
scan_inst->dst.file = MRF;
scan_inst->dst.reg = inst->dst.reg;
scan_inst->saturate |= inst->saturate;
- inst->remove();
+ inst->remove(block);
progress = true;
}
break;
@@ -2342,7 +2342,7 @@ fs_visitor::try_rep_send()
* destination registers in our block of MOVs.
*/
count = 0;
- foreach_in_list_safe(fs_inst, inst, &this->instructions) {
+ foreach_block_and_inst_safe(block, fs_inst, inst, cfg) {
if (count == 0)
start = inst;
if (inst->opcode == BRW_OPCODE_MOV &&
@@ -2381,9 +2381,9 @@ fs_visitor::try_rep_send()
mov->dst.type = BRW_REGISTER_TYPE_F;
/* Replace the four MOVs with the new vec4 MOV. */
- start->insert_before(mov);
+ start->insert_before(block, mov);
for (i = 0; i < 4; i++)
- mov->next->remove();
+ ((fs_inst *) mov->next)->remove(block);
/* Finally, adjust the message length and set the opcode to
* REP_FB_WRITE for the send, so that the generator will use the
@@ -3147,14 +3147,14 @@ fs_visitor::opt_drop_redundant_mov_to_flags()
{
bool flag_mov_found[2] = {false};
- foreach_in_list_safe(fs_inst, inst, &instructions) {
+ foreach_block_and_inst_safe(block, fs_inst, inst, cfg) {
if (inst->is_control_flow()) {
memset(flag_mov_found, 0, sizeof(flag_mov_found));
} else if (inst->opcode == FS_OPCODE_MOV_DISPATCH_TO_FLAGS) {
if (!flag_mov_found[inst->flag_subreg])
flag_mov_found[inst->flag_subreg] = true;
else
- inst->remove();
+ inst->remove(block);
} else if (inst->writes_flag()) {
flag_mov_found[inst->flag_subreg] = false;
}
--
2.0.0
More information about the mesa-dev
mailing list