kmsdrm: If async page flip fails, try again without the async flag. Fixes #16174. (manually cherry picked from commit 69dd29eec2fc12d02e8a05b2fbba2d1cd03c1531)
diff --git a/src/video/kmsdrm/SDL_kmsdrmopengles.c b/src/video/kmsdrm/SDL_kmsdrmopengles.c index 3b17639..fc55880 100644 --- a/src/video/kmsdrm/SDL_kmsdrmopengles.c +++ b/src/video/kmsdrm/SDL_kmsdrmopengles.c
@@ -181,6 +181,14 @@ ret = KMSDRM_drmModePageFlip(viddata->drm_fd, dispdata->crtc->crtc_id, fb_info->fb_id, flip_flags, &windata->waiting_for_flip); + /* some drivers apparently claim they can do async page flip but can't (or have intermittent problems), + so in this specific case just retry without the async flag. If it still fails after that, oh well. */ + if ((ret == -EINVAL) && (flip_flags & DRM_MODE_PAGE_FLIP_ASYNC)) { + flip_flags &= ~DRM_MODE_PAGE_FLIP_ASYNC; + ret = KMSDRM_drmModePageFlip(viddata->drm_fd, dispdata->crtc->crtc_id, + fb_info->fb_id, flip_flags, &windata->waiting_for_flip); + } + if (ret == 0) { windata->waiting_for_flip = SDL_TRUE; } else {