Present on Wayland with mailbox so an immediate present does not tear every monitor. #438

Merged
SkippySteve merged 1 commit from fix/desktop-vsync into main 2026-11-08 19:22:25 +00:00
SkippySteve commented 2026-11-08 01:37:13 +00:00 (Migrated from github.com)

Problem

On Linux the bundled SDL opens an X11 window first. NVIDIA's X11 Vulkan surface has no mailbox mode, so the renderer picked an immediate present. On driver 615.78 that present turns vblank off for the whole GPU. Both monitors tore, including Chromium on the other one. Hyprland's tearing switch was off.

The game paces itself (nn_vi.c), so the swapchain does not have to present immediately.

Change

  • Linux tries Wayland before X11. That surface has mailbox. SDL_VIDEODRIVER still wins when it is set.
  • Mailbox stays the first choice. On Linux, an immediate present is used only when RX_VK_IMMEDIATE=1. With no mailbox the fallback is FIFO.
  • Windows is unchanged: no mailbox still falls back to immediate, which held anything under 60 fps at 30 on AMD's driver. RX_VK_FIFO=1 still forces FIFO on either platform.

Testing

RTX 2060 SUPER, NVIDIA 615.78, Hyprland 0.56.2, two 165 Hz monitors.

Before: an XWayland window, swapchain 1916x1050, 4 images, immediate, tearing on both monitors.

After: a native Wayland window, swapchain 1916x1050, 4 images, mailbox, both outputs not tearing. The frame rate settled at 60 fps. RX_VK_FIFO and RX_VK_IMMEDIATE were unset.

Scope

host/posix/display_sdl.c and gpu/vk/vk_main.cpp only.

## Problem On Linux the bundled SDL opens an X11 window first. NVIDIA's X11 Vulkan surface has no mailbox mode, so the renderer picked an immediate present. On driver 615.78 that present turns vblank off for the whole GPU. Both monitors tore, including Chromium on the other one. Hyprland's tearing switch was off. The game paces itself (`nn_vi.c`), so the swapchain does not have to present immediately. ## Change - Linux tries Wayland before X11. That surface has mailbox. `SDL_VIDEODRIVER` still wins when it is set. - Mailbox stays the first choice. On Linux, an immediate present is used only when `RX_VK_IMMEDIATE=1`. With no mailbox the fallback is FIFO. - Windows is unchanged: no mailbox still falls back to immediate, which held anything under 60 fps at 30 on AMD's driver. `RX_VK_FIFO=1` still forces FIFO on either platform. ## Testing RTX 2060 SUPER, NVIDIA 615.78, Hyprland 0.56.2, two 165 Hz monitors. Before: an XWayland window, `swapchain 1916x1050, 4 images, immediate`, tearing on both monitors. After: a native Wayland window, `swapchain 1916x1050, 4 images, mailbox`, both outputs not tearing. The frame rate settled at 60 fps. `RX_VK_FIFO` and `RX_VK_IMMEDIATE` were unset. ## Scope `host/posix/display_sdl.c` and `gpu/vk/vk_main.cpp` only.
Commenting is not possible because the repository is archived.
No description provided.