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

Presenting blocks other operations with VSync on #421

Closed
LaylBongers opened this issue Dec 27, 2019 · 4 comments
Closed

Presenting blocks other operations with VSync on #421

LaylBongers opened this issue Dec 27, 2019 · 4 comments
Labels
area: performance How fast things go help required We need community help to make this happen. type: bug Something isn't working

Comments

@LaylBongers
Copy link
Contributor

Because of CommandQueue::present_surface blocking for VSync in swap_chain_present, the function will keep various resources locked for up to 16ms on 60Hz displays.

@kvark kvark added type: bug Something isn't working help required We need community help to make this happen. area: performance How fast things go labels Dec 28, 2019
@LaylBongers
Copy link
Contributor Author

I've looked through various documentation and things written on this specific issue, and it seems like to properly fix this, multiple queues may be required.
Since the queue is used while presenting, it cannot be concurrently used to present two windows at the same time, or even record another window's rendering commands.

Some improvements to the current system may be possible to reduce the amount of resources locked at the same time, but this is still likely going to cause a stall.

@LaylBongers
Copy link
Contributor Author

The key issue seems to be that specifically the NVIDIA driver blocks on present. This doesn't seem to happen on AMD which blocks on acquire. (I've been told this, I haven't been able to verify this)

I've discussed the current issue with various people and have come to the current possible solutions. I won't be working on any of these right now but I wanted to write them down for reference:

  1. Don't use VSync, externally figure out when you need re-drawing if you need multiple windows. This can be done right now without any changes to WGPU. Right now this is the approach I'll be taking in my own application.
  2. Add multi-queue support to WGPU. This would solve the issue by simply allowing the user to have one queue per window, rendering separately. There's some lack of clarity on how this would affect performance, and this would require significant changes to WGPU that may not be completeable in the near future yet.
  3. Add Present Queues to WGPU. This would be a stopgap solution that would allow a multi-window application to submit presenting on a separate queue. This would be significantly easier to synchronize than a complete multi-queue API. By allowing the user to just block this separate queue on present, other threads waiting on locks can be avoided.

@cwfitzgerald
Copy link
Member

Multi-queue is on the radar here: #1066

@cwfitzgerald
Copy link
Member

Nvidia blocks on acquire in one of two cases: you've run out of swapchain images (this won't happen on modern wgpu) or you're using gsync. This is unfortunately just kinda how it does it, and part of our motivation for #2719.

Going to close this as this issue is represented various other issues.

@cwfitzgerald cwfitzgerald closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: performance How fast things go help required We need community help to make this happen. type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants