lavapipe: allow timeline progress in GetSemaphoreCounterValue

the vulkan spec doesn't explicitly state whether this function progresses
a given semaphore's timeline, and apparently there are some cases where
it's assumed that progress occurs if this function is called in a loop
instead of WaitSemaphores, so check the current fence for completion

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15453>
This commit is contained in:
Mike Blumenkrantz 2022-03-18 08:48:39 -04:00 committed by Marge Bot
parent 4eca6e3e5d
commit 7aed40e4ab
1 changed files with 10 additions and 1 deletions

View File

@ -2577,7 +2577,16 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_GetSemaphoreCounterValue(
LVP_FROM_HANDLE(lvp_semaphore, sema, _semaphore);
simple_mtx_lock(&sema->lock);
prune_semaphore_links(device, sema, device->queue.last_finished);
*pValue = sema->current;
struct lvp_semaphore_timeline *tl = find_semaphore_timeline(sema, sema->current);
if (tl && fence_finish(device, tl->fence, 0)) {
simple_mtx_lock(&device->queue.last_lock);
if (tl->timeline > device->queue.last_finished)
device->queue.last_finished = tl->timeline;
simple_mtx_unlock(&device->queue.last_lock);
*pValue = tl->signal;
} else {
*pValue = sema->current;
}
simple_mtx_unlock(&sema->lock);
return VK_SUCCESS;
}