We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3901 - [PATCH] Fix vsync-ed pageflips on the KMSDRM video driver
Summary: [PATCH] Fix vsync-ed pageflips on the KMSDRM video driver
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.6
Hardware: All Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-21 11:16 UTC by Manuel Alfayate Corchete
Modified: 2017-10-21 11:21 UTC (History)
0 users

See Also:


Attachments
Small patch that corrects vsynced pageflips on the KMSDRM driver (3.80 KB, patch)
2017-10-21 11:16 UTC, Manuel Alfayate Corchete
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Alfayate Corchete 2017-10-21 11:16:28 UTC
Created attachment 3022 [details]
Small patch that corrects vsynced pageflips on the KMSDRM driver

Hi,

I noticed that, at least on Intel GPU hardware, passing SDL_RENDERER_PRESENTVSYNC would result on a static console instead of the program graphics.
That was due to the fact that calling drmModePageFlip() only works if we have previously set up CRTC to one of the GBM buffers with a drmModeSetCrtc() call, so now it's done and things work as expected.

The KMSDRM_GLES_SetupCrtc() call is done only one time, only when needed (when egl_swapinterval is not 0: when it's 0, there's no need for it because we flip by calling drmModePageFlip() anyway).
The place where KMSDRM_GLES_SetupCrtc() call is done may look strange, but it's right: it needs EGL completely ready because it needs to call eglSwapBuffers() internally to work (see more comments about it in the code).

Please, merge this as soon as possible because I need to send another patch related to KMSDRM video and I am running out of time to work on those things until next summer or so.

Thanks

Manuel Alfayate
Comment 1 Sam Lantinga 2017-10-21 11:21:19 UTC
Patch is added, thanks!
https://hg.libsdl.org/SDL/rev/273acc67dbfa