Only initialize the video subsystem once per launch

This commit is contained in:
Cameron Gutman
2019-03-23 17:46:42 -07:00
parent c0bf8b9c25
commit fa4c0e82bd
4 changed files with 67 additions and 106 deletions

View File

@@ -308,15 +308,15 @@ int main(int argc, char *argv[])
// Register custom metatypes for use in signals
qRegisterMetaType<NvApp>("NvApp");
#ifdef STEAM_LINK
// Steam Link requires that we initialize video before creating our
// QGuiApplication in order to configure the framebuffer correctly.
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0) {
// It's fine to do on other platforms too, and it can save some time
// doing initialization and teardown of the video subsystem after streaming.
if (SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"SDL_InitSubSystem(SDL_INIT_VIDEO) failed: %s",
"SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_TIMER) failed: %s",
SDL_GetError());
}
#endif
QGuiApplication app(argc, argv);
@@ -438,12 +438,6 @@ int main(int argc, char *argv[])
if (engine.rootObjects().isEmpty())
return -1;
if (SDL_InitSubSystem(SDL_INIT_TIMER) != 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
"SDL_InitSubSystem(SDL_INIT_TIMER) failed: %s",
SDL_GetError());
}
// Use atexit() to ensure SDL_Quit() is called. This avoids
// racing with object destruction where SDL may be used.
atexit(SDL_Quit);