RADV gives 4 swapchain images instead of 2 on Wayland, causing input lag (AMDVLK gives 2 on the same setup)
Description
On RetroArch, it's possible to select the desired number of swapchain images with the setting Max swapchain images
.
Even though the Max swapchain images
is set to 2, RetroArch is getting 4 swapchain images from RADV on Wayland, as seen on the log:
[INFO] [Vulkan]: Using fences for WSI acquire.
[INFO] [Vulkan]: Using GPU: "AMD RADV SIENNA_CICHLID".
[INFO] [Vulkan]: Queue family 0 supports 1 sub-queues.
[INFO] [Vulkan]: Swapchain supports present mode: 1.
[INFO] [Vulkan]: Swapchain supports present mode: 2.
[INFO] [Vulkan]: Creating swapchain with present mode: 2
[INFO] [Vulkan]: Using swapchain size 2560x1440.
[INFO] [Vulkan]: Got 4 swapchain images.
When using AMDVLK on Wayland instead, RetroArch is getting the requested 2 swapchain images:
[INFO] [Vulkan]: Using fences for WSI acquire.
[INFO] [Vulkan]: Using GPU: "AMD Radeon RX 6800".
[INFO] [Vulkan]: Queue family 0 supports 1 sub-queues.
[INFO] [Vulkan]: Swapchain supports present mode: 0.
[INFO] [Vulkan]: Swapchain supports present mode: 1.
[INFO] [Vulkan]: Swapchain supports present mode: 2.
[INFO] [Vulkan]: Creating swapchain with present mode: 2
[INFO] [Vulkan]: Using swapchain size 2560x1440.
[INFO] [Vulkan]: Got 2 swapchain images.
This causes more input lag when using RADV, as measured here on the Libretro forums.
Not sure if this is also the case with other applications, as RetroArch is the only one I know that outputs the swapchain size on it's log.
Steps to reproduce
- Open RetroArch and change the video driver to Vulkan.
- On the Video->Synchronization options, change
Max swapchain images
to 2 and restart RetroArch. - Observe RetroArch getting 4 swapchain images instead of 2, causing additional input lag.
Please note that the log information I posted above is only visible if RetroArch is compiled with the --enable-debug configuration flag. Instructions here if necessary.
EDIT: Not the case anymore. The swapchain information is now output on any standard RetroArch build.
System information
System:
Host: desktop-nfp Kernel: 5.16.14-1-MANJARO arch: x86_64 bits: 64
compiler: gcc v: 11.2.0 Desktop: KDE Plasma v: 5.24.3 tk: Qt v: 5.15.3
wm: kwin_wayland dm: SDDM Distro: Manjaro Linux base: Arch Linux
CPU:
Info: 8-core model: AMD Ryzen 7 3700X bits: 64 type: MT MCP arch: Zen 2
rev: 0 cache: L1: 512 KiB L2: 4 MiB L3: 32 MiB
Speed (MHz): avg: 2680 high: 4264 min/max: 2200/4426 boost: enabled
cores: 1: 4213 2: 4264 3: 2336 4: 2053 5: 2591 6: 2158 7: 2196 8: 2196
9: 2056 10: 3592 11: 2140 12: 2072 13: 4170 14: 2793 15: 2078 16: 1982
bogomips: 115050
Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
Graphics:
Device-1: AMD Navi 21 [Radeon RX 6800/6800 XT / 6900 XT]
vendor: Micro-Star MSI driver: amdgpu v: kernel pcie: speed: 16 GT/s
lanes: 16 ports: active: DP-1,DP-3 empty: DP-2,HDMI-A-1 bus-ID: 0d:00.0
chip-ID: 1002:73bf
Display: wayland server: X.org v: 1.21.1.3 with: Xwayland v: 22.1.0
compositor: kwin_wayland driver: X: loaded: amdgpu gpu: amdgpu
d-rect: 4480x2520 display-ID: 0
Monitor-1: DP-1 pos: primary,top-left res: 2560x1440 size: N/A
Monitor-2: DP-3 pos: bottom-r res: 1920x1080 size: N/A
OpenGL: renderer: AMD Radeon RX 6800 (SIENNA_CICHLID DRM 3.44.0
5.16.14-1-MANJARO LLVM 13.0.1)
v: 4.6 Mesa 21.3.7 direct render: Yes
I also tested on an up-to-date version of Arch with Mesa 22.0.0
RetroArch version is 1.10.2