zink: add util function for submitting the compute batch

sometimes we just want to submit this and not wait on it

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9063>
This commit is contained in:
Mike Blumenkrantz 2020-09-06 10:55:12 -04:00 committed by Marge Bot
parent f1bc95bfa5
commit 759a71b67d
4 changed files with 15 additions and 12 deletions

View file

@ -908,6 +908,13 @@ zink_batch_no_rp(struct zink_context *ctx)
return batch;
}
void
zink_flush_compute(struct zink_context *ctx)
{
zink_end_batch(ctx, &ctx->compute_batch);
zink_start_batch(ctx, &ctx->compute_batch);
}
static void
zink_set_framebuffer_state(struct pipe_context *pctx,
const struct pipe_framebuffer_state *state)
@ -1293,10 +1300,7 @@ zink_texture_barrier(struct pipe_context *pctx, unsigned flags)
struct zink_context *ctx = zink_context(pctx);
if (zink_curr_batch(ctx)->has_draw)
pctx->flush(pctx, NULL, 0);
if (ctx->compute_batch.has_draw) {
zink_end_batch(ctx, &ctx->compute_batch);
zink_start_batch(ctx, &ctx->compute_batch);
}
zink_flush_compute(ctx);
}
static void

View file

@ -207,6 +207,9 @@ zink_fence_wait(struct pipe_context *ctx);
void
zink_wait_on_batch(struct zink_context *ctx, int batch_id);
void
zink_flush_compute(struct zink_context *ctx);
bool
zink_resource_access_is_write(VkAccessFlags flags);

View file

@ -495,8 +495,7 @@ update_descriptors(struct zink_context *ctx, struct zink_screen *screen, bool is
ctx->base.flush(&ctx->base, NULL, PIPE_FLUSH_HINT_FINISH);
else {
/* flush compute batch */
zink_end_batch(ctx, &ctx->compute_batch);
zink_start_batch(ctx, &ctx->compute_batch);
zink_flush_compute(ctx);
}
}

View file

@ -419,10 +419,8 @@ force_cpu_read(struct zink_context *ctx, struct pipe_query *pquery, bool wait, e
union pipe_query_result result;
if (zink_curr_batch(ctx)->batch_id == query->batch_id)
ctx->base.flush(&ctx->base, NULL, PIPE_FLUSH_HINT_FINISH);
else if (is_cs_query(query)) {
zink_end_batch(ctx, &ctx->compute_batch);
zink_start_batch(ctx, &ctx->compute_batch);
}
else if (is_cs_query(query))
zink_flush_compute(ctx);
bool success = get_query_result(&ctx->base, pquery, wait, &result);
if (!success) {
@ -608,8 +606,7 @@ zink_get_query_result(struct pipe_context *pctx,
if (wait)
zink_wait_on_batch(ctx, ZINK_COMPUTE_BATCH_ID);
else {
zink_end_batch(ctx, &ctx->compute_batch);
zink_start_batch(ctx, &ctx->compute_batch);
zink_flush_compute(ctx);
}
} else {
if (wait) {