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.47k stars 898 forks source link

Tearing sometimes not activating #4935

Closed Cruleo closed 7 months ago

Cruleo commented 8 months ago

Hyprland Version

System/Version info ```sh Hyprland, built from branch HEAD at commit b1c0f1cc018d13ac1e5ebccaade5528ec757bd74 dirty (subsurface: Rewrite the subsurface tree (4877)). Date: Thu Feb 29 01:03:28 2024 Tag: v0.36.0-9-gb1c0f1cc flags: (if any) System Information: System name: Linux Node name: archlinux Release: 6.8.0-rc6-1-cachyos-rc Version: #1 SMP PREEMPT_DYNAMIC Mon, 26 Feb 2024 21:14:49 +0000 GPU information: 08:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA102 [GeForce RTX 3080] [10de:2206] (rev a1) (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?

Regression

Description

Tearing seems to no longer work with commit b1c0f1cc018d13ac1e5ebccaade5528ec757bd74. Both hyprctl monitors and looking at vrrtest show no tearing. With commit 1e7eb3a5a5419f97b61a3403880b161c85dd7b17 both hyprctl monitors as well vrrtest indicate that tearing is active.

I understand that this could be the classic nvidia moment, but I thought it might worth looking into. This is my first time creating an issue, so please tell me if something is missing.

How to reproduce

Compile Hyprland from commit b1c0f1cc018d13ac1e5ebccaade5528ec757bd74 and/or after. While having all requirements for tearing (general:allow_tearing, window rule and WLR_DRM_NO_ATOMIC=1), the client will not tear. I tested with vrrtest.

Crash reports, logs, images, videos

Logs seem to report nothing, but please let me know and I will upload them.

vaxerski commented 8 months ago

can you check whether hyprctl monitors reports activelyTearing (when you'd expect it to tear, can be done on a secondary display or with a sleep 2 && ...)

Cruleo commented 8 months ago

Hi, thanks for the swift reply. With commit 1e7eb3a5a5419f97b61a3403880b161c85dd7b17, hyprctl monitors does report activelyTearing with true when it is expected to tear. With commit b1c0f1cc018d13ac1e5ebccaade5528ec757bd74 it shows activelyTearing with false when expected to tear.

vaxerski commented 8 months ago

and what's your test client? Everything looks fine at a first glance to me

Cruleo commented 8 months ago

I used VRRTest using scene 1 and FPS target lower than refresh rate (the lower it is, the easier it is to see the tearing). VRR is disabled (both on monitor and hyprland config). Thanks in advance!

vaxerski commented 8 months ago

It starts as floating on my end, make sure to fullscreen it.

Cruleo commented 8 months ago

It started as fullscreen for me and ensured that it is fullscreen (with keybind). Doesn't seem to change the behaviour listed above.

Pogogo007 commented 8 months ago

I was able to recreate. My config is very similar however I am not using an RC kernel and instead 6.7.6

vaxerski commented 8 months ago

patch.txt try this

phonetic112 commented 8 months ago

patch.txt try this

works

Cruleo commented 8 months ago

Seems to be working for me again as well (applied on git).

iddm commented 8 months ago

The activelyTearing flag is still false for me when I run hyprctl monitors, and it used to be true. I've just built from the latest main. f8a081b56d09ec325ac485a0f055e541146486d3 Not to mention it still all feels like vsync is on.

Hyprland, built from branch main at commit f8a081b56d09ec325ac485a0f055e541146486d3  (layout: warp the cursor when focusing windows (4982)).
Date: Tue Mar 5 18:56:06 2024
Tag: v0.36.0-53-gf8a081b5
Cruleo commented 8 months ago

Just compiled latest one and tested, tearing still works (visible to see and hyprctl monitors:activelyTearing is set to true).

iddm commented 8 months ago

Just compiled latest one and tested, tearing still works (visible to see and hyprctl monitors:activelyTearing is set to true).

This becomes more and more interesting. Why had it always been working for me until I updated to some version. Since it was merged, actually, it had been working pretty fine for me. And, of course, I did everything the wiki said(says), and I have just checked just to confirm that nothing has changed in the configuration to enable it.

# Enable tearing: disables the usage ot a newer kernel DRM API that doesn't support tearing yet.
env = WLR_DRM_NO_ATOMIC,1

general {
     # See https://wiki.hyprland.org/Configuring/Variables/ for more

     gaps_in = 5
     gaps_out = 20
     border_size = 2
     col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
     col.inactive_border = rgba(595959aa)

     layout = dwindle

     # Enable tearing
     allow_tearing = true
}

# Allow tearing for Quake
windowrulev2 = immediate, title:^(Quake Live)$

Here is the hyprctl clients where it shows the game:

Window 55705edfa220 -> Quake Live:
    mapped: 1
    hidden: 0
    at: 2560,0
    size: 2560,1440
    workspace: 3 (3)
    floating: 1
    monitor: 1
    class: steam_app_282440
    title: Quake Live
    initialClass: steam_app_282440
    initialTitle: Quake Live
    pid: 1103767
    xwayland: 1
    pinned: 0
    fullscreen: 1
    fullscreenmode: 0
    fakefullscreen: 0
    grouped: 0
    swallowing: 0
    focusHistoryID: 2

Here is the hyprctl monitors on a monitor which it is currently in and in full-screen:

Monitor DP-2 (ID 1):
    2560x1440@359.98001 at 2560x0
    description: ASUSTek COMPUTER INC ROG PG27AQN #sBozGDAYCgMI
    make: ASUSTek COMPUTER INC
    model: ROG PG27AQN
    serial: #sBozGDAYCgMI
    active workspace: 3 (3)
    special workspace: 0 ()
    reserved: 0 34 0 0
    scale: 1.00
    transform: 0
    focused: no
    dpmsStatus: 1
    vrr: 0
    activelyTearing: false
    currentFormat: XBGR2101010
    availableModes: 2560x1440@59.95Hz 2560x1440@359.98Hz 2560x1440@239.97Hz 2560x1440@144.00Hz 2560x1440@120.00Hz 2560x1440@99.95Hz 2368x1332@359.96Hz 2368x1332@239.97Hz 1920x1080@360.11Hz 1920x1080@240.00Hz 1920x1080@119.98Hz 1024x768@60.00Hz 800x600@60.32Hz 640x480@59.94Hz

I also tried to see whether it changes if I change the focus to it, so on one monitor I opened a terminal with watch -n1 hyprctl monitors and on another - the game, and while I was in-game, the flag never changed.

There are no issues in the log, but the logs also have become much less informative since some change of Hyprland, and don't know how to raise the verbosity level.

iddm commented 8 months ago

New info: when I run vrrtest it is set to true, when I run the game now - it won't set to true. But it used to work for how many months? It can't be my setup, nothing has changed, except for the hyprland version. Should I do another bissect?

vaxerski commented 8 months ago

make sure it's fullscreen

iddm commented 8 months ago

make sure it's fullscreen

But you can see it in the output I provided, no? It reports to be fullscreen, and I made sure it was too.

iddm commented 8 months ago

I found the reason why it doesn't work. I used to have both, steam, and the game on-top of it, being fullscreen. It had always been working previously, now it doesn't work. It started to work just now when I moved the game window to a separate, not occupied with any other window workspace. So the new rule is that the window should be the only window in a workspace?

vaxerski commented 8 months ago

no, likely steam opens some invisible window on top of it. Steam is ridiculously poorly written, and it runs in xwl.

iddm commented 8 months ago

no, likely steam opens some invisible window on top of it. Steam is ridiculously poorly written, and it runs in xwl.

If you don't mind, can you think of a way I could confirm this? I am curious now :-)

Cruleo commented 8 months ago

I just did some more testing and indeed can find some further issues: If freshly booted in, tearing works fine (VRRTest and CS2) but after closing CS2 and reopening, tearing no longer works for either CS2 or VRRTest.

iddm commented 8 months ago

I just did some more testing and indeed can find some further issues: If freshly booted in, tearing works fine (VRRTest and CS2) but after closing CS2 and reopening, tearing no longer works for either CS2 or VRRTest.

Does it still report as working (true) when it doesn't work for you?

Cruleo commented 8 months ago

I just did some more testing and indeed can find some further issues: If freshly booted in, tearing works fine (VRRTest and CS2) but after closing CS2 and reopening, tearing no longer works for either CS2 or VRRTest.

Does it still report as working (true) when it doesn't work for you?

No, it remains false.

vaxerski commented 8 months ago

https://github.com/hyprwm/Hyprland/blob/0ee69058c447b91bd142523676b13c5af8685ba8/src/render/Renderer.cpp#L2383-L2438

this is what you need to "pass" to be tearing-eligible on a display. If you pass this, and it doesn't tear, it's a bug.

Cruleo commented 8 months ago

Turns out https://github.com/hyprwm/Hyprland/issues/4935#issuecomment-1979461236 is true, if steam is open, it breaks tearing, whether I am in a game or not (VRRTest or CS2 won't tear). It also breaks tearing if it's not visible. Only when fully exited, tearing works again (VRRTest goes from not tearing to tearing while running).

Thanks for your time and replies!

vaxerski commented 8 months ago

please check if it happens with windows that arent steam too before treating this as a hyprland bug

Cruleo commented 8 months ago

Tested with Cyberpunk 2077 on Heroic Launcher with Proton (no steam runtime), tearing is both reported as true by activelyTearing and visible. Not sure if there is a way to workaround/fix it for Steam but the functionality works as intended. Sorry for the spam!

julmajustus commented 8 months ago

Some wine games launched from lutris still have this issue where launching the game includes some invisible xwayland windows which do break the tearing on that workspace. Moving the gamewindow to another workspace does the trick and VRR & tearing is active. 0.35 works correctly but current git and 0.36 does not.

zmeyka3310 commented 8 months ago

confirmed on my end, tearing gets fixed when moving the game window to another workspace. tested on factorio, apex legends, minecraft, nier: automata, enter the gungeon, deep rock galactic.

julmajustus commented 8 months ago

Some more testing with current git, in some steam games like, Dying light 2, Cyberpunk 2077,MB Banner lord tearing and vrr is working correctly in same workspace. Cs2 otherwise won't (moving to other workspace does fix this). On Lutris only games I tested were Dark and Darker and Battlefield V where tearing/vrr is borked at the same workspace where the game was launched.

I tired to play around with windowrules with no luck.

iddm commented 8 months ago

Some more testing with current git, in some steam games like, Dying light 2, Cyberpunk 2077,MB Banner lord tearing and vrr is working correctly in same workspace. Cs2 otherwise won't (moving to other workspace does fix this). On Lutris only games I tested were Dark and Darker and Battlefield V where tearing/vrr is borked at the same workspace where the game was launched.

I tired to play around with windowrules with no luck.

Please correct me if I am wrong, but are you trying to say that some games in the same workspace as the main steam window can tear and some don't?

julmajustus commented 8 months ago

Some more testing with current git, in some steam games like, Dying light 2, Cyberpunk 2077,MB Banner lord tearing and vrr is working correctly in same workspace. Cs2 otherwise won't (moving to other workspace does fix this). On Lutris only games I tested were Dark and Darker and Battlefield V where tearing/vrr is borked at the same workspace where the game was launched. I tired to play around with windowrules with no luck.

Please correct me if I am wrong, but are you trying to say that some games in the same workspace as the main steam window can tear and some don't?

Yes.

iddm commented 8 months ago

This might not fit the theory proposed by vaxerski then, with an invisible steam window somewhere on-top of the game window. It would be nice if we were given a recipe to figure out what's happening exactly, so to make Hyprland and ultimate solution, including 100% testing reliability in all the situations, if it is possible.

julmajustus commented 8 months ago

Also interesting note; steam game that does tear/vrr correctly, does work also on workspace where lutrisgame were launched, which doesn't tear there.

Also when moving the game window launched from lutris to workspace where steam window is open, the tearing is borked again. (Moving to workspace other than the game was launched or steam is open does fix the tearing.)

zmeyka3310 commented 8 months ago

found two funky invisible windows, they are probably causing the issue:

Window 561b37d71e60 -> :
    mapped: 0
    hidden: 0
    at: 74,104
    size: 138,198
    workspace: 1 (1)
    floating: 1
    monitor: 0
    class: 
    title: 
    initialClass: steam
    initialTitle: 
    pid: -1
    xwayland: 1
    pinned: 0
    fullscreen: 0
    fullscreenmode: 0
    fakefullscreen: 0
    grouped: 0
    swallowing: 0
    focusHistoryID: -1

Window 561b37d59fe0 -> :
    mapped: 0
    hidden: 0
    at: 151,104
    size: 102,100
    workspace: 1 (1)
    floating: 1
    monitor: 0
    class: 
    title: 
    initialClass: steam
    initialTitle: 
    pid: -1
    xwayland: 1
    pinned: 0
    fullscreen: 0
    fullscreenmode: 0
    fakefullscreen: 0
    grouped: 0
    swallowing: 0
    focusHistoryID: -1

their pid is always -1, so ill try to come with a script that detects it and moves them to another workspace (like workspace 10 idk)

Edit: also i believe there is a new winow created for every game launch, but i am not sure, it may be a new window for every different game launched

Edit 2: after closing steam all these windows disappear

Edit 3: after further inspection, turns out that the windows get generated when a new window gets generated by steam, and they get updated when they get regenerated on another workspace, and by window i assume anything that has to do with generating a new window that takes focus from steam, being steam/view/friends/games/help/store/library/community/your profile

zmeyka3310 commented 8 months ago

https://github.com/ValveSoftware/steam-for-linux/issues/10608 opened an issue on github, assuming this gets fixed it also should fix the "i cant open settings" thingy

julmajustus commented 8 months ago

ValveSoftware/steam-for-linux#10608 opened an issue on github, assuming this gets fixed it also should fix the "i cant open settings" thingy

I'm not sure if this is only steam related issue when the problem occurs in other wine games launched from lutris etc.

zmeyka3310 commented 8 months ago

ValveSoftware/steam-for-linux#10608 opened an issue on github, assuming this gets fixed it also should fix the "i cant open settings" thingy

I'm not sure if this is only steam related issue when the problem occurs in other wine games launched from lutris etc.

Can i get some examples of such games? what is the output of hyprctl clients when a game like that is running?

vaxerski commented 8 months ago

mapped: 0 windows are not taken into account when checking for tearing

julmajustus commented 8 months ago

This are the window info from hyprctl clients and hyprctl monitors.

I've tried to create windowrules for the other active and mapped windows with no success.

*edit moved the messy output to pastebin https://pastebin.com/ku52YzDF

julmajustus commented 8 months ago

And for comparison this is from the working version 0.35 client and monitor info.

https://pastebin.com/WKJz9WyV

julmajustus commented 8 months ago

Turns out #4935 (comment) is true, if steam is open, it breaks tearing, whether I am in a game or not (VRRTest or CS2 won't tear). It also breaks tearing if it's not visible. Only when fully exited, tearing works again (VRRTest goes from not tearing to tearing while running).

Thanks for your time and replies!

@Cruleo could you reopen this issue while it's obviously not solved yet.

zmeyka3310 commented 7 months ago

played some apex today, scanout didnt want to kick in regardless of workspace. got no clue what is going on, even moving the window to a workspace i didnt even switch to ever didnt help. also this issue affects direct scanout and vrr too, so the issue is lying somewhere in detecting where to activate them

julmajustus commented 7 months ago

It seems to be that some wine/proton games opens window(s) which are invisible for user and hyprctl clients listing. When creating a rule to move all visible windows related to game, listed by hyprctl to another workspace does fix the tearing. If you move just the game window back to the workspace where it was launched, tearing is borked again.

It seems to be not related to neither lutris or steam. Some games launched form lutris like Red dead redemption 2 works correctly and cs2 native version from steam does not.

julmajustus commented 7 months ago

Yes, can confirm it's fixed.

itouchdennis commented 1 month ago

I feel like I have the exact same issue. Nvidia 3070 ti Tried hyprland 43.0 and 41.2 (currently I am stick to this version as its the last with WL_roots PLUS I mainly play CS2, on this release the game feels a bit less stuttery as on the newer ones) OS: EndeavourOS Kernel: 6.10 Zen Nvidia Driver: [560.35.03]

I set up the allow_tearing var + windowrule for fullscreen apps / the cs2 class. Watch -n 1 hyprctl monitors on my 2. display always shows me that the activelyTearing var is false. Tried CS2 / Forza 4.

Both steam games, might install a game trough lutris when I am back from work and close steam as it was mentioned here to verify if it is this problem.

I feel like this is the only issue left on my setup to fully ditch any other DE / WM. Currently I'm switching to any other DE to play CS2 as the allow tearing not working for me and cs will feel junky.