diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-01-07 10:48:26 -0800 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-01-07 10:48:26 -0800 |
commit | ca37077fb78b69a00500827f1db12b70affa1514 (patch) | |
tree | 617e969a660389f1f7a4b502a9c948e88d28b215 | |
parent | f4f76a6894b40abd77f0ffbf52972127608b9bca (diff) |
libdrm: only check for vblank timeout if we caught EINTR
Michel caught a case where we might overwrite a success or other return
value with EBUSY, so check the return value before checking for the
timeout condition.
-rw-r--r-- | libdrm/xf86drm.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libdrm/xf86drm.c b/libdrm/xf86drm.c index 3396e283..55df19ab 100644 --- a/libdrm/xf86drm.c +++ b/libdrm/xf86drm.c @@ -1910,13 +1910,16 @@ int drmWaitVBlank(int fd, drmVBlankPtr vbl) do { ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl); vbl->request.type &= ~DRM_VBLANK_RELATIVE; - clock_gettime(CLOCK_MONOTONIC, &cur); - /* Timeout after 1s */ - if (cur.tv_sec > timeout.tv_sec + 1 || - cur.tv_sec == timeout.tv_sec && cur.tv_nsec >= timeout.tv_nsec) { - errno = EBUSY; - ret = -1; - break; + if (ret && errno == EINTR) { + clock_gettime(CLOCK_MONOTONIC, &cur); + /* Timeout after 1s */ + if (cur.tv_sec > timeout.tv_sec + 1 || + (cur.tv_sec == timeout.tv_sec && cur.tv_nsec >= + timeout.tv_nsec)) { + errno = EBUSY; + ret = -1; + break; + } } } while (ret && errno == EINTR); |