svga: Retry DRM_VMW_SYNCCPU ioctl on failure.

The ioctl DRM_VMW_SYNCCPU may sometimes fail with ERESTART or EBUSY, which
in turn bubbles up to the application as a GL_OUT_OF_MEMORY error.
We are seeing this in glamor, while this does not cause any real issues, it
does pollute the system log.
Retrying DRM_VMW_SYNCCPU fixes this issue.

Reviewed-by: Neha Bhende <neha.bhende@broadcom.com>
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Martin Krastev <martin.krastev@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29755>
This commit is contained in:
Maaz Mombasawala 2024-05-07 17:40:20 -07:00 committed by Marge Bot
parent f982d2bb79
commit 9cadf45ddf

View file

@ -719,6 +719,7 @@ vmw_ioctl_syncforcpu(struct vmw_region *region,
bool allow_cs)
{
struct drm_vmw_synccpu_arg arg;
int ret;
memset(&arg, 0, sizeof(arg));
arg.op = drm_vmw_synccpu_grab;
@ -731,7 +732,16 @@ vmw_ioctl_syncforcpu(struct vmw_region *region,
if (allow_cs)
arg.flags |= drm_vmw_synccpu_allow_cs;
return drmCommandWrite(region->drm_fd, DRM_VMW_SYNCCPU, &arg, sizeof(arg));
do {
ret = drmCommandWrite(region->drm_fd, DRM_VMW_SYNCCPU, &arg, sizeof(arg));
if (ret == -EBUSY)
usleep(1000);
} while (ret == -ERESTART || ret == -EBUSY);
if (ret)
vmw_error("%s Failed synccpu with error %s.\n", __func__, strerror(-ret));
return ret;
}
/**