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

Screen flickering on Nvidia Optimus #3452

Open
jsonmona opened this issue Feb 3, 2023 · 7 comments
Open

Screen flickering on Nvidia Optimus #3452

jsonmona opened this issue Feb 3, 2023 · 7 comments
Labels
api: vulkan Issues with Vulkan external: driver-bug A driver is causing the bug, though we may still want to work around it

Comments

@jsonmona
Copy link

jsonmona commented Feb 3, 2023

Description
Screen flickers (briefly shows white screen) when resizing.

As far as I can test, this only happens with Vulkan backend, and requesting LowPower adapter with nvidia optimus enabled.

  • Using nvidia adapter (by requesting HighPerformance adapter) will eliminate this issue
  • Disabling nvidia adapter will eliminate this issue
  • Using DX12 backend will eliminate this issue
  • Screen refresh rate (60Hz vs 165Hz) is irrelevant

Oddly, I get the same issue whenever I launch Kakaotalk (a Korean messenger app). In that case, the screen goes white without triggering repaint event, causing the app to become stuck on the white screen until the next repaint event occurs.

Repro steps

  1. cargo run --example cube
  2. Keep resizing the window

Expected vs observed behavior
Screen flickers (briefly shows white screen).

Extra materials
Here is a video recording of the issue (contains flashing lights):
video

I do get a single validation error at start, but I believe it's irrelevant because I also get those even when I disabled nvidia adapter.

Platform

  • Windows 11 x64
  • Laptop with Nvidia optimus (Intel iGPU + Nvidia dGPU)
  • wgpu version tested: both current master (42b48ec) and v0.15.0 on crates.io
  • Intel iGPU: 31.0.101.3251 (12th Gen Intel(R) Core(TM) i9-12900H)
  • Nvidia dGPU: 31.0.15.2756 (NVIDIA GeForce RTX 3070 Ti Laptop)
@teoxoy
Copy link
Member

teoxoy commented Feb 21, 2023

This sounds like a driver issue.

Just a few more questions for completeness:

  • Are you using an external monitor?
  • If yes, can you try to reproduce it with the built-in display?
  • Could you tell us the model of your laptop? Some have a multiplexer and if they don't it would be useful to know how the display outputs are wired internally.

@jsonmona
Copy link
Author

@teoxoy Sure!

  • I tested using built-in monitor.
  • It's Asus Zephyrus M16 (2022). It has MUX to disable internal GPU.
  • Issue persists with a monitor connected to dGPU directly.

According to Nvidia control panel, only built-in display is connected to iGPU, and all external ports are connected to dGPU. So I tried to replicate the issue with a HDMI monitor (which Nvidia control panel reports as connected to dGPU), and the issue was still there.

It indeed sounds like a driver issue. If you can point to some other Vulkan applications, I would be happy to test them too.

Probably not important, but the issue also persists when I attach RenderDoc. For some reason, RenderDoc fails with VK_ERROR_DEVICE_LOST when I click EID 20 and 22 - the vkCmdDrawIndexed call. It might be RenderDoc's bug, but it's weird.

The screenshot of RenderDoc:
RenderDoc failing with device lost error

@teoxoy
Copy link
Member

teoxoy commented Feb 22, 2023

Thanks for all the details! I'm not sure about the RenderDoc issue.

So the conclusion is that just having optimus enabled and using the Intel iGPU causes the flicker on resize behavior.

Not sure what we can do about this, ideally we should use DX12 on Windows (see #2719).

@teoxoy teoxoy added the external: driver-bug A driver is causing the bug, though we may still want to work around it label Feb 22, 2023
@n1ght-hunter
Copy link

I get the same issue.
BadReize
Pc Specs
OS: Window 10
CPU: AMD Ryzen 5 3600
GPU: AMD Rx 6700XT

That was using the primary Backend so i presume Vulkan

@jsonmona
Copy link
Author

Looks like related to this SO question: https://stackoverflow.com/q/58808444

@cwfitzgerald
Copy link
Member

@jsonmona There's kinda slim chance, but can you try #5681 to see if this fixes your issue?

@jsonmona
Copy link
Author

@cwfitzgerald Sorry, but I do not own the laptop anymore. Maybe others could help? @n1ght-hunter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vulkan Issues with Vulkan external: driver-bug A driver is causing the bug, though we may still want to work around it
Projects
None yet
Development

No branches or pull requests

4 participants