我想测试vkQueuePresentKHR需要多长时间。但我发现了一件奇怪的事。 测试着色器是一个过滤器,就像这样(请忽略她脸上的潦草区域^^): segfault.c
...
long vSubmitE = MGetCurTimeStamp();
....
result = vkQueuePresentKHR(graphicsQueue, &presentInfo);
// present end time
long vPresentE = MGetCurTimeStamp();
// log time of vkQueuePresentKHR had spent...
LOGE("vpresent time = %d ms", vPresentE - vSubmitE);
设备:nexus6p。 GPU:Adreno TM 430。 PresentMode:邮箱。 swapchain imageCount = 4。
然后更糟: file1
经过一段时间,我再次运行这个应用程序,然后我无法相信自己的眼睛:
我不知道如何解释这个,因为我觉得这很奇怪。请帮助或尝试解释如何解释这种现象。
今天,我添加vkQueueWaitIdle(队列)来同步vkQueuePresentKHR,等待并记录停止时间,直到队列中的操作完成。这次,我将VkPresent更改为FIFO。
喜欢这个:
...
long vSubmitE = MGetCurTimeStamp();
....
result = vkQueuePresentKHR(graphicsQueue, &presentInfo);
// wait until back from gpu.
vkQueueWaitIdle(graphicsQueue);
// present end time
long vPresentE = MGetCurTimeStamp();
// log time of vkQueuePresentKHR had spent...
LOGE("vpresent time = %d ms", vPresentE - vSubmitE);
...
11-23 15:29:09.690 vpresent time = 25 ms
11-23 15:29:09.742 vpresent time = 25 ms
11-23 15:29:09.815 vpresent time = 24 ms
11-23 15:29:09.913 vpresent time = 24 ms
11-23 15:29:09.941 vpresent time = 24 ms
11-23 15:29:10.116 vpresent time = 25 ms
11-23 15:29:10.190 vpresent time = 25 ms
11-23 15:29:10.242 vpresent time = 25 ms
11-23 15:29:10.276 vpresent time = 24 ms
11-23 15:29:10.654 vpresent time = 25 ms
11-23 15:29:10.855 vpresent time = 25 ms
11-23 15:29:10.936 vpresent time = 25 ms
11-23 15:29:11.217 vpresent time = 25 ms
11-23 15:29:11.290 vpresent time = 56 ms
11-23 15:29:11.383 vpresent time = 40 ms
11-23 15:29:11.427 vpresent time = 40 ms
11-23 15:29:11.516 vpresent time = 40 ms
11-23 15:29:11.561 vpresent time = 41 ms
11-23 15:29:11.606 vpresent time = 40 ms
11-23 15:29:11.743 vpresent time = 41 ms
11-23 15:29:11.830 vpresent time = 40 ms
11-23 15:29:11.965 vpresent time = 40 ms
11-23 15:29:12.097 vpresent time = 41 ms
11-23 15:29:12.142 vpresent time = 41 ms
11-23 15:29:12.277 vpresent time = 40 ms
...
仍然令人难以置信!
答案 0 :(得分:0)
听起来因热量原因可能会限制CPU / GPU。 IMO,邮箱是移动应用程序的一个非常糟糕的选择,不应该使用。
您可以尝试启用持续性能模式(您很幸运,您已经拥有了支持它的世界上的一台设备!)并且看看它是否有帮助。