radv: Implement waiting on non-submitted fences.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Mon, 26 Feb 2018 21:54:06 +0000 (22:54 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 1 Mar 2018 00:07:18 +0000 (01:07 +0100)
Fixes: f4e499ec79 "radv: add initial non-conformant radv vulkan driver"
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_device.c

index 24ea3b689ecb9ce08fc9e1b7da40e5f53f60689a..8eadd8f2037872947c708ce3ded546a836909005 100644 (file)
@@ -2946,8 +2946,17 @@ VkResult radv_WaitForFences(
                if (fence->signalled)
                        continue;
 
-               if (!fence->submitted)
-                       return VK_TIMEOUT;
+               if (!fence->submitted) {
+                       while(radv_get_current_time() <= timeout && !fence->submitted)
+                               /* Do nothing */;
+
+                       if (!fence->submitted)
+                               return VK_TIMEOUT;
+
+                       /* Recheck as it may have been set by submitting operations. */
+                       if (fence->signalled)
+                               continue;
+               }
 
                expired = device->ws->fence_wait(device->ws, fence->fence, true, timeout);
                if (!expired)