X11 compositor makes games skip frames and run poorly

I’m not sure this is a bug with X11 compositor or my own hardware not maybe being good enough, or a driver issue… But not sure where to report it.

I experienced it so far in Guild Wars 2, Vampire the Masquerade: Bloodlines and Vampire Survivors. I think i noticed it in System Shock 2 as well.

I don’t have a good enough computer to run super modern games, so i can’t say for those, but as far as i can tell, it has something to do with Vsync.

You can’t turn off Vsync in compositor settings, and i think it’s messing with the game rendering somehow. But again - might be my hardware, drivers for my hardware, or X itself, no idea.

Turning the compositor off completely, makes the games run smooth.

And i think it has something to do with how X handles Vsync because, turning Vsync on in Guild wars, while X compositor is turned on, makes the game skip even more frames and makes it seem like it’s running at 10 FPS, but the in game and overlay FPS counters still register the game “outputting” 40-60 FPS. But visually, this doesn’t look like it. And you can see true FPS values in action when you turn off the compositor.

Furthermore, this doesn’t happen on Wayland, compositor on or off, but X loads programs faster, so i use that, even though, on desktop, Wayland seems a bit smoother vs X being a bit snappier. Anyway - not a wayland VS X thread, just pointing out my troubleshooting steps.

Lastly, turning the compositor off makes some games experience screen tearing leading me to believe the compositor is forcing Vsync globally on all windows and full screen applications, no matter what they are. It’s like it’s applying it to the entire screen output, not discerning what is being shown because - making window rules (KDE) about which applications can turn off compositing does nothing. I have to manually turn the compositor off.

Luckily there’s a widget for that, but still - this shouldn’t be happening.

Here’s my system:

System:
  Kernel: 6.1.0-x64v1-xanmod1-MANJARO arch: x86_64 bits: 64 compiler: gcc
    v: 12.2.0 parameters: BOOT_IMAGE=/@/boot/vmlinuz-manjaro-xanmod
    root=UUID=27a6f9c0-8b45-42c5-85e1-be095307048f rw rootflags=subvol=@
    amdgpu.gpu_recovery=1 audit=0
    resume=UUID=b58bc35c-1a93-4c4c-a1ec-5eefe535dea6 udev.log_priority=3
    amd_iommu=on vfio-pci.ids=1002:6658,1002:aac0
  Desktop: KDE Plasma v: 5.26.4 tk: Qt v: 5.15.7 wm: kwin_x11 vt: 1 dm: SDDM
    Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Desktop Mobo: ASRock model: B550M Pro4 serial: <superuser required>
    UEFI: American Megatrends LLC. v: P2.30 date: 02/24/2022
