-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Turn device screen off _after_ everything has been set up #3902
Conversation
Sometimes it can take quite a while for everything to get set up and the screen to appear.
I merged the conditions in a single Please check before I merge: |
Checked and it works fine - as intended. (Under some special conditions there is sometimes still quite a gap between when the device screen is turned off and the |
Oh, and thanks for the tweaks you did. |
Weird. How long? Can you reproduce a starting delay without turning the screen off? With another encoder (see |
It's most likely a macOS issue, or maybe how some other programs handle OpenGL or Metal under macOS. When I have many windows with many tabs open in Safari (or other browser), some programs that want to use OpenGL take a long time to start. It seems like they're fighting over resources. Anyway, here are timings with the different encoders, as requested, with many browser windows and tabs open in Safari: h264 'OMX.qcom.video.encoder.avc'
h264 'OMX.google.h264.encoder'
h265 'OMX.qcom.video.encoder.hevc'
To get correct timing I added diff --git a/app/src/util/log.h b/app/src/util/log.h
index 8e1b73a2..f5c683ab 100644
--- a/app/src/util/log.h
+++ b/app/src/util/log.h
@@ -10,11 +10,11 @@
#define LOG_STR_IMPL_(x) # x
#define LOG_STR(x) LOG_STR_IMPL_(x)
-#define LOGV(...) SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
-#define LOGD(...) SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
-#define LOGI(...) SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
-#define LOGW(...) SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
-#define LOGE(...) SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__)
+#define LOGV(...) { SDL_LogVerbose(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); fflush(stdout); }
+#define LOGD(...) { SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); fflush(stdout); }
+#define LOGI(...) { SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); fflush(stdout); }
+#define LOGW(...) { SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); fflush(stderr); }
+#define LOGE(...) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, __VA_ARGS__); fflush(stderr); }
#define LOG_OOM() \
LOGE("OOM: %s:%d %s()", __FILE__, __LINE__, __func__) I'll also make timings without any browser running while I'm at it. |
Timings without any other OpenGL/Metal-using programs: h264 'OMX.qcom.video.encoder.avc'
h264 'OMX.google.h264.encoder'
h265 'OMX.qcom.video.encoder.hevc'
This is on macOS Catalina (10.15.7) |
Logged the startup without the macOS OpenGL core profile patch, just to make sure that it isn't adding to the startup time, and the timing is approximately the same. Here is a run without the OpenGL core profile patch and with Safari open with a lot of windows and tabs:
Anyway, nothing to worry about. I don't see the long delay as a |
And without |
Good point. With lots of windows and tabs in Safari
With nothing going on
macOS seems to be quite tricky to get to behave when setting up I have now tried some examples both from SDL and GLFW, and the setting So this behaviour is not specific to So far, the only program I have found that behaves well is Just for comparison - and maybe inspiration - here is an example of
The whole setup, playing, and teardown is done in three quarters of a second. |
Possibly an issue with your graphics drivers, since apparently it does not happen for many users (nobody ever reported such a delay). |
Maybe others don't have hundreds of tabs open in Safari... ;) Anyway, it's not an issue with normal |
In any case, it can be merged (moreover if something fails to start, it's better if the device is not turned off for nothing): 798dfd2 |
Sometimes it can take quite a while for everything to get set up and the screen to appear.
Note:
Intentionally kept the double
if
construct so it matches the previous blocks.