zink: simplify some queue-related query code

we can collapse these conditionals now that things are more unified

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9726>
This commit is contained in:
Mike Blumenkrantz 2020-11-04 15:15:01 -05:00 committed by Marge Bot
parent 01790bfd45
commit a1d03cd031
1 changed files with 8 additions and 13 deletions

View File

@ -612,19 +612,14 @@ zink_get_query_result(struct pipe_context *pctx,
{
struct zink_query *query = (void*)q;
struct zink_context *ctx = zink_context(pctx);
if (is_cs_query(query)) {
if (wait) {
uint32_t batch_id = p_atomic_read(&query->batch_id.usage[ZINK_QUEUE_COMPUTE]);
zink_wait_on_batch(ctx, ZINK_QUEUE_COMPUTE, batch_id);
} else {
zink_flush_queue(ctx, ZINK_QUEUE_COMPUTE);
}
} else {
if (wait) {
zink_fence_wait(pctx);
} else
pctx->flush(pctx, NULL, 0);
}
enum zink_queue queue = is_cs_query(query) ? ZINK_QUEUE_COMPUTE : ZINK_QUEUE_GFX;
uint32_t batch_id = p_atomic_read(&query->batch_id.usage[queue]);
if (wait)
zink_wait_on_batch(ctx, queue, batch_id);
else if (batch_id == ctx->curr_batch)
zink_flush_queue(ctx, queue);
return get_query_result(pctx, q, wait, result);
}