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

vkQueuePresentKHR is slow #18

Open
Try opened this issue Oct 25, 2020 · 3 comments
Open

vkQueuePresentKHR is slow #18

Try opened this issue Oct 25, 2020 · 3 comments

Comments

@Try
Copy link
Owner

Try commented Oct 25, 2020

Time for vkQueuePresentKHR in my laptop is sometimes 20-50 ms.
After reboot it back to normal: 0-2 ms - so can be issue with my machine.

Anyway presentation engine should be reviewed.

  1. Samsung present thread practice:
    https://www.khronos.org/assets/uploads/developers/library/2019-vulkanised/02_Live%20Long%20And%20Optimise-May19.pdf

  2. vkAcquireFullScreenExclusiveModeEXT worth to be implemented for windows

@Eulenmensch93
Copy link

Hi,

Not sure if I have done this the correct way, but I activated the line
Log::i("vkQueuePresentKHR = ",Application::tickCount()-t);

In vulkanapi.cpp and I can see that normaly the tick difference is 0, sometimes 1.
After ~5min of gameplay with the log messages active I was able to observe 3 spikes where the value was above 10 and above 20. But I think this is expected if new textures are loaded?

I have a few ideas what could cause something like this.

  1. Did you check that your CPU and GPU temperature was in a normal temperature range? Most systems will reduce clock speed if certain temperature thresholds are reached.
  2. If you are running windows it could be a problem if energy saving is active (if it is set to "balanced" for example), as far as I know this can have a big impact on clock speed of the CPU which could cause a delay in code execution.

Currently I am running the game on my PC, tomorrow I will try to compile the project on my 9 year old cheap laptop, maybe I can see the problem there :)

@Try
Copy link
Owner Author

Try commented Mar 16, 2021

Hi, @Eulenmensch93 !

But I think this is expected if new textures are loaded?

No, that not suppose to be the case - vkQueuePresentKHR doesn't do any 'real' work, it only pushes a command into a command queue.

I haven't to to measure temperature and such, because 20-50ms are way to large numbers for one api-function.
All I have so far is a Samsung presentation in topic: they say, that vkQueuePresentKHR calls into 'queueBuffer'(part of android gralloc, I think) and spends time there on some-sort of synchronization. May be Windows do something similar.

@Try
Copy link
Owner Author

Try commented May 26, 2023

Linking vulkan issue:
KhronosGroup/Vulkan-Docs#1158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants