diff options
author | Marek Olšák <[email protected]> | 2011-03-05 21:46:06 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-03-08 23:52:37 +0100 |
commit | ac8821ffe2fc3972bc4744201491a4a41df877e6 (patch) | |
tree | 2e95bf6f6da8759f8b0cd98aba23fa22e1f696bd /src/gallium/drivers/r300 | |
parent | b39bccbd4ed71e9585da4cf5acf7b887b2e90899 (diff) |
r300g: handle timeout parameter in fence_finish
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r-- | src/gallium/drivers/r300/r300_screen.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 18ed0356cae..a929a2e282b 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -24,6 +24,7 @@ #include "util/u_format.h" #include "util/u_format_s3tc.h" #include "util/u_memory.h" +#include "os/os_time.h" #include "r300_context.h" #include "r300_texture.h" @@ -440,6 +441,22 @@ static int r300_fence_finish(struct pipe_screen *screen, struct r300_winsys_screen *rws = r300_screen(screen)->rws; struct r300_winsys_bo *rfence = (struct r300_winsys_bo*)fence; + if (timeout != PIPE_TIMEOUT_INFINITE) { + int64_t start_time = os_time_get(); + + /* Convert to microseconds. */ + timeout /= 1000; + + /* Wait in a loop. */ + while (rws->buffer_is_busy(rfence)) { + if (os_time_get() - start_time >= timeout) { + return 1; + } + os_time_sleep(10); + } + return 0; + } + rws->buffer_wait(rfence); return 0; /* 0 == success */ } |