From 80be401ef8c613fa5f3b3b554dcf4a864ff76a29 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Tue, 20 Apr 2021 15:08:17 -0400 Subject: [PATCH] zink: add clear-on-flush mechanic deeper into flush codepath we should probably trigger this any time a flush occurs just to avoid doing too much (unexpected) cmdstream rewriting both calls must be kept, however, as the one in the base flush hook will change the behavior of flushing if no other work is queued Fixes: 104603fa763 ("zink: create separate linear tiling image for scanout") Part-of: (cherry picked from commit 04241e826eabf9fab16596d0454fffb48d476c93) --- .pick_status.json | 2 +- src/gallium/drivers/zink/zink_context.c | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 5c3a3c20f1b..c2ae39c8ad2 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -58,7 +58,7 @@ "description": "zink: add clear-on-flush mechanic deeper into flush codepath", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "104603fa763c52e98a79785dd514beab949546db" }, diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index dc054884a0a..be975cdc0b7 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -1217,6 +1217,9 @@ static void flush_batch(struct zink_context *ctx, bool sync) { struct zink_batch *batch = &ctx->batch; + if (ctx->clears_enabled) + /* start rp to do all the clears */ + zink_begin_render_pass(ctx, batch); zink_end_render_pass(ctx, batch); zink_end_batch(ctx, batch); @@ -1699,12 +1702,10 @@ zink_flush(struct pipe_context *pctx, struct zink_fence *fence = NULL; struct zink_screen *screen = zink_screen(ctx->base.screen); - if (!deferred) { - if (ctx->clears_enabled) - /* start rp to do all the clears */ - zink_begin_render_pass(ctx, batch); - zink_end_render_pass(ctx, batch); - } + /* triggering clears will force has_work */ + if (!deferred && ctx->clears_enabled) + /* start rp to do all the clears */ + zink_begin_render_pass(ctx, batch); if (!batch->has_work) { if (pfence) {