| Summary: | [PATCH] Fix for slow video subsystem initialization when using XRandR. | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Martín Golini <spartanj> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 2.0.4 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Attachments: | Use X11_XRRGetScreenResourcesCurrent when possible. | ||
Hey Ryan, is this a safe patch across current Linux distributions? 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. We already require XRandR 1.3, so this is fine, thanks! https://hg.libsdl.org/SDL/rev/f6b9e7bd038a Patch is in for 2.0.6. |
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.