From 7aed40e4abbb4d3c1e93a0059c77c02b2a5d2f37 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 18 Mar 2022 08:48:39 -0400 Subject: [PATCH] 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 Part-of: --- src/gallium/frontends/lavapipe/lvp_device.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index 2b6ffdbef30..fb37b455b2d 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -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; }