Repository navigation
Conversation
kgsl puts no fence on a dma-buf, so an X server cannot wait for the GPU before it reads a presented image. The X11 WSI waits for the image's fence itself only in mailbox mode. In fifo and immediate mode the server can read a frame that is still being drawn, which shows as tearing. Add wsi_device::x11.wait_for_fences, which makes the X11 WSI wait in every present mode, and set it in turnip on kgsl. Zink presents through the same swapchain, so it is covered too. TU_KGSL_PRESENT_WAIT=0 turns the wait off. Adreno 830, Termux:X11-based server that copies on the CPU, torn frames of 150 at about 15 ms of GPU work per frame: immediate: 129 before, 0 after fifo: 125 before, 0 after mailbox: 0 before, 0 after
|
I tested it in a Debian 13 Chroot container on the Xiaomi Pad 6 Pro (Adreno 730), and here are my findings:
This is a compatibility and latency regression. The surrounding comment already notes that changing image counts for IMMEDIATE/FIFO can break applications and increase memory usage. On the Xiaomi Pad 6 Pro, requesting three images produced:
Please decouple the rendering-wait decision from the mailbox image-count decision, keeping the four-image requirement limited to MAILBOX. |
x11.wait_for_fences made x11_needs_wait_for_fences() true in every present mode. x11_requires_mailbox_image_count() uses the same function, so immediate, fifo and fifo_relaxed swapchains went from three images to four. Check the flag where the present queue waits for the fence, and leave x11_needs_wait_for_fences() as it was. Only mailbox asks for four images again.
|
You are right, thanks for testing it. |
Follow-up to #96, for Vulkan. kgsl puts no fence on a dma-buf, and the X11 WSI waits for an image's fence itself only in mailbox mode. In fifo and immediate mode the X server can read a frame the GPU is still drawing, which shows as tearing. Zink presents through the same swapchain.
This adds
wsi_device::x11.wait_for_fences, which makes the X11 WSI wait in every present mode, and sets it in turnip on kgsl.TU_KGSL_PRESENT_WAIT=0turns it off.Adreno 830, Debian trixie, built on b84f02a. Torn frames of 150, with a test client that gives the GPU about 15 ms of work per frame:
Things to know:
Test client: https://github.com/gramarye-os/tessera-linux/blob/gramarye-env/gramarye/vkteartest.c