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: 104603fa76 ("zink: create separate linear tiling image for scanout")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10358>
(cherry picked from commit 04241e826e)
This commit is contained in:
Mike Blumenkrantz 2021-04-20 15:08:17 -04:00 committed by Eric Engestrom
parent 9988f53d51
commit 80be401ef8
2 changed files with 8 additions and 7 deletions

View file

@ -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"
},

View file

@ -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) {