mesa-for-android-container icon indicating copy to clipboard operation
mesa-for-android-container copied to clipboard

turnip performance issue

Open hansm629 opened this issue 7 months ago • 3 comments

@lfdevs

Hello, sir.

After testing various things in proot-distro Debian, I found several issues with the unpatched Turnip driver. I am not sure whether these are synchronization-related issues, but here are the symptoms I observed.

vkcube

  • video: https://drive.google.com/file/d/1i1kRRUFmjlTvNsCuJ5ku31c85OO7YSfd/view?usp=sharing

When vkcube is launched in a small window, it rotates at an extremely high frame rate, almost as if a mailbox-related environment variable had been applied. However, once the window is switched to fullscreen, the frame rate becomes much slower. I also observed some flickering when switching to fullscreen.

Supertuxkart

  • video: https://drive.google.com/file/d/1fYLsFCDMZT5lDTBHzVLado3TAXMz1PIy/view?usp=sharing

When running Supertuxkart with the Vulkan backend(supertuxkart using --render-driver=vulkan), severe screen tearing occurs. This issue does not improve at all even when enabling the VSync option in the game.

From what I can tell, when using an unpatched Mesa Turnip driver in a proot glibc environment, the present behavior on the Termux-X11 X server does not seem to work properly, unlike in the bionic environment.

Image

What do you think about this?

Could you please take a look?

hansm629 avatar May 01 '26 10:05 hansm629

I also encountered a similar issue when running Godot games with the Vulkan backend using unpatched Turnip. Perhaps it is because it hasn't applied the DRI3 patch. However, when using the patched Turnip from this PR, the situation is much better: https://github.com/lfdevs/mesa-for-android-container/pull/54 Could you help test it? Currently, I have only tested it on Adreno 830 & 730. Testing more GPU models will be more beneficial for patch adaptation.

lfdevs avatar May 01 '26 12:05 lfdevs

@lfdevs Excellent! vkcube runs stably with stable frame rates in both small window and full screen modes!

In the case of vkmark, running it with vkmark --winsys xcb yields performance of over 1000–1100 fps.

The problem is that with supertuxkart, very severe screen flickering occurs.

https://github.com/user-attachments/assets/d5309139-491a-4a71-a482-fa53e90c7ead

However, the positive thing is that if you run it with the mailbox option as shown below, it plays without screen flickering!

MESA_VK_WSI_PRESENT_MODE=mailbox supertuxkart

Is it possible to improve the screen flickering without the MESA_VK_WSI_PRESENT_MODE=mailbox environment variable?

hansm629 avatar May 01 '26 12:05 hansm629

Sorry for the late reply. I tested the Vulkan backend of SuperTuxKart on Adreno 830, and currently, only enabling vertical sync can avoid screen tearing.

Either enable vertical sync in the game settings:

Image

Or use the MESA_VK_WSI_PRESENT_MODE environment variable. Setting it to immediate will cause severe screen tearing (much more severe than Freedreno):

# Configure Vulkan Window System Integration (WSI) present mode
# immediate means unrestricted direct rendering (may tear); 
export MESA_VK_WSI_PRESENT_MODE=immediate
# mailbox is similar to triple buffering (balances high frame rates and anti-tearing); 
export MESA_VK_WSI_PRESENT_MODE=mailbox
# fifo is similar to traditional vertical synchronization (V-Sync); 
export MESA_VK_WSI_PRESENT_MODE=fifo
# relaxed is a compromise solution with smart scheduling, equivalent to a combination of fifo and immediate.
export MESA_VK_WSI_PRESENT_MODE=relaxed

Specifying the environment variables MESA_VK_WSI_PRESENT_MODE=immediate and MESA_VK_WSI_DEBUG=sw simultaneously can avoid screen tearing, but the game frame rates will drop significantly.

lfdevs avatar May 15 '26 14:05 lfdevs