Add game mode support for macOS Sonoma or newer#3016
Conversation
|
I would rename this PR as "Add game mode support for macOS Sonoma or newer" or similar. If supporting the game mode causes problems then its easy to find out when that was added. |
👍 |
|
The updated manifest was accepted as part of the .dmg packaging. (As this is a recommended tag to categorize an application, it seems useful regardless of the test results) |
a8d61c8 to
292dec1
Compare
|
This should be documented in 0.81 release notes so tagging this with documentation. |
|
😂 |
|
Can you plug your computer to charger and try again. |
|
Quake DEV This PR It would be interesting to find out what causes it to drop that much exactly. I think we can scrap that feature currently. :( EDIT: This was on battery too - but it shouldn't be that much worse. |
Yes, will rerun both benches tomorrow on the M2 mini. |
|
I always warn people not to run macOS releases until they hit xx.6. |
|
Amazing, @Burrito78. "Of course frames rates are lower, but we deliver them at tighter latencies" 😅 Keep the test results coming :-) |
|
We can leave this PR open until @apple fixes the game mode on macOS Sonoma. Still want more data points so calling all macOS 14.x/Apple silicon users to test this out and report back benchmarks. |
|
For the record, I was forced to upgrade to Sonoma yesterday too (company laptop). |
|
It gets weirder and weirder. Machine: Mac mini 2023 / Apple M2 All benchmarks run in fullscreen mode with default config except vsync. Shiny Benchmark 1.4: https://daryldixonretro.111mb.de/Sonstiges.html |
|
Can you run game mode benchmarks on your Sonoma when you have time. Need more data points. Do note that game mode requires Apple silicon hardware. |
|
Shiny Benchmark results for different versions, five runs in short order. |
At some point yes, but I'm quite busy now, then offline for 3 weeks from Wednesday. |
|
@Burrito78 : looks like thermal throttling. After five back-to-back runs, all versions were getting the low ~220 score. Game mode will unfortunately accentuate this by running the CPU and GPU in their most power-hungry modes. If you search for m2 throttling, there are reports about people getting defective systems that run really hot and slow. They replaced them, and the problem is fixed. It looks like the m2 studio has a better cooling system; perhaps it wouldn't throttle? Other benefits of game-mode would be that the performance and power are fully dedicated to the game, and not to other wasteful power hungry applications. So you could try running something like the multi-core Geekbench test in the background, and then simultaneously run some dosbox benchmarks; maybe this is where game-mode will pull out some wins? |
|
PERFDOS/Shiny has no time limit so it can be left running for 30 minutes and then you get 30 minute average of the performance. That's a good way to test if thermal throttle affects performance. |
|
If Mac Mini M2 posts weak results like those after 30 minutes of PERFDOS/Shiny it should be returned to seller for potential hardware defect. Thermal dissipation system should be fully up and running by then and would have no problem keeping it in thermal limits. |
|
Those graphs help, thanks @Burrito78. Is it possible to get the same charts across a 5 min run of the PR while in game mode the entire time? I'm very curious if or how game mode influences the clock frequency ramping behavior. What we're seeing in the existing screenshots is Apple's CPU scheduler drip-feeding slightly increased CPU frequency (over and over, a bit more each time) combined with DOSBox's auto-cycler detecting and using those new, slightly higher CPU frequencies by ratcheting up the auto cycle count. When the Shiny benchmark score finally grinds its way to the peak of 370, that's when Apple's scheduler is also giving it the peak CPU frequency. My guess is that there's some slightly different dynamic at play in game-mode. |
This is the PR running at full 370 for 5 minutes. At the first dip i switched to windowed to see how much time is left on the graph an switched back to fullscreen. |
|
Thanks for that last screenshot, @Burrito78 !
Do you know what changed? (maybe, In the previous DEV screenshot, the CPU speed only briefly crested 3 Ghz: Where as the PR + game-mode ramped faster to ~3.2 Ghz, and scored a full 370 (and probably got there faster): I think the solution is to try to make DOSBox's auto-cycler, specifically in |
Nothing changed, it's random if it will get high or low fps. |
Yeah; that's definitely worse! Let's see if game-mode is helpful again competing load. In a separate terminal, paste this in to simulate a competing load on all cores: while true; do /usr/bin/openssl speed -multi $(($(nproc) * 3)) &> /dev/null; doneWith that running, see if the PR game-mode fullscreen can produce better scores than DEV fullscreen. |
|
@kcgen macOS doesn't have 'nproc'. Can you hardwire the command line to 4 or 8? |
|
(Oh, I'm using Yes - use three-fold num-cores (yes, we want to oversubscribe CPU demand); so
|
|
Apple says this about game mode:
I don't see any negative impact and we can't test every advertised aspect of it. Currently I'm seeing two issues here for which I think we should have separate tickets: -Benchmarks randomly show either high or low performance on macOS. |
|
Thanks @Burrito78 - will have a follow up commit switching to adaptive vsync, to solve the second point. |
|
Updates with newest PR build including 'adaptive sync'. Mac mini 2023 (M2) / Sonoma 14.0 All benchmarks run in fullscreen mode with default config except vsync. |
Burrito78
left a comment
There was a problem hiding this comment.
Results show only positive impact and changes follow Apples guidelines.
|
Benchmark with latest changes on a separate machine and i'm happy to sign this off if we make sure release notes bring up that we use game mode by default on Sonoma or later as per Apple guidelines. Anyone who doesn't like this behaviour can comment off that line from their Info.plist. |
|
Pinging @kklobe if he's happy with these changes. |
|
Thanks @Burrito78. Edit: based on feedback from @GranMinigun , the PR now exposes OpenGL's actual macOS's OpenGL drivers appear to excessively block when non-adaptive vsync is used (ie: So to address that, this PR adds a new condition for So let's put it all to the test. I've tested this on macOS and Linux. Hopefully we can get some result from more systems. Vsync Test Pack📁 Each game comes with an included Open your terminal, enter the game's directory, and launch your DOSBox Staging build with the For example: cd dangerous_dave-60Hz-EGA-VFR
/path/to/dosbox-staging/dosbox --noprimaryconf
cd .. Dangerous Dave (EGA, 60 Hz, VFR)
Jazz Jackrabbit (VGA Mode X, 60 Hz, VFR)
Keen (VGA, 70 Hz, VFR)
Pinball Dreams (VGA, 60 Hz, CFR)
Try testing full screen and windowed-mode. Does the PR branch have any regressions versus Hopefully we can get results on all platforms to confidently answer this. |
489804b to
d0b8443
Compare
|
@kcgen How about automatically setting 'vsync = adaptive' on macOS if 'vsync = on' is used? I'm thinking about existing conf files here. This should be indicated in logging of course to prevent confusion. Or are there cases where 'vsync = on' actually makes sense on macOS? |
|
Tested your pack on macOS Sonoma 14.0 using included confs. Dangerous Dave: PASS All happens in regular DEV too, so nothing to do with this PR. |
|
I personally would like the game mode to be enabled without any vsync fixes for now. This clearly is something to be included in a subsequent PR preferably after 0.81 is shipped. |
|
Will test Windows on Monday if nobody else can do it by then. |
This is a generic and universally available method of sync'ing in OpenGL [1] and is supported by SDL [2]. "Adaptive vsync enables v-blank synchronisation when the frame rate is higher than the sync rate, but disables synchronisation when the frame rate drops below the sync rate. So we might as well expose it, especially for macOS users who might find their OpenGL drivers don't behave nicely with full vsync. Refs: [1] https://www.khronos.org/opengl/wiki/Swap_Interval [2] https://wiki.libsdl.org/SDL2/SDL_GL_SetSwapInterval
When presentation_mode = auto, if the user is on macOS and also using OpenGL with full vsync enabled, then we prefer CFR presentation mode. Why? Normally, OpenGL drivers with a swap-interval of 1 only block for the gap in time after the application requests a buffer swap through to presentation of the current frame. However, circa-2023 macOS OpenGL drivers impose additional per-frame block penalities if frames /aren't/ presented. Therefore, this condition demands we present at a constant host rate.
d0b8443 to
b1244b0
Compare
Yes, when it comes to tearing prevention, It simply passes that request through to the OpenGL drivers, and users can expect real vsync behavior. There some caveats out of our control though:
This PR lets users set |
|
@Burrito78 , thanks for all the testing and showing that this new game-mode feature is actually no worse than baseline. Also, both you and I confirmed on macOS that: [sdl]
vsync = on
presentation_mode = autoComes with a large performance penalty because of excessive vsync block times if frames aren't provided at the host-rate. So this PR has Based on this, I'll go ahead and merge. |







Description
Add a field in the macOS package manifest to let macOS Sonoma users enable Game-Mode when running full screen.
Related issues
Fixes #3014
Manual testing
I'm unable to test it because I'm not running Sonoma.
@Burrito78 - can you check?
Checklist
I have: