hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.51k stars 899 forks source link

Tearing updates with atomic modesetting causes fullscreen games to freeze #6230

Open Cloudperry opened 5 months ago

Cloudperry commented 5 months ago

Hyprland Version

System/Version info ```sh Hyprland, built from branch at commit cba1ade848feac44b2eda677503900639581c3f4 (props: bump version to 0.40.0). Date: Sat May 4 15:42:32 2024 Tag: v0.40.0, commits: 4606 flags: (if any) System Information: System name: Linux Node name: roni-desktop Release: 6.9.1-4-cachyos Version: #1 SMP PREEMPT_DYNAMIC Wed, 22 May 2024 21:00:38 +0000 GPU information: 0d:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 21 [Radeon RX 6950 XT] [1002:73a5] (rev c0) (prog-if 00 [VGA controller]) os-release: NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo plugins: ```

Bug or Regression?

Bug

Description

I know this issue has already been reported and closed as not being Hyprland's fault. But it seems that tearing is working on Sway for at least one AMD gpu user in this bug report. So maybe there is something that could be done in Hyprland or Hyprland's Wlroots fork to fix this. I will update this issue if it works for me on Sway.

How to reproduce

Run Hyprland on an AMD gpu without WLR_DRM_NO_ATOMIC=1 and set general:allow_tearing = true. Starting a fullscreen game causes it to freeze as soon as tearing updates turns on.

Crash reports, logs, images, videos

No response

vaxerski commented 5 months ago

for me worked last time

zakk4223 commented 5 months ago

I think some of the amd stuff is busted/doesn't support it in the kernel for some hardware.

If I use atomic api, and set allow_tearing, it freezes rendering on my 6900XT when I fullscreen a tearing window. It does not do this on my laptop with integrated "phoenix" AMD graphics. There it tears like you'd expect.

One thing to note is that kwin seems to recover from this on the 6900XT. When I fullscreen a tearing application there, it doesn't freeze. It doesn't tear either, but it still renders.

For now if you want tearing on that card it seems you need to use WLR_DRM_NO_ATOMIC

Cloudperry commented 5 months ago

Yeah its looking like there are still problems with AMD kernel drivers. On Kwin, tearing has worked for me since the very first betas where it was added. Before that existed I was using X11 without compositing, because competitive games were almost unplayable and felt very sluggish on Wayland. But I just checked Kwin's gitlab and they are still not using atomic modesetting when tearing.

Its still good to have a bug report on Hyprland until its clear where the bug is. I was already using WLR_DRM_NO_ATOMIC and gaming feels pretty smooth on Hyprland so far.

Edit: This Kwin merge requuest could be useful for tracking the state of tearing with atomic modesetting.

Cha1N1 commented 5 months ago

I have the exact same issue on my RX 6700 XT im hoping it gets fixed somewhere.

Cloudperry commented 4 months ago

I tried the Kwin merge request for tearing with AMS. Tearing works with it, but it has pretty bad stuttering that doesn't happen with AMS off. So its probably not a good idea to work on tearing with AMS until the kernel driver implementations get fixed.

Unfortunately tearing is kinda broken on Hyprland with WLR_DRM_NO_ATOMIC=1 so I'm using Kde just for gaming currently. The problem on Hyprland is that sometimes frames get displayed out of order. It happens maybe once a minute and is clearly visible. I should probably make another bug report out of this. There are also similar problems with enabling direct scanout (no_direct_scanout = 0).

Edit: Not going to bother with reporting bugs related to legacy modesetting, because it has many other problems. I get kernel freezes with it sometimes on both KDE and Hyprland.

Cloudperry commented 4 months ago

Tearing with AMS is now working on Hyprland, when using this kernel patch. But its not really usable right now, because frames present out of order frequently enough to be very distracting. This should be fixable in Hyprland or Aquamarine, because it doesn't happen on KDE.

vaxerski commented 4 months ago

we'll see what aq does when #6608 is merged.

Multipixelone commented 3 months ago

tearing appears to be working for me now after updating to a version built on aq! I'm on a RX 7800 XT and tearing would freeze before but now works without freezing.

There are a couple of flickering effects but they seem to go away after a couple minutes. They also might be related to mangohud, so I'm going to need to do some more testing.

vaxerski commented 3 months ago

flicker is #6964

Cloudperry commented 3 months ago

Just tested and I can confirm its now fully working. When I tried atomic tearing with Aquamarine versions of Hyprland before merge, there was some stuttering that was not caused by the game. Now there is no random frame presenting stutter. Idk if it got fixed by kernel 6.10 or Hyprland though (I'm using linux-cachyos which might have extra tearing related patches).

Trying to run games at framerate higher than refresh rate is still quite stuttery, but I don't think I have ever seen that working with tearing on with any compositor on Linux. Idk whats up with that, because it works great on Windows.