Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VRR] Direct Scanout causes stuttering #7714

Closed
GrabbenD opened this issue Aug 21, 2023 · 3 comments
Closed

[VRR] Direct Scanout causes stuttering #7714

GrabbenD opened this issue Aug 21, 2023 · 3 comments
Labels
bug Not working as intended

Comments

@GrabbenD
Copy link

GrabbenD commented Aug 21, 2023

  • Sway Versions:
    Stable: Sway 1.8.1 + Wlroots 1.6.2
    Next: Sway 1.9.0-dev-363c579 + Wlroots 1.7.0-dev-5f691259
    (Tested on Arch Linux with 23.1.6)

  • Debug Log:
    Result from starting Sway 1.8.1 > Steam > Halo Infinite > Custom Game > Create Match > Play:
    https://gist.github.com/GrabbenD/58fdff75c802311036320393d03b7d0c

  • Configuration File:
    Default, only tweaks are:

    output * {
        mode 3840x1600@119.982Hz
        adaptive_sync on
    }
    
    input type:pointer {
        accel_profile "flat"
        pointer_accel 0
    }
    
  • Description:
    In fast paced games such as Halo Infinite (XWayland) textures looks like they're vibrating/fuzzy when moving around quickly. Furthermore the mouse movement feels very choppy/stuttery. This is very apparent when the FPS is below monitor's refresh rate but it can also be observed when the FPS is the same as the refresh rate.

    In other words, VRR/Variable-Refresh-Rate/Freesync/Adaptive-Sync doesn't work properly.

  • Workaround:
    This can be completely fixed by starting Sway with: $ sway -Dnoscanout

Update: see comment below

@GrabbenD GrabbenD added the bug Not working as intended label Aug 21, 2023
@GrabbenD
Copy link
Author

GrabbenD commented Aug 26, 2023

Workaround

TL:DR summary of working settings

Sway/MangoHud:
https://gitlab.freedesktop.org/drm/amd/-/issues/3166#note_2277578

NTSync:
Frogging-Family/wine-tkg-git#936 (comment)

Notes

There's a couple of fixes needed to get VRR working properly:

  1. Direct scanout causes screen to run at max FPS. Here's a workaround
    Update: I'm no longer observing this issue (tested with: kernel 6.7.3 + wlroots 0.18.0.r6873.d368028b-1 + sway 1.10.r7281.f7a0f06-1 + AW3821DW (GSYNC Ultimate) + RX 6800 XT).

  2. Mouse's polling rate affects monitor's refresh rate. Here's a workaround

  3. Current situation (see TL:DR above):
    Update 6:

    Update 5:

    Update 4:

    Update 3:

    • High max render time value breaks VRR. I've found output * { max_render_time 1 } to be most reliable with a high-end GPU (as anything above 3 breaks VRR).

    Update 2:

    Update 1:

    • In addition to in-game VSYNC, use external VSYNC (like MangoHud's vsync=3 which actually seems to toggle game's presentation mode in the driver/MESA). This solves inconsistent VSYNC experience between games and seems to be the closest alternative to BlurBusters' recommendation about using driver level approach (since my monitor's OSD refresh rate is synced PERFECTLY to the FPS with this setup unlike using soely in-game VSYNC which (sometimes) has slight variations). Another alternative, which I've yet to try, is to manually set the right environment variables for your drivers like these with MESA.

    • Only use VRR with fullscreen mode (check script below). Beware that you might still encounter some weirdness, see drm/amd#3166
      (Full explanation: damage tracking causes the refresh rate to fall down to monitor's smallest supported value when there's nothing being rendered. This can cause cursor stutters and flickering whilst in desktop/empty workspace. See here)

    • Make sure that Winesync / Fsync / NTsync is configured correctly for this to work, check this for a summary (best alternative is TKG to make sure the dependencies use the same version in WINE and your KERNEL):
      https://gitlab.freedesktop.org/drm/amd/-/issues/3166#note_2277578

Related

While researching this issue I came across a few other topics:

References

Cursor:

DRM:

VRR:

AMDGPU:

vblank:

MESA:

@GrabbenD
Copy link
Author

GrabbenD commented Oct 4, 2023

I'm re-opening this to bring more attention to VRR not working properly in Sway as I've come to notice other people are experiencing this from reading various forum posts and issue reports.

Edit: see updates above

@GrabbenD GrabbenD reopened this Oct 4, 2023
@GrabbenD GrabbenD changed the title Direct Scanout causes stuttering [VRR] Direct Scanout causes stuttering Oct 4, 2023
@GrabbenD GrabbenD closed this as completed Feb 9, 2024
@Nama
Copy link

Nama commented Aug 11, 2024

Update: I'm no longer observing this issue

can't confirm.
Made a post
https://gitlab.freedesktop.org/drm/amd/-/issues/3166#note_2522283

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Development

No branches or pull requests

2 participants