lavapipe: fix CmdCopyQueryPoolResults for partial pipeline statistics queries

if this isn't a query for all pipeline statistics, the bits that are
set need to be individually copied in increasing order

Fixes: b38879f8c5 ("vallium: initial import of the vulkan frontend")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9813>
This commit is contained in:
Mike Blumenkrantz 2021-03-24 18:08:27 -04:00 committed by Marge Bot
parent 5ecad3cb44
commit 4ad5bfd1bd
1 changed files with 20 additions and 7 deletions

View File

@ -2343,13 +2343,26 @@ static void handle_copy_query_pool_results(struct lvp_cmd_buffer_entry *cmd,
-1,
copycmd->dst->bo,
offset + (copycmd->flags & VK_QUERY_RESULT_64_BIT ? 8 : 4));
state->pctx->get_query_result_resource(state->pctx,
pool->queries[i],
copycmd->flags & VK_QUERY_RESULT_WAIT_BIT,
copycmd->flags & VK_QUERY_RESULT_64_BIT ? PIPE_QUERY_TYPE_U64 : PIPE_QUERY_TYPE_U32,
0,
copycmd->dst->bo,
offset);
if (pool->type == VK_QUERY_TYPE_PIPELINE_STATISTICS) {
unsigned num_results = 0;
unsigned result_size = copycmd->flags & VK_QUERY_RESULT_64_BIT ? 8 : 4;
u_foreach_bit(bit, pool->pipeline_stats)
state->pctx->get_query_result_resource(state->pctx,
pool->queries[i],
copycmd->flags & VK_QUERY_RESULT_WAIT_BIT,
copycmd->flags & VK_QUERY_RESULT_64_BIT ? PIPE_QUERY_TYPE_U64 : PIPE_QUERY_TYPE_U32,
bit,
copycmd->dst->bo,
offset + num_results++ * result_size);
} else {
state->pctx->get_query_result_resource(state->pctx,
pool->queries[i],
copycmd->flags & VK_QUERY_RESULT_WAIT_BIT,
copycmd->flags & VK_QUERY_RESULT_64_BIT ? PIPE_QUERY_TYPE_U64 : PIPE_QUERY_TYPE_U32,
0,
copycmd->dst->bo,
offset);
}
} else {
/* if no queries emitted yet, just reset the buffer to 0 so avail is reported correctly */
if (copycmd->flags & VK_QUERY_RESULT_WITH_AVAILABILITY_BIT) {