libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.31k stars 1.84k forks source link

Vulkan video driver in fullscreen on GeForce Driver 387.92 causing black screen #5558

Closed WhiteZeroX closed 6 years ago

WhiteZeroX commented 7 years ago

Description

With the new nVidia GeForce 387.92 video driver, the RetroArch Vulkan video driver only displays a black screen when starting any emulator. This only occurs in fullscreen mode. If you run in Windowed mode or alt-tab out of RetroArch and back in, then you'll get an image again (unless you change a resolution setting in the emulator causing the video driver to initialize).

nVidia's driver release notes say the following relating to the issue:

Implemented improved behavior for full-screen Vulkan swapchains using VK_KHR_win32_surface.

This optimization will cause more events that trigger an out-of-date swapchain, such as when entering or leaving full-screen mode (typically by pressing Alt+tab). Applications that do not properly respond to the VK_ERROR_OUT_OF_DATE_KHR return code may not function properly when these events occur. See the WSI Swapchain section of the Vulkan specification.

Other users reporting the issue here: https://forums.libretro.com/t/vulkan-full-screen-broken-with-new-nvidia-drivers-387-92-win10/12691

Expected behavior

Video to be displayed normally.

Actual behavior

Screen goes black when starting any emulator

Steps to reproduce the bug

  1. Install nVidia Geforce Driver 387.92
  2. Start any emulator in-game
  3. Experience the black screen
  4. Exit Fullscreen or simply alt-tab out and back in to get the image back

Bisect Results

Only occurs with 387.92 and up nVidia driver. Rolling back to 385.69 works fine.

Version/Commit

Environment information

elcorsico commented 7 years ago

yeah idem for me , vulkan test psx hardware and genesis sound ok but black windows thanks resolve this devs ;-)

SL-Gundam commented 7 years ago

I'm having the same issue with 3dmark's API overhead test so this is might be a driver bug

daninthemix commented 7 years ago

Yep, I've noticed this too. It's a double-problem because (at least for me), the GL driver now runs at a crawl on the Fall Creator's update, so I was hoping to use Vulkan but this issue makes that excessively irritating.

elcorsico commented 7 years ago

hi all, for information , new driver nvidia 388.00 are problematic vulkan core genesis and psx in vulkan mode , black screen too and music are play why the bug are resistant , thanks devs for resolve this ;-)

WhiteZeroX commented 7 years ago

Someone added in the Forum thread the following console output:

[INFO] [Vulkan]: VSync => on [INFO] [Vulkan]: QueuePresent failed, invalidating swapchain.

So that would seem to jive with the nVidia Release Notes about swapchains.

fxgopher commented 7 years ago

Same issue here - Latest Nvidia - and latest updated nightly and upto date cores

fxgopher commented 7 years ago

Mines a Strix 1070 Same Windows and Drivers. If I switch to Open GL everythings fine, but Vulkan is a definite no no - Bloack screen for graphics - can hear audio though (PCI-E Soundblaster)

WhiteZeroX commented 6 years ago

@twinaphex is that with both the Vulkan driver and a vulkan enabled emulator? The issue will only occur when actually starting a vulkan enabled emu. Can/have you tested BeetlePSX specifically?

fxgopher commented 6 years ago

I use the following cores parallel_n64 and mednafen_psx_hw With Vulkan as driver black screens for 40 Winks and Yoshi's Story.

I switch driver to GL and they both play fine

inactive123 commented 6 years ago

Yes I was able to reproduce the issue.

And it seems this is an error introduced by Microsoft. See this -

https://twitter.com/idSoftwareTiago/status/925770870978744320

If you are part of the Windows Insider program, you could download the latest beta versions and test if the issue is gone. If not, you'll have to wait for the next Windows update for these issues be resolved. Doesn't seem like there is much we can do about it ourselves - it's a regression Microsoft introduced into the latest stable update.

WhiteZeroX commented 6 years ago

@twinaphex Thanks again. It looks like this fix is part of the November Windows 10 Cumulative Update. I will update Windows and my driver tonight to test and report back.

WhiteZeroX commented 6 years ago

Hmmm, still seem to have the same issue after updating to the new Windows patch and nVidia driver (388.13). So for now I'm just switching back to OGL for Driver and emu output.

saftle commented 6 years ago

@WhiteZeroX Could you see if the problem is fixed with the new Nvidia 388.31 update along with the November Windows 10 Cumulative Update? I saw someone in the #libretro discord that said they fixed it by updating to the newest driver.

I can't test it myself, since i'm on Windows 10 LTSB "1607". However, if it works for you, I might temporarily switch back to regular Windows 10 Pro until the new version of Windows 10 LTSB comes out in 2019.

Tomk3n commented 6 years ago

Even with the newest updates it doesn't work.

matsmith83 commented 6 years ago

I'm still having the issue with new Nvidia 388.43 drivers, and Windows 10 Pro 64-bit (Version 1709 OS Build 16299.64).