CPU:
  Info: model: AMD Ryzen 5 5600G with Radeon Graphics bits: 64 type: MT MCP
    arch: Zen 3 gen: 4 level: v3 note: check built: 2021-22
    process: TSMC n7 (7nm) family: 0x19 (25) model-id: 0x50 (80) stepping: 0
    microcode: 0xA50000C
  Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
    L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 3 MiB desc: 6x512 KiB
    L3: 16 MiB desc: 1x16 MiB
  Speed (MHz): avg: 3833 high: 3900 min/max: 1400/4464 boost: enabled
    scaling: driver: acpi-cpufreq governor: performance cores: 1: 3900 2: 3900
    3: 3900 4: 3900 5: 3900 6: 3900 7: 3900 8: 3900 9: 3900 10: 3100 11: 3900
    12: 3900 bogomips: 93421
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW,
    STIBP: always-on, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Bonaire XTX [Radeon R7 260X/360] vendor: PC Partner / Sapphire
    driver: vfio-pci v: N/A alternate: radeon,amdgpu arch: GCN-2
    code: Sea Islands process: GF/TSMC 16-28nm built: 2013-17 pcie: gen: 3
    speed: 8 GT/s lanes: 16 bus-ID: 01:00.0 chip-ID: 1002:6658 class-ID: 0300
  Device-2: AMD Cezanne [Radeon Vega Series / Radeon Mobile Series]
    driver: amdgpu v: kernel arch: GCN-5.1 code: Vega-2 process: TSMC n7 (7nm)
    built: 2018-21 pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4
    speed: 16 GT/s ports: active: DP-1,HDMI-A-1 empty: DP-2 bus-ID: 06:00.0
    chip-ID: 1002:1638 class-ID: 0300 temp: 36.0 C
  Display: x11 server: X.Org v: 21.1.6 with: Xwayland v: 22.1.7
    compositor: kwin_x11 driver: X: loaded: amdgpu unloaded: modesetting,radeon
    alternate: fbdev,vesa dri: radeonsi gpu: amdgpu display-ID: :0 screens: 1
  Screen-1: 0 s-res: 5120x1440 s-dpi: 96 s-size: 1354x381mm (53.31x15.00")
    s-diag: 1407mm (55.38")
  Monitor-1: DP-1 mapped: DisplayPort-0 pos: primary,left
    model: AOC Q3279WG5B serial: <filter> built: 2020 res: 2560x1440 dpi: 90
    gamma: 1.2 size: 725x428mm (28.54x16.85") diag: 842mm (33.1") ratio: 15:9
    modes: max: 2560x1440 min: 720x400
  Monitor-2: HDMI-A-1 mapped: HDMI-A-0 pos: right model: AOC Q3279WG5B
    serial: <filter> built: 2020 res: 2560x1440 dpi: 90 gamma: 1.2
    size: 725x428mm (28.54x16.85") diag: 842mm (33.1") ratio: 15:9 modes:
    max: 2560x1440 min: 720x400
  API: OpenGL v: 4.6 Mesa 22.3.1 renderer: AMD Radeon Graphics (renoir LLVM
    14.0.6 DRM 3.49 6.1.0-x64v1-xanmod1-MANJARO) direct render: Yes
Audio:
  Device-1: AMD Tobago HDMI Audio [Radeon R7 360 / R9 OEM]
    vendor: PC Partner / Sapphire driver: vfio-pci alternate: snd_hda_intel
    bus-ID: 3-2.2:4 chip-ID: 1235:8200 pcie: speed: Unknown class-ID: 0103
    lanes: 63 link-max: gen: 6 speed: 64 GT/s bus-ID: 01:00.1
    chip-ID: 1002:aac0 class-ID: 0403
  Device-2: AMD Renoir Radeon High Definition Audio driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4
    speed: 16 GT/s bus-ID: 06:00.1 chip-ID: 1002:1637 class-ID: 0403
  Device-3: AMD Family 17h/19h HD Audio vendor: ASRock driver: snd_hda_intel
    v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4
    speed: 16 GT/s bus-ID: 06:00.6 chip-ID: 1022:15e3 class-ID: 0403
  Device-4: Focusrite-Novation Scarlett 2i4 USB type: USB
    driver: snd-usb-audio
  Sound API: ALSA v: k6.1.0-x64v1-xanmod1-MANJARO running: yes
  Sound Interface: sndio v: N/A running: no
  Sound Server-1: JACK v: 1.9.21 running: yes
  Sound Server-2: PulseAudio v: 16.1 running: yes
  Sound Server-3: PipeWire v: 0.3.63 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: ASRock driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1
    port: e000 bus-ID: 04:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp4s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  IF-ID-1: virbr0 state: down mac: <filter>
Bluetooth:
  Device-1: Cambridge Silicon Radio Bluetooth Dongle (HCI mode) type: USB
    driver: btusb v: 0.8 bus-ID: 3-2.1:3 chip-ID: 0a12:0001 class-ID: e001
  Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends
Drives:
  Local Storage: total: 698.65 GiB used: 215.84 GiB (30.9%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Kingston model: SNV2S500G
    size: 465.76 GiB block-size: physical: 512 B logical: 512 B speed: 63.2 Gb/s
    lanes: 4 type: SSD serial: <filter> rev: SBI02102 temp: 35.9 C scheme: GPT
  ID-2: /dev/sda maj-min: 8:0 vendor: Samsung model: SSD 860 EVO 250GB
    size: 232.89 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
    type: SSD serial: <filter> rev: 1B6Q scheme: GPT
Partition:
  ID-1: / raw-size: 448.97 GiB size: 448.97 GiB (100.00%)
    used: 214.94 GiB (47.9%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 608 KiB (0.2%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 448.97 GiB size: 448.97 GiB (100.00%)
    used: 214.94 GiB (47.9%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
  ID-4: /var/log raw-size: 448.97 GiB size: 448.97 GiB (100.00%)
    used: 214.94 GiB (47.9%) fs: btrfs dev: /dev/nvme0n1p2 maj-min: 259:2
Swap:
  Kernel: swappiness: 30 (default 60) cache-pressure: 50 (default 100)
  ID-1: swap-1 type: partition size: 16.5 GiB used: 917.3 MiB (5.4%)
    priority: -2 dev: /dev/nvme0n1p3 maj-min: 259:3
Sensors:
  System Temperatures: cpu: 36.0 C mobo: 34.0 C gpu: amdgpu temp: 37.0 C
  Fan Speeds (RPM): fan-1: 0 fan-2: 1143 fan-3: 0 fan-4: 0 fan-5: 0 fan-6: 0
    fan-7: 0
Info:
  Processes: 325 Uptime: 15h 37m wakeups: 1 Memory: 15.01 GiB
  used: 6.98 GiB (46.5%) Init: systemd v: 252 default: graphical
  tool: systemctl Compilers: gcc: 12.2.0 clang: 14.0.6 Packages: pm: pacman
  pkgs: 1759 libs: 489 tools: pamac pm: flatpak pkgs: 0 Shell: Zsh v: 5.9
  default: Bash v: 5.1.16 running-in: konsole inxi: 3.3.24

Thank you for reading!

Shows that you are using your second graphics card and

IMHO, shows that you use it without hardware acceleration…

So you might want to check your setup wrt VGA-Passthrough, I can’t assist because that’s an area beyond my personal info…

PS:
Maybe not related to this all but it couldn’t hurt to add add_efi_memmap to your kernel-command-line options :wink:

1 Like

X11 doesn’t supply a compositor.

Only use one compositor at a any given time

Nvidia has compositing built-in
Kwin wm has compositing built-in
Xfce wm has a built-in compositor
Compiz wm has a built-in compositor

Picom is a standalone compositor for X
xcompmgr is a standalone X compositor for X

I have seen some disable kwin built-in compositor and use xcompmgr to do the compositing

1 Like

No, the Vega series is the one i want to use. :smiley:
That’s correct. The R7 is passed to the virtual machine. I’ve set it up that way.
Ironically, even though it’s integrated, R7 is no longer supported and only has 1GB of memory whereas Vega, even though it’s slower RAM, has more and makes games run smoother, especially if they load a lot into the memory. R7 had a bottleneck in that regard, that’s why i don’t use it for gaming, but it’s fine for giving it to the VM so…

And i’m not talking about modern games, i’m talking about Guild Wars 2 and Vampire the Masquerade: Bloodlines. WIthout compositing turned on VTMB runs beautifully, and GW2 runs ok.

Though - i’ve noticed something - i forced VTMB to not be locked at 60 FPS, so when it got to my monitror refresh rate which is 75Hz, there was no stuttering with the compositor on!

So it definitely has something to do with vsync! Cause, like i said, when i enabled vsync in GW2, it got worse - so maybe there’s more than one vsync going on, and it’s causing some sort of desync in sending frames to the monitor?

Isn’t amdgpu the accelerated driver? Just open source? And radeon driver being the proprietary one? Not sure what modesetting is.

Anyway, it’s definitely accelerated, games do play fine, just that the compositor is causing issues. If it’s off (and if issues were present), the problem is solved. So something about the compositor is at play here.

If you mean the passed R7 to the Virtual Machine, that’s intended. :slight_smile:

What does that do?

Ah! I see, i thought it also does a compositor, my bad. Thanks for clarifying!

I didn’t mess with compositors at all, so it should be using just one - how do i check?
But your point corroborates what i was thinking about vsync. It’s somehow double doing vsync or something?

How do i check which one i have? I don’t have nvidia, and i use KDE, so the one that came with it is probably the one in use. But if that one’s the problem (maybe not by itself, but maybe a conflict with my hardware, or my hardware being not good enough to run it properly), how can i install and use a different one?

Thank you for the responses!


Anyhow see what @linux-aarhus said who has more knowledge regarding this topic’s title :wink:

1 Like

Thank you! I’ll read up on it! :slight_smile:

1 Like

Then you are using kwin compositing.

Navigate System SettingsDisplay and MonitorCompositor.

It is possible the game and the window manager tries to do the same thing. vsync is default set to automatic with kwin.

I don’t even know how to turn off compositing in Plasma - I think I have seen an option but that may depend on the display utility used - default is kscreen and for what I have checked there is no option perhaps kdisplay has :man_shrugging: - judging from the package manager - kdisplay is for kwinft - which is fork of kwin.

If you login in using Wayland you cannot disable compositing as you can if you login using X11.

Experimenting with kwinft vs. kwin can get hairy - so if you are tempted - brace yourself for impact.

I know next to nothing of gaming - I am just a crazy :crazy_face: coder with a workstation.

I have this in my KDE: (Kubuntu 22.10)


System:
  Host: kubuntu Kernel: 5.19.0-28-generic arch: x86_64 bits: 64
    Desktop: KDE Plasma v: 5.25.5 Distro: Ubuntu 22.10 (Kinetic Kudu)
Machine:
  Type: Desktop System: ASUS product: All Series v: N/A
    serial: <superuser required>
  Mobo: ASUSTeK model: X99-PRO/USB 3.1 v: Rev 1.xx
    serial: <superuser required> UEFI: American Megatrends v: 4101
    date: 07/10/2019
CPU:
  Info: 6-core Intel Core i7-5820K [MT MCP] speed (MHz): avg: 1253
    min/max: 1200/4000
Graphics:
  Device-1: NVIDIA GP102 [GeForce GTX 1080 Ti] driver: nvidia v: 525.60.11
  Display: x11 server: X.Org v: 1.21.1.4 with: Xwayland v: 22.1.3 driver:
    X: loaded: nvidia unloaded: fbdev,modesetting,nouveau,vesa
    gpu: nvidia,nvidia-nvswitch resolution: 2560x1080~60Hz
  OpenGL: renderer: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2 v: 4.6.0 NVIDIA
    525.60.11
Network:
  Device-1: Intel Ethernet I218-V driver: e1000e
  Device-2: Broadcom BCM4352 802.11ac Wireless Network Adapter driver: wl
Drives:
  Local Storage: total: 9.24 TiB used: 1.01 TiB (11.0%)
Info:
  Processes: 347 Uptime: 1d 10h 7m Memory: 31.26 GiB used: 7.91 GiB (25.3%)
  Shell: Bash inxi: 3.3.21

Then you are likely using X11 - I am using Wayland.

If Iogin using X11 - I have the same layout - but using Wayland there’s no option to disable.

Yes, i checked, it’s kwin. :slight_smile:

I don’t think you can, other than some terminal magic… By default, there’s no option to turn it off, which i think i get why it’s done, but it’s meessing with other programs that try to do their vsync. I think that’s the problem. The vsync part.
I mean, i’m fine disabling compositing before playing certain games, but some of them get bad screen tearing then, so i’m not sure what even is happening anymore - at first seems like vsyncs are in conflict, but then i get tearing when the compositor is off lol.

So far, the only reliable way to make everything work is to force the game FPS to my monitor refresh rate while compositing is on. Then it works normally (more or less).

Wayland doesn’t have that problem. In wayland everything gaming related works. But it for some reason opens up programs slower. Other than that it’s fine though, so i might go back to wayland.

Haha, yeah, i did some googling about compositors, i’m not sure i’m gonna get into that just yet.
I’ve just now set up the VM, JACK works, i don’t want to mess up my install. :smiley:
I won’t touch something so global just yet. I don’t really have any important data on this drive, but i’m not in the mood to set up all that again. :stuck_out_tongue: I have Manjaro how i like it now.

Well, there’s not much TO know lol… It’s just games. :stuck_out_tongue:

I have the same. There’s no “off” option in tearing prevention.
And adding applications to the list of allowed to block compositing doesn’t seem to do anything…
I added Guild Wars 2, and with the compositor ON, it had the same issues until i globally turned compositing off.

Well, luckily, there’s a widget for that, so, not that bothered.

You could play around with the different settings it does offer.
Don’t ask me what they do or are for though…

I’ll try. :slight_smile:

I use XFCE and game frequently.

I’ve been keeping the compositor disabled as I don’t like the noticeable input lag and performance hit that occurs while gaming, but the screen tearing that occurs during regular desktop use and especially while watching videos in the web browser really bothers me.

I use the amdgpu driver and am aware that there is the “TearFree” setting for xorg, but does this require the compositor to be enabled?

Is the best solution to have an app like Lutris or Feral Gamemode disable the compositor while running an affected game?

Will having the “TearFree” setting enabled in Xorg while the compositor is temporarily disabled affect anything like input lag?

Thanks

Yes, i believe it requires the compositor to be enabled.

Gamemode can do that? :open_mouth:
If so, yeah, that would be ideal. I tried KDE’s own window rules and allowing fullscreen applications to block compositing, but that did nothing…
If gamemode can disable compositing automaticall, yeah, that would be ideal.

If the compositor is disabled, tearfree is disabled as well i think. Not 100% sure, but i don’t think you can have vsync like options on without compositing being on.

I personally have a widget on the desktop that i click to disable compositing until i click it again.
If i can make gamemode automatically disable it, even better. Will look into that.

1 Like

Yes it can! I just set it up according to the directions on this page:
https://linux-gaming.kwindu.eu/index.php?title=Compositor

It works quite nicely. I’ve been sitting on this issue for a while and this was an easy fix. I’ll keep dreaming of not even having to worry about it with Wayland, but until then my hacked together XFCE setup continues on :sunglasses:

NIce! Thank you! I’ll set it up for myself then as well. The few games that i play that benefit from gamemode also behave bad with the compositor, so not having to turn it off manually will be nice. :slight_smile:

1 Like