lavapipe: fix accel struct device query copy

This change:
1. use vulkan flags instead of pipe query flags
2. set the avail bit when requested

Fixes: a26f96ed3d ("lavapipe: Handle accel struct queries in handle_copy_query_pool_results")
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33951>
(cherry picked from commit e538a38017)
This commit is contained in:
Yiwei Zhang 2025-03-07 13:46:37 -08:00 committed by Eric Engestrom
parent 26b33e2e4d
commit a67d8b0a6b
2 changed files with 6 additions and 2 deletions

View file

@ -3174,7 +3174,7 @@
"description": "lavapipe: fix accel struct device query copy",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "a26f96ed3de63c113f0c30a243ec410b9f5be235",
"notes": null

View file

@ -3084,14 +3084,18 @@ static void handle_copy_query_pool_results(struct vk_cmd_queue_entry *cmd,
uint8_t *map = pipe_buffer_map(state->pctx, lvp_buffer_from_handle(copycmd->dst_buffer)->bo, PIPE_MAP_WRITE, &transfer);
map += offset;
if (flags & VK_QUERY_RESULT_64_BIT) {
if (copycmd->flags & VK_QUERY_RESULT_64_BIT) {
uint64_t *dst = (uint64_t *)map;
uint64_t *src = (uint64_t *)pool->data;
*dst = src[i];
if (copycmd->flags & VK_QUERY_RESULT_WITH_AVAILABILITY_BIT)
*(dst + 1) = 1;
} else {
uint32_t *dst = (uint32_t *)map;
uint64_t *src = (uint64_t *)pool->data;
*dst = (uint32_t) (src[i] & UINT32_MAX);
if (copycmd->flags & VK_QUERY_RESULT_WITH_AVAILABILITY_BIT)
*(dst + 1) = 1;
}
state->pctx->buffer_unmap(state->pctx, transfer);