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>
This commit is contained in:
Mike Blumenkrantz 2021-04-20 15:08:17 -04:00 committed by Marge Bot
parent be6532ecdf
commit 04241e826e
1 changed files with 7 additions and 6 deletions

View File

@ -1235,6 +1235,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);
@ -1717,12 +1720,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) {