diff options
author | Bas Nieuwenhuizen <[email protected]> | 2018-02-26 22:50:41 +0100 |
---|---|---|
committer | Bas Nieuwenhuizen <[email protected]> | 2018-03-01 01:07:18 +0100 |
commit | 2a404c6f923880cfd0bc04f9db1890cadce8bd92 (patch) | |
tree | 1f8b99f0cb6fec113c4487b74770983a1e77d3fe /src | |
parent | 49879f3778707e50b2b2d5968996d60557bd99d4 (diff) |
radv: Implement WaitForFences with !waitAll.
Nothing to do except using a busy wait loop. At least for old kernels.
A better implementation for newer kernels to come later.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105255
Fixes: f4e499ec79 "radv: add initial non-conformant radv vulkan driver"
Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/vulkan/radv_device.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 92865122ad5..24ea3b689ec 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -2890,13 +2890,17 @@ void radv_DestroyFence( vk_free2(&device->alloc, pAllocator, fence); } -static uint64_t radv_get_absolute_timeout(uint64_t timeout) + +static uint64_t radv_get_current_time() { - uint64_t current_time; struct timespec tv; - clock_gettime(CLOCK_MONOTONIC, &tv); - current_time = tv.tv_nsec + tv.tv_sec*1000000000ull; + return tv.tv_nsec + tv.tv_sec*1000000000ull; +} + +static uint64_t radv_get_absolute_timeout(uint64_t timeout) +{ + uint64_t current_time = radv_get_current_time(); timeout = MIN2(UINT64_MAX - current_time, timeout); @@ -2914,7 +2918,13 @@ VkResult radv_WaitForFences( timeout = radv_get_absolute_timeout(timeout); if (!waitAll && fenceCount > 1) { - fprintf(stderr, "radv: WaitForFences without waitAll not implemented yet\n"); + while(radv_get_current_time() <= timeout) { + for (uint32_t i = 0; i < fenceCount; ++i) { + if (radv_GetFenceStatus(_device, pFences[i]) == VK_SUCCESS) + return VK_SUCCESS; + } + } + return VK_TIMEOUT; } for (uint32_t i = 0; i < fenceCount; ++i) { |