[INFO] [Vulkan]: QueuePresent failed, invalidating swapchain.

ghost commented 6 years ago

Yeah, I just came here to ask about this and found this bug thread. I have the November Windows 10 update and latest GeForce drivers but I'm still seeing this. Are we !00% sure this is actually related to the Windows 10 regression?

WhiteZeroX commented 6 years ago

Since most of us are still having issues after updating, I think we can say that the tweet from @twinaphex above didn't apply to our issue.

SL-Gundam commented 6 years ago

I think the post from @twinaphex might still apply.

The changelog entry being mentioned is not present in the november updates for 1709 (16299). As far as i can see the fix is only present in the 17025 insider build. Somebody willing to test that?

WhiteZeroX commented 6 years ago

@SL-Gundam The non-Insider changelog mentions:

Addressed issue that causes a black screen to appear when you switch between windowed and full-screen modes when playing some Microsoft DirectX games.

And the above tweet from @idSoftwareTiago for the (older) Insider update says:

"We fixed an issue where toggling some DX9/DX10/DX11 games between windowed and fullscreen (for example using Alt + Tab) could result in the game window become black on certain PCs.)" That also includes Vulkan btw.

The change is almost word-for-word and, assuming the id employee is correct, included Vulkan.

saftle commented 6 years ago

Those of you on the newest Windows update and nvidia driver version 388.43 (that just released today), do you mind switching to exclusive full-screen (video_windowed_fullscreen = "false") with Beetle PSX HW to see if that fixes the issue?

Just talked to someone on discord, saying that the problem is fixed when using exclusive full-screen. Thanks!

ghost commented 6 years ago

No such luck here. I'm also not entirely sure why specifically the beetle hw core, considering this seems to happen on all emu cores as long as the general video driver is set to vulkan.

Only "fix" so far is to either exit fullscreen or alt+tab out and back in as described in the first post. Or alternately just use gl (video_driver = "gl") for the time being, which is what I'm doing.

saftle commented 6 years ago

@Hampster82 this is true, it affects all cores. I just wanted to isolate a few things in order to potentially reproduce them.

matsmith83 commented 6 years ago

Those of you on the newest Windows update and nvidia driver version 388.43 (that just released today), do you mind switching to exclusive full-screen (video_windowed_fullscreen = "false") with Beetle PSX HW to see if that fixes the issue?

Made no difference for me, sadly.

rayabusa commented 6 years ago

This is happening to me too, and when i alt+tab the game, it suffers from slowndown while playing Tekken 2 on beetle PSX HW core, this wasnt happening before.

inactive123 commented 6 years ago

Unfortunately it doesnt seem like there is anything we can do about this. Microsoft broke this in their updates, id Software’s own devs complained about it too.

Either way, it still works fine on Linux, showing our code is not the issue.

WhiteZeroX commented 6 years ago

Forgive me here, but if it was solely a Windows issue, why is RetroArch the only Vulkan application I'm having this issue on? Loaded up PPSSPP standalone today with it's new Vulkan render and I can fullscreen and alt-tab without issue. Downloaded vkQuake (Quake source port with Vulkan renderer), works fine going between exclusive fullscreen or boarderless windowed and alt-tabbing.

If Microsoft "broke" something that no other application seems to have an issue with under the same circumstances, it sounds to me more like an issue with that single application not conforming to standards. Maybe I'm way off on this, just how it's seeming.

I did tweet to @idSoftwareTiago again to ask if they were still seeing any issues in their games.

WhiteZeroX commented 6 years ago

I also don't think we can rule out the tweet/Insider patch as a red herring here, either. Our issue is specifically with Vulkan, not D3D. While sounding similar, I think the issues may be just that, similar but unrelated. As the blog post/changelog details that the issue occurs when "switching between fullscreen and windowed or alt-tabbing," while our issue occurs without any switch at all and in fact alt-tabbing alleviates the problem temporarily. We have a specific "swapchains" trace in logs that relates back to the nVidia driver release notes regarding Vulkan.

Our issues started after a nVidia driver update, not a MS update, and the "related" MS fix that did get applied had no affect for us.

WhiteZeroX commented 6 years ago

Forgive me here, but if it was solely a Windows issue, why is RetroArch the only Vulkan application I'm having this issue on? Loaded up PPSSPP standalone today with it's new Vulkan render and I can fullscreen and alt-tab without issue. Downloaded vkQuake (Quake source port with Vulkan renderer), works fine going between exclusive fullscreen or boarderless windowed and alt-tabbing.

If Microsoft "broke" something that no other application seems to have an issue with under the same circumstances, it sounds to me more like an issue with that single application not conforming to standards. Maybe I'm way off on this, just how it's seeming.

I did tweet to @idSoftwareTiago again to ask if they were still seeing any issues in their games.

EDIT: Accidentally clicked Close issue...

WhiteZeroX commented 6 years ago

An id Engine Programmer just had this to say: https://twitter.com/axelgneiting/status/937007261565837314

