zink: add util function for returning previous batch

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9243>
This commit is contained in:
Mike Blumenkrantz 2020-09-30 12:54:10 -04:00
parent 24b237d3d4
commit c271ac0066
1 changed files with 12 additions and 0 deletions

View File

@ -204,6 +204,18 @@ zink_curr_batch(struct zink_context *ctx)
return ctx->batches + ctx->curr_batch;
}
static inline struct zink_batch *
zink_prev_batch(struct zink_context *ctx)
{
unsigned curr_batch = ctx->curr_batch;
if (!curr_batch)
curr_batch = ZINK_NUM_GFX_BATCHES - 1;
else
curr_batch--;
assert(curr_batch < ARRAY_SIZE(ctx->batches));
return ctx->batches + curr_batch;
}
struct zink_batch *
zink_batch_rp(struct zink_context *ctx);