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

Summary: [PATCH] Fix vsync-ed pageflips on the KMSDRM video driver
Product: SDL Reporter: Manuel Alfayate Corchete <redwindwanderer>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.6   
Hardware: All   
OS: Linux   
Attachments: Small patch that corrects vsynced pageflips on the KMSDRM driver

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