radeonsi: recompute the relative timeout after waiting for ready fence
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 13 Nov 2017 13:50:17 +0000 (14:50 +0100)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 20 Nov 2017 17:16:06 +0000 (18:16 +0100)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/drivers/radeonsi/si_fence.c

index fa80f4fd87a3130589936a551f50ac884883f803..ff1800ce785c0dabc05392ead1b88771a73a977b 100644 (file)
@@ -216,6 +216,11 @@ static boolean si_fence_finish(struct pipe_screen *screen,
                        if (!util_queue_fence_wait_timeout(&rfence->ready, abs_timeout))
                                return false;
                }
+
+               if (timeout && timeout != PIPE_TIMEOUT_INFINITE) {
+                       int64_t time = os_time_get_nano();
+                       timeout = abs_timeout > time ? abs_timeout - time : 0;
+               }
        }
 
        if (rfence->sdma) {