From 5d3d75717878d7a93d6b122fcea297d88ebf629d Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Tue, 22 Jan 2019 14:22:55 -0800 Subject: [PATCH] iris: Zero the compute predicate when changing the render condition 1. Set a render condition. We emit it immediately on the render engine, and stash q->bo as ice->state.compute_predicate in case the compute engine needs it. 2. Clear the render condition. We were incorrectly leaving a stale compute_predicate kicking around... 3. Dispatch compute. We would then read the stale compute predicate, and try to load it into MI_PREDICATE_DATA. But q->bo may have been freed altogether, causing us to try and use garbage memory as a BO, adding it to the validation list, failing asserts, and tripping EINVALs in execbuf. Huge thanks to Mark Janes for narrowing this sporadic GL CTS failure down to a list of 48 tests I could easily run to reproduce it. Huge thanks to the Valgrind authors for the memcheck tool that immediately pinpointed the problem. --- src/gallium/drivers/iris/iris_query.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gallium/drivers/iris/iris_query.c b/src/gallium/drivers/iris/iris_query.c index 66169d1..4cb59d4 100644 --- a/src/gallium/drivers/iris/iris_query.c +++ b/src/gallium/drivers/iris/iris_query.c @@ -1028,6 +1028,9 @@ iris_render_condition(struct pipe_context *ctx, struct iris_context *ice = (void *) ctx; struct iris_query *q = (void *) query; + /* The old condition isn't relevant; we'll update it if necessary */ + ice->state.compute_predicate = NULL; + if (!q) { ice->state.predicate = IRIS_PREDICATE_STATE_RENDER; return; -- 2.7.4