zink: skip readback of qbos with no results

this is a no-op and also crashes

Fixes: 93190be1b9 ("zink: rewrite query internals")

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14397>
(cherry picked from commit b7a4faea9b)
This commit is contained in:
Mike Blumenkrantz 2022-01-04 13:04:07 -05:00 committed by Eric Engestrom
parent f36373e072
commit 48174fea16
2 changed files with 3 additions and 1 deletions

View file

@ -5206,7 +5206,7 @@
"description": "zink: skip readback of qbos with no results",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "93190be1b990d61df329ca0cbce9bd0fb31c7607"
},

View file

@ -459,6 +459,8 @@ get_query_result(struct pipe_context *pctx,
uint64_t *xfb_results = NULL;
uint64_t *results;
bool is_timestamp = query->type == PIPE_QUERY_TIMESTAMP || query->type == PIPE_QUERY_TIMESTAMP_DISJOINT;
if (!qbo->num_results)
continue;
results = pipe_buffer_map_range(pctx, qbo->buffer, 0,
(is_timestamp ? 1 : qbo->num_results) * result_size, flags, &xfer);
if (!results) {