zink: check for a work_count-based stall in zink_maybe_flush_or_stall()

put all the maybes in one place

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10760>
This commit is contained in:
Mike Blumenkrantz 2021-04-02 12:13:13 -04:00 committed by Marge Bot
parent afb837523d
commit 9fc2b47870
2 changed files with 3 additions and 5 deletions

View file

@ -2024,7 +2024,9 @@ zink_maybe_flush_or_stall(struct zink_context *ctx)
{
struct zink_screen *screen = zink_screen(ctx->base.screen);
/* flush anytime our total batch memory usage is potentially >= 50% of total video memory */
if (ctx->batch.state->resource_size >= screen->total_video_mem / 2)
if (ctx->batch.state->resource_size >= screen->total_video_mem / 2 ||
/* or if there's >100k draws+computes */
ctx->batch.state->work_count[0] + ctx->batch.state->work_count[1] >= 100000)
flush_batch(ctx, true);
if (ctx->resource_size >= screen->total_video_mem / 2 || _mesa_hash_table_num_entries(&ctx->batch_states) > 100) {

View file

@ -714,8 +714,6 @@ zink_draw_vbo(struct pipe_context *pctx,
screen->vk_CmdEndTransformFeedbackEXT(batch->state->cmdbuf, 0, ctx->num_so_targets, counter_buffers, counter_buffer_offsets);
}
batch->has_work = true;
if (batch->state->work_count[0] + batch->state->work_count[1] >= 100000)
pctx->flush(pctx, NULL, 0);
}
void
@ -754,6 +752,4 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
} else
vkCmdDispatch(batch->state->cmdbuf, info->grid[0], info->grid[1], info->grid[2]);
batch->has_work = true;
if (batch->state->work_count[0] + batch->state->work_count[1] >= 100000)
pctx->flush(pctx, NULL, 0);
}