Skip to content

[vulkan] Use three swapchain images for FIFO on Android - #90

Open
YevheniiKotyrlo wants to merge 1 commit into
google:mainfrom
YevheniiKotyrlo:vulkan-fifo-three-images-android
Open

YevheniiKotyrlo wants to merge 1 commit into
google:mainfrom
YevheniiKotyrlo:vulkan-fifo-three-images-android

Conversation

@YevheniiKotyrlo

@YevheniiKotyrlo YevheniiKotyrlo commented Oct 16, 2026 •

Copy link
Copy Markdown

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/dawn/native/vulkan/SwapChainVk.cpp
@YevheniiKotyrlo
YevheniiKotyrlo force-pushed the vulkan-fifo-three-images-android branch from 0a05756 to e96329d Compare October 16, 2026 10:09
@github-actions

Copy link
Copy Markdown

👋 Thanks for your contribution! Your PR has been imported to Gerrit.
Please visit https://dawn-review.googlesource.com/c/dawn/+/351455 to see it and CC yourself on the change.
After iterating on feedback, please comment on the Gerrit review to notify reviewers.
All reviews are handled within Gerrit, any comments on the GitHub PR may be missed.
You can continue to upload commits to this PR, and they will be automatically imported
into 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
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

Successfully merging this pull request may close these issues.

1 participant