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.main
parent
f4f76a6894
commit
ca37077fb7
|
@ -1910,13 +1910,16 @@ int drmWaitVBlank(int fd, drmVBlankPtr vbl)
|
||||||
do {
|
do {
|
||||||
ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl);
|
ret = ioctl(fd, DRM_IOCTL_WAIT_VBLANK, vbl);
|
||||||
vbl->request.type &= ~DRM_VBLANK_RELATIVE;
|
vbl->request.type &= ~DRM_VBLANK_RELATIVE;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &cur);
|
if (ret && errno == EINTR) {
|
||||||
/* Timeout after 1s */
|
clock_gettime(CLOCK_MONOTONIC, &cur);
|
||||||
if (cur.tv_sec > timeout.tv_sec + 1 ||
|
/* Timeout after 1s */
|
||||||
cur.tv_sec == timeout.tv_sec && cur.tv_nsec >= timeout.tv_nsec) {
|
if (cur.tv_sec > timeout.tv_sec + 1 ||
|
||||||
errno = EBUSY;
|
(cur.tv_sec == timeout.tv_sec && cur.tv_nsec >=
|
||||||
ret = -1;
|
timeout.tv_nsec)) {
|
||||||
break;
|
errno = EBUSY;
|
||||||
|
ret = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} while (ret && errno == EINTR);
|
} while (ret && errno == EINTR);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue