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

On Nvidia 535, tearing/flickering observed with PresentMode::Fifo #5491

Open
acarl005 opened this issue Apr 4, 2024 · 7 comments
Open

On Nvidia 535, tearing/flickering observed with PresentMode::Fifo #5491

acarl005 opened this issue Apr 4, 2024 · 7 comments
Labels
area: wsi Issues with swapchain management or windowing backend: vulkan Issues with Vulkan platform: x11 Issues with integration with linux/x11

Comments

@acarl005
Copy link

acarl005 commented Apr 4, 2024

Description

I am observing tearing between 2 frames on Linux with X11 and Nvidia 535 drivers.

Repro steps

I have modified the "shadow" example in order to accentuate this effect: acarl005#1
This branch just renders 2 frames in rapid succession every 1 second.

Expected vs observed behavior

I observe the expected behavior on the integrated GPU.

WAYLAND_DISPLAY="" cargo run --bin wgpu-examples -- shadow
PXL_20240404_024350904.TS.mp4

However, when I switch to my Nvidia GPU, I instead see tearing and/or flickering.

WAYLAND_DISPLAY="" WGPU_POWER_PREF=high cargo run --bin wgpu-examples -- shadow
PXL_20240403_202650141.TS.mp4

The examples use PresentMode::Fifo, which says:

"No tearing will be observed."

Platform

Forked the current trunk branch of wgpu, commit ed843f802974eae9d708d3b3895264e9efb01dc6.

See acarl005#1

uname -a
Linux queenie 6.5.0-21-generic #21~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb  9 13:32:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
nvidia-smi
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.161.07             Driver Version: 535.161.07   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA GeForce RTX 3050 ...    Off | 00000000:01:00.0 Off |                  N/A |
| N/A   45C    P0              N/A /  25W |      3MiB /  4096MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      2055      G   /usr/bin/gnome-shell                          1MiB |
+---------------------------------------------------------------------------------------+
@cwfitzgerald cwfitzgerald added backend: vulkan Issues with Vulkan area: wsi Issues with swapchain management or windowing labels Apr 9, 2024
@cwfitzgerald
Copy link
Member

Going to be honest, I have no idea how to even think about fixing this - as far as we know our vk synchronization is correct, so nvidia should be synchronizing correctly.

@cwfitzgerald
Copy link
Member

@acarl005 Could you try #5681 to see if this solves your problem?

@acarl005
Copy link
Author

acarl005 commented May 9, 2024

I tried cherry-picking my change onto cwfitzgerald:vk/fix-presentation-synchronization but I don't see any change. Still getting the same tearing and flickering with my Nvidia GPU on driver v535.

@cwfitzgerald
Copy link
Member

If you add a device.poll(Wait) before you submit does the problem go away?

@acarl005
Copy link
Author

Whoa yeah! I added context.device.poll(wgpu::MaintainBase::Wait); just before the second frame.present(); and it seems to have solved the issue!

@cwfitzgerald
Copy link
Member

Cool, could you try the latest commit on that branch - it should be fixed internally (without the poll)

@acarl005
Copy link
Author

I pulled the latest commit from that branch 329513b but in my contrived case the context.device.poll(wgpu::MaintainBase::Wait); is still necessary to make the flickering/tearing issue go away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: wsi Issues with swapchain management or windowing backend: vulkan Issues with Vulkan platform: x11 Issues with integration with linux/x11
Projects
None yet
Development

No branches or pull requests

2 participants