[Mesa-dev] [PATCH 3/4] freedreno: synchronize when flushing batches in launch_grid

Hyunjun Ko zzoon at igalia.com
Thu Sep 20 02:52:49 UTC 2018

Since the commit 4b847b38 landed, there has been a race condition in
launch_grid, which is between fdX_launch_grid and rendering in batch flush.

This leads many cts to unstable results, especially for those using
compute shader.

Fixes: many cts for compute shader including dEQP-GLES31.functional.compute.*
 src/gallium/drivers/freedreno/freedreno_draw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index f55905e7bf..0a472c78b1 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -500,7 +500,8 @@ fd_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
 	batch->needs_flush = true;
 	ctx->launch_grid(ctx, info);
-	fd_batch_flush(batch, false, false);
+	/* TODO: flush with sync might affect performance, need to get improved */
+	fd_batch_flush(batch, true, false);
 	fd_batch_reference(&ctx->batch, save_batch);
 	fd_batch_reference(&save_batch, NULL);

More information about the mesa-dev mailing list