| Summary: | [PATCH] KMSDRM_GLES_SwapWindow: call drmModePageFlip for non-vsync case | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Conn O'Griofa <connogriofa> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.1 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Attachments: | [PATCH] KMSDRM_GLES_SwapWindow: call drmModePageFlip for non-vsync case | ||
Patch added, thanks! https://hg.libsdl.org/SDL/rev/33bcd45f0447 |
Created attachment 3953 [details] [PATCH] KMSDRM_GLES_SwapWindow: call drmModePageFlip for non-vsync case When the swap interval is set to 0, the driver behaves as though vertical sync is engaged by limiting framerate to the refresh rate, but performance is very poor. It appears that the call to drmModePageFlip is necessary to prevent the unwanted framerate limit and performance reduction. --- Affected hardware: * Raspberry Pi 3B, Raspberry Pi 4B, Intel Haswell (x86_64) & likely others. Steps to reproduce: * From SDL2 tests, compare "testgl2" with and without "--vsync" parameter. Results without this patch (no vsync / vsync): * RPI3: 60fps / 60fps * RPI4: 60fps / 60fps Results with this patch (no vsync / vsync) * RPI3: ~550fps / 60fps * RPI4: ~650fps / 60fps I can also reproduce the issue of vsync off causing the application to be limited to the refresh rate on Intel Haswell mobile x86_64, but I'm unable to compile the SDL2 tests on this platform due to a build error (unrelated to the proposed patch). Running other SDL2 applications with vsync disabled will show a big performance uplift, though. I'm uncertain if this is the optimal way to solve the issue, so feedback would be appreciated and of course I would be happy to help develop a better fix if needed.