Retry atomic commit on EINTR and EAGAIN

From the kernel docs:

> -EINTR, -EAGAIN or -ERESTARTSYS, if the IOCTL should be restarted. This can
> either be due to a pending signal, or because the driver needs to completely
> bail out to recover from an exceptional situation like a GPU hang. From a
> userspace point of view all errors are treated equally.

We're not handling ERESTARTSYS because it's non-POSIX.
This commit is contained in:
Simon Ser 2020-01-13 12:26:31 +01:00
parent 95d16704b9
commit f6b4cd6197
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -88,8 +88,10 @@ bool device_test_commit(struct liftoff_device *device,
{
int ret;
do {
ret = drmModeAtomicCommit(device->drm_fd, req,
DRM_MODE_ATOMIC_TEST_ONLY, NULL);
} while (-ret == EINTR || -ret == EAGAIN);
if (ret == 0) {
*compatible = true;
} else if (-ret == EINVAL || -ret == ERANGE) {