vkQuake has fixes for the swap chain issues on NVIDIA if that's what you are looking for. While minimized you are not able to create a chain & you can loose it on acquire/present.

vkQuake's commits are full of swapchain fixes.

inactive123 commented 6 years ago

This might indeed help us. Also, we added a $50 bounty for this on Bountysource.

https://www.bountysource.com/issues/50358623-vulkan-video-driver-in-fullscreen-on-geforce-driver-387-92-causing-black-screen

WhiteZeroX commented 6 years ago

@twinaphex Thanks. Putting my money where my mouth is with $25 to the bounty.

saftle commented 6 years ago

I can confirm that it is solely a Windows 10 issue. I just downgraded to Windows 8.1 and Vulkan works as it should.

Fergdog commented 6 years ago

The id engine programmer said this when he patched vkQuake to work with Nvidias newer drivers:

"Swapchain fails to recreate while a fullscreen app is minimized. Surface capabilities return 0 width/height. Also acquire/present fail with out of date when going out of fullscreen. All is valid according to spec."

https://twitter.com/axelgneiting/status/931356379121704960

Similar to what's said above but a lil more info.

It looks like this is not Microsoft's fault but a change in Nvidia's Vulkan swapchain that everything needs to adapt to.

inactive123 commented 6 years ago

From what I can ascertain, this is the commit that fixed it for vkQuake -

https://github.com/Novum/vkQuake/commit/c8906260d6061d31d4890c813ec720592586d329

Just ignore all the asserts which is just a debugging measure.

inactive123 commented 6 years ago

Tried replicating what was being done in that commit but the issue still persists - https://hastebin.com/obasamayoj.php

inactive123 commented 6 years ago

More discussion here -

https://github.com/Novum/vkQuake/issues/114

inactive123 commented 6 years ago

Apparently the gist of it is that we need to handle extra error codes that vkAcquireNextImage can return -

VK_ERROR_OUT_OF_DATE_KHR VK_SUBOPTIMAL_KHR

If it doesn't return VK_SUCCESS, then it seems vkCmdBeginRenderPass/vkCmdEndRenderPass shouldn't be ran, neither should vkQueuePresentKHR be called. Tried messing around with this but maybe I overlooked some parts.

Novum commented 6 years ago

Everything that uses the not acquired swap chain can't run, that's correct. You will also need to handle the case where you are minimized and cannot create a swap chain at all until maximized again.

inactive123 commented 6 years ago

Hi there @Novum, thanks for dropping by and shedding some more light on the issue. I believe @Themaister is working on a solution in his fork.

anyputer commented 6 years ago

I just updated to driver 388.59 ( Windows 10 Fall Creator's Update like before ) and have this very exact problem. Control + Alt + Delete seems to fix it. So Microsoft isn't the one to blame here.

WhiteZeroX commented 6 years ago

Saw RetroArch 1.7.0 was out with this change:

VULKAN: Various stability fixes for WSI

But alas, I'm still having the same problem.

inactive123 commented 6 years ago

I reported the issue to Nvidia. It's the Nvidia Windows driver's fault. It does not happen with Intel GPUs and it doesn't happen with the same nvidia GPU on Linux (latest drivers).

WhiteZeroX commented 6 years ago

@twinaphex I thought we addressed that concern above? Specifically from @Novum (Axel Gneiting), an engine programmer at id and author of vkQuake...

His tweets on the matter: https://twitter.com/axelgneiting/status/937007261565837314 https://twitter.com/axelgneiting/status/937026728010158080

inactive123 commented 6 years ago

@Themaister says he already backported any relevant fixes, and the issue still persists. There is no issue at all on Linux with the latest nvidia driver, there is no issue with an AMD GPU on windows, there is no issue with Intel IGP on Windows 10. So it might be a bug in nvidia's windows driver.

Novum commented 6 years ago

It's not a bug. Only NVIDIA on Windows exposes this behaviour. It's valid according to spec.

vkQuake is working fine now, you have to make sure you get all the corner cases right.

inactive123 commented 6 years ago

I think the conclusion then is that @Themaister does not know right now how to fix it then, or more specifically, which edge case needs to be attended to.

Novum commented 6 years ago

Does he have a NVIDIA card to test with? Otherwise it's going to be hard to explain.

inactive123 commented 6 years ago

I am not sure. In his latest commits, he told me he tested it on AMD (Windows/Linux) and that it worked without any issues.

These were the latest commits he pushed -

https://github.com/libretro/RetroArch/commits/master?author=Themaister

WhiteZeroX commented 6 years ago

Get me an Windows binary and I'll be glad to test potential fixes.

inactive123 commented 6 years ago

@WhiteZeroX Not sure really what you mean by that, our buildbot runs in real-time and spits out nightlies for each and every commit that gets pushed. So this request seems almost moot, just go to our buildbot nightlies site...

http://buildbot.libretro.com/nightly/

For the most full-featured Windows build, you'd use the 'windows' one which is built with mingw, not the MSVC ones.