Skip to content
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

Alt-tab while in exclusive fullscreen takes longer than expected #17381

Closed
peppy opened this issue Mar 21, 2022 Discussed in #17380 · 13 comments
Closed

Alt-tab while in exclusive fullscreen takes longer than expected #17381

peppy opened this issue Mar 21, 2022 Discussed in #17380 · 13 comments
Labels
osu!framework issue Can't resolve this without changes to osu!framework. platform/windows priority:1 Very important. Feels bad without fix. Affects the majority of users.

Comments

@peppy
Copy link
Member

peppy commented Mar 21, 2022

Reported twice now, hitting alt-tab while in exclusive fullscreen mode seems to switch display modes more times than required. Will require some investigation by someone who can reproduce this to find out the origin of the issue (osu! / osu-framework / sdl). Apparently stable does it well, for whatever that's worth.

There have been a few recent issues made SDL's end surrounding the fullscreen logic. This one for instance may be related to what users are seeing here.

Discussed in #17380

Originally posted by Rian8337 March 21, 2022
I've had this problem ever since I tried osu!lazer, but didn't bother asking as I didn't find this annoying. However, it started to bug me out nowadays that I'm playing the game more often than osu!stable.

Unfortunately, I didn't have a good enough computer nor device to record, but I thought the video is enough to give an idea of what's going on (had to put it on YouTube due to GitHub file size limit).

In case it's not clear, I was simply alt-tabbing between Notepad and the game, which caused both my displays to flicker. I'm not sure if this is a problem on my end or the game, so I didn't immediately create an issue.

Logs:
network.log
performance-update.log
runtime.log
updater.log
database.log
performance-audio.log
performance-draw.log
performance-input.log
performance.log

@peppy peppy added osu!framework issue Can't resolve this without changes to osu!framework. platform/windows priority:1 Very important. Feels bad without fix. Affects the majority of users. labels Mar 21, 2022
@peppy peppy changed the title Tabbing out from or into the game causes display to flicker Alt-tab while in exclusive fullscreen takes longer than expected Mar 21, 2022
@Susko3
Copy link
Member

Susko3 commented Apr 15, 2022

Can repro this when running my monitor (1920x1080@60) at non-native resolution. Enabling GPU scaling seems to fix it.

I'm guessing that a wrong display mode is chosen, and enabling GPU scaling forces the correct mode.

@peppy
Copy link
Member Author

peppy commented Apr 16, 2022

Weird thing is that it still is taking more display mode switches than stable, as of a recent SDL change. I have a feeling it's related to the constant changes around these code paths in SDL (maybe libsdl-org/SDL#5509 or one of the countless other issues reported) so we'll probably need to continue to bump SDL and watch for improvements/regressions.

@caesay
Copy link

caesay commented Apr 25, 2022

As far as I know, there's very little benefit to entering/supporting fullscreen exclusive mode on modern windows with DX11 or higher.

If you are borderless, using a DXGI_SWAP_EFFECT_FLIP_DISCARD swap chain with 2 buffers, and your buffer is the same size as the display you're rendering on, the DWM will let you enter "Hardware Independent Flip" where your swap chain back buffer is flipped by the DWM directly on to the display front buffer when you Present. This will give you performance as-good-as exclusive or in some cases better, and it's the recommended approach as of DX11.

https://github.com/GameTechDev/PresentMon is a great tool for debugging what display mode you're in (Hardware exclusive, hardware independent flip, etc). If you are seeing GDI Copy or Composed, your swap chain is probably not configured correctly.

I don't know how this is handled in SDL, just thought this might be useful.

@peppy
Copy link
Member Author

peppy commented Apr 25, 2022

Right now we are limited by the fact we're using OpenGL for rendering pipeline. Work towards getting Direct X and vulkan online is being done, at which point we'll definitely want to look at that as an alternative.

@AeliusSaionji
Copy link

AeliusSaionji commented Jul 21, 2022

A workaround for the meantime: Special K has a translation layer which takes opengl calls and presents them using d3d11, for the specific purpose of granting opengl games hardware independent flip. This also allows gsync to work.

Independent flip while osu is focused
1658373562

Benefit of independent flip is you may alt tab / multitask with no drawbacks (drops to composed only while other windows visible on top of osu)
image

@peppy
Copy link
Member Author

peppy commented Jul 21, 2022

I'd recommend against using such applications as we cannot support your game if you do. We'll be providing D3D and vulkan in the near future, so please wait for that instead.

@mirh
Copy link

mirh commented Jan 1, 2023

Can repro this when running my monitor (1920x1080@60) at non-native resolution. Enabling GPU scaling seems to fix it.

This just means that the problem was display scanning then (triggering it is actually far more complex than it seems)
"Longer than expected" is probably just the actual mode switching on the monitor, adding up to the normal short delay for Windows to reshuffle its frontbuffer and the desktop.

I don't know why it happens then (in-game refresh rate being slightly different from the desktop perhaps?) but of course the SK upgrade fixes it, since flip mode would at most allow some glorified borderless fullscreen.

@AeliusSaionji
Copy link

flip mode would at most allow some glorified borderless fullscreen.

For the record, this is desirable. Flip mode's latency is equivalent to exclusive fullscreen. There is no upside to using exclusive fullscreen anymore, and plenty of downsides.

Looking forward to the upcoming native flip model support!

@mirh
Copy link

mirh commented Jan 2, 2023

Of course.

Though I could also imagine of cases where you would want the full ass mode switch to happen tbh.
I don't know, for instance a system with limited video bandwidth, where you'd rather play at a lower resolution (pixel-wise or color-wise) with a higher refresh rate than your normal desktop one.

@AeliusSaionji
Copy link

AeliusSaionji commented Jan 2, 2023

Fellow CRT enthusiast? 😄

But you don't need exclusive fullscreen to trigger a modeswitch. Osu could just support modeswitching. That's what all dx12 games do, (and that's actually a feature of SK: you can define a preferred mode line per game)

@mirh
Copy link

mirh commented Jan 2, 2023

I meant with respect to this issue. Even if you had a flip-something with DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH, you would still need a noticeable amount of time to switch resolution.
(and no, I was more concerned with cheap laptops that only have a shitty HDMI port to connect real monitors)

@peppy
Copy link
Member Author

peppy commented Jan 9, 2023

Please wait for the new renderer to come online, which should resolve this.

@peppy
Copy link
Member Author

peppy commented Jul 26, 2023

Closing as should-be-resolved.

@peppy peppy closed this as completed Jul 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
osu!framework issue Can't resolve this without changes to osu!framework. platform/windows priority:1 Very important. Feels bad without fix. Affects the majority of users.
Projects
None yet
Development

No branches or pull requests

5 participants