zink: move work_count from zink_batch to zink_context

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29108>
This commit is contained in:
Mike Blumenkrantz 2024-05-08 10:47:28 -04:00 committed by Marge Bot
parent 8eacafaccc
commit 2837cf9dde
3 changed files with 6 additions and 7 deletions

View file

@ -820,7 +820,7 @@ zink_end_batch(struct zink_context *ctx, struct zink_batch *batch)
}
ctx->last_batch_state = bs;
ctx->batch_states_count++;
batch->work_count = 0;
ctx->work_count = 0;
/* this is swapchain presentation semaphore handling */
if (batch->swapchain) {

View file

@ -504,7 +504,7 @@ zink_draw(struct pipe_context *pctx,
bool mode_changed = ctx->gfx_pipeline_state.gfx_prim_mode != dinfo->mode;
bool reads_drawid = ctx->shader_reads_drawid;
bool reads_basevertex = ctx->shader_reads_basevertex;
unsigned work_count = ctx->batch.work_count;
unsigned work_count = ctx->work_count;
enum mesa_prim mode = (enum mesa_prim)dinfo->mode;
if (ctx->memory_barrier && !ctx->blitting)
@ -1121,7 +1121,7 @@ zink_draw(struct pipe_context *pctx,
batch->state->has_work = true;
ctx->last_work_was_compute = false;
ctx->batch.work_count = work_count;
ctx->work_count = work_count;
/* flush if there's >100k draws */
if (!ctx->unordered_blitting && (unlikely(work_count >= 30000) || ctx->oom_flush))
pctx->flush(pctx, NULL, 0);
@ -1293,7 +1293,7 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
if (ctx->di.any_bindless_dirty && ctx->curr_compute->base.dd.bindless)
zink_descriptors_update_bindless(ctx);
batch->work_count++;
ctx->work_count++;
zink_batch_no_rp(ctx);
if (!ctx->queries_disabled)
zink_resume_cs_query(ctx);
@ -1305,7 +1305,7 @@ zink_launch_grid(struct pipe_context *pctx, const struct pipe_grid_info *info)
batch->state->has_work = true;
ctx->last_work_was_compute = true;
/* flush if there's >100k computes */
if (!ctx->unordered_blitting && (unlikely(ctx->batch.work_count >= 30000) || ctx->oom_flush))
if (!ctx->unordered_blitting && (unlikely(ctx->work_count >= 30000) || ctx->oom_flush))
pctx->flush(pctx, NULL, 0);
}

View file

@ -679,8 +679,6 @@ struct zink_batch {
struct zink_batch_state *state;
struct zink_resource *swapchain;
unsigned work_count;
};
@ -2034,6 +2032,7 @@ struct zink_context {
unsigned memory_barrier;
uint32_t ds3_states;
unsigned work_count;
uint32_t num_so_targets;
struct pipe_stream_output_target *so_targets[PIPE_MAX_SO_BUFFERS];