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 3902 - [PATCH] Add a specific KMSDRM hint for low latency video
Summary: [PATCH] Add a specific KMSDRM hint for low latency video
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.6
Hardware: All Linux
: P2 normal
Assignee: Brandon Schaefer
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-21 12:12 UTC by Manuel Alfayate Corchete
Modified: 2017-10-26 23:49 UTC (History)
1 user (show)

See Also:


Attachments
Small patch for low latency mode hint on the KMSDRM video driver (1.90 KB, patch)
2017-10-21 12:12 UTC, Manuel Alfayate Corchete
Details | Diff
Version 2 patch for low latency mode hint on the KMSDRM video driver (3.20 KB, patch)
2017-10-23 13:20 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 12:12:40 UTC
Created attachment 3023 [details]
Small patch for low latency mode hint on the KMSDRM video driver

Hi,

This patch adds low input lag hint to the KMSDRM driver.

In some scenarios, low-latency video is desirable, so instead of letting drmModePageFlip to do it's triple-buffering and thus letting the game to loop once more, we immediately wait for vsync after issuing a pageflip.
This results on a whole frame less of input lag (~16ms on a ~60Hz display).

This behaviour is optional, of course, because the program will become more sensible to system jittering (and have less CPU time to "render ahead"), so the user must pass SDL_KMSDRM_DOUBLE_BUFFER=1 before the program name or set it as an env variable.

The idea was taken from how RetroArch does it, and why.

Thanks

Manuel Alfayate
Comment 1 Manuel Alfayate Corchete 2017-10-23 13:20:01 UTC
Created attachment 3033 [details]
Version 2 patch for low latency mode hint on the KMSDRM video driver

Updated version of the patch. Please merge this version: it saves a function call on every pageflip.
I consider it the final version of this patch, so it's ready to be merged ASAP.
Comment 2 Brandon Schaefer 2017-10-26 23:49:10 UTC
https://hg.libsdl.org/SDL/rev/fbfdee28682d

Thanks!