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 4588

Summary: SDL_Init without SDL_INIT_GAMECONTROLLER causes bad performance
Product: SDL Reporter: noxabellus <noxabellus>
Component: *don't know*Assignee: Ryan C. Gordon <icculus>
Status: RESOLVED DUPLICATE QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: noxabellus
Version: 2.0.9   
Hardware: x86_64   
OS: Windows 10   

Description noxabellus 2019-04-10 20:08:17 UTC
Using SDL with OpenGL, I initialize SDL with SDL_Init(SDL_INIT_VIDEO). Everything renders as expected, but the framerate is extremely unstable. It oscillates between 55 and 60 fps, and occasionally drops much lower causing visible hitches in onscreen movement.

Changing this to SDL_Init(SDL_INIT_VIDEO|SDL_INIT_GAMECONTROLLER) solves the issue.

What's really strange is I'm not using anything to do with game controllers in my code, nor do I have a game controller connected to my pc. That said, changing this one line does indeed completely solve the problem, so it is definitely something to do with this subsystem.

(Related Dear ImGui issue: https://github.com/ocornut/imgui/issues/2484)
Comment 1 noxabellus 2019-04-12 17:55:07 UTC
This discourse post was pointed out to me on the ImGui issue discussion: https://discourse.libsdl.org/t/unstable-frame-rate-unexpectedly/25783/9

And indeed, this appears to be the same issue. If I replace my SDL_INIT_GAMECONTROLLER fix with their SDL_INIT_JOYSTICK, it also works to fix the framerate for me.
Comment 2 Sam Lantinga 2019-04-17 02:47:26 UTC
This is fixed for SDL 2.0.10:
http://www.libsdl.org/tmp/SDL-2.0.zip

Can you please confirm?
Comment 3 Sam Lantinga 2019-04-17 02:50:37 UTC
Actually, this is already confirmed fixed in bug 4391

*** This bug has been marked as a duplicate of bug 4391 ***