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 3273 - [PATCH] Fix for slow video subsystem initialization when using XRandR.
Summary: [PATCH] Fix for slow video subsystem initialization when using XRandR.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.4
Hardware: All Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-28 18:38 UTC by Martín Golini
Modified: 2017-09-05 15:26 UTC (History)
0 users

See Also:


Attachments
Use X11_XRRGetScreenResourcesCurrent when possible. (1.92 KB, patch)
2016-02-28 18:38 UTC, Martín Golini
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martín Golini 2016-02-28 18:38:39 UTC
Created attachment 2385 [details]
Use X11_XRRGetScreenResourcesCurrent when possible.

Hi,
I'm having a very slow initialization of the video subsystem that locks the window creation for about 500 ms ( tested in at least 4 different systems ). What i found is that X11_InitModes_XRandR is using XRRGetScreenResources, that explicitly ask to poll the hardware for changes. This is not really necessary since if the data is already available you can use XRRGetScreenResourcesCurrent.
I attached a tentative patch that fix this issue. With the patch there's no lock when the subsystem is initialized and the window creation is instant in my applications. The patch only uses XRRGetScreenResourcesCurrent in X11_InitModes_XRandR but it could be potentially used in X11_GetDisplayModes and X11_SetDisplayMode.

Thanks.
Comment 1 Sam Lantinga 2017-08-12 04:41:12 UTC
Hey Ryan, is this a safe patch across current Linux distributions?
Comment 2 Martín Golini 2017-09-05 14:38:06 UTC
Hi Sam,
"XRRGetScreenResourcesCurrent" requires XRandr 1.3, which is super old by i don't know if you would still want to support older versions of XRandr. Let me know if you prefer a patch with < XRandr 1.3 support and i'll provide it.
I would like, if possible, to have this patch applied for the next release ( 2.0.6 ) since i'm manually patching my SDL version and it's little annoying ( also because it makes a big difference in the SDL startup time ).
Regards.
Comment 3 Sam Lantinga 2017-09-05 15:25:20 UTC
We already require XRandR 1.3, so this is fine, thanks!
https://hg.libsdl.org/SDL/rev/f6b9e7bd038a
Comment 4 Sam Lantinga 2017-09-05 15:26:12 UTC
Patch is in for 2.0.6.