Mesa (master): freedreno/ir3: fix crash

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 13 20:53:39 UTC 2018


Module: Mesa
Branch: master
Commit: c19c4bf48845be044605a97d0ea0c278bf2e1d6e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c19c4bf48845be044605a97d0ea0c278bf2e1d6e

Author: Rob Clark <robdclark at gmail.com>
Date:   Mon Dec 10 10:39:28 2018 -0500

freedreno/ir3: fix crash

Fixes a crash in dEQP-GLES3.functional.shaders.fragdepth.compare.fragcoord_z

Fixes: 0d240c22141 freedreno/ir3: don't fetch unused tex components
Signed-off-by: Rob Clark <robdclark at gmail.com>

---

 src/freedreno/ir3/ir3_depth.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/src/freedreno/ir3/ir3_depth.c b/src/freedreno/ir3/ir3_depth.c
index 77f9af6173..4e377fa4ee 100644
--- a/src/freedreno/ir3/ir3_depth.c
+++ b/src/freedreno/ir3/ir3_depth.c
@@ -177,27 +177,21 @@ remove_unused_by_block(struct ir3_block *block)
 			if (instr->opc == OPC_META_FO) {
 				struct ir3_instruction *src = ssa(instr->regs[1]);
 				if (src->regs[0]->wrmask > 1) {
-					unsigned newn, lastn;
-
-					lastn = util_last_bit(src->regs[0]->wrmask);
 					src->regs[0]->wrmask &= ~(1 << instr->fo.off);
-					newn = util_last_bit(src->regs[0]->wrmask);
 
 					/* prune no-longer needed right-neighbors.  We could
 					 * probably do the same for left-neighbors (ie. tex
 					 * fetch that only need .yw components), but that
 					 * makes RA a bit more confusing than it already is
 					 */
-					if (newn < lastn) {
-						struct ir3_instruction *n = ir3_neighbor_first(instr);
-						for (unsigned i = 1; i < newn; i++) {
-							n = n->cp.right;
-						}
-						// XXX I don't think n should be null here!
-						if (n) {
-							debug_assert(n->cp.right->flags & IR3_INSTR_UNUSED);
-							n->cp.right = NULL;
-						}
+					struct ir3_instruction *n = instr;
+					while (n && n->cp.right)
+						n = n->cp.right;
+					while (n->flags & IR3_INSTR_UNUSED) {
+						n = n->cp.left;
+						if (!n)
+							break;
+						n->cp.right = NULL;
 					}
 				}
 			}




More information about the mesa-commit mailing list