Repository navigation
[vulkan] Use three swapchain images for FIFO on Android - #90
YevheniiKotyrlo wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adjusts the minimum image count for FIFO present modes on Android to 3 in SwapChainVk.cpp to prevent frame-waiting issues. The reviewer suggested simplifying the preprocessor block by removing the #else branch, as the execution will naturally fall through to return 2 when not on Android.
0a05756 to
e96329d
Compare
|
👋 Thanks for your contribution! Your PR has been imported to Gerrit. |
Android's Vulkan loader sizes a swapchain's buffer queue to minImageCount - 1 plus the buffers its consumer holds, so the app can dequeue minImageCount - 1 buffers at once. With the two images Dawn asks for in FIFO mode, a frame can only start once the compositor has given back the buffer shown before it. Android 10's SurfaceFlinger gives a SurfaceView's buffer back only after compositing the next frame, so an app presenting at the panel's rate waits in vkAcquireNextImageKHR on every frame: on a Mi MIX 3 (Android 10, Adreno 630), 402 ms of every 1.9 s with nothing else to draw, against 52 ms with three images, frame rates unchanged. Ask for three images in FIFO and FIFO-relaxed modes on Android, the triple buffering Android gives the windows it composites itself. The count is still clamped to the surface's capabilities. On Android 14 nothing changes: a Galaxy S23's app holds the same graphics memory with and without the change, and does not wait either way. Bug: 574059460
e96329d to
d25f0b5
Compare
Android's Vulkan loader sizes a swapchain's buffer queue to minImageCount - 1 plus the buffers its consumer holds, so the app can dequeue minImageCount - 1 buffers at once. With the two images Dawn asks for in FIFO mode, a frame can only start once the compositor has given back the buffer shown before it. Android 10's SurfaceFlinger gives a SurfaceView's buffer back only after compositing the next frame, so an app presenting at the panel's rate waits in vkAcquireNextImageKHR on every frame: on a Mi MIX 3 (Android 10, Adreno 630), 402 ms of every 1.9 s with nothing else to draw, against 52 ms with three images, frame rates unchanged.
Ask for three images in FIFO and FIFO-relaxed modes on Android, the triple buffering Android gives the windows it composites itself. The count is still clamped to the surface's capabilities. On Android 14 nothing changes: a Galaxy S23's app holds the same graphics memory with and without the change, and does not wait either way.
Bug: 574059460