Bug 477948 - VRR seems to break completely or get stuck always on with a hybrid GPU setup
Summary: VRR seems to break completely or get stuck always on with a hybrid GPU setup
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: master
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-02 21:25 UTC by kde.oqxcy
Modified: 2023-12-12 23:12 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kde.oqxcy 2023-12-02 21:25:16 UTC
SUMMARY

When running games or VRRTEST on a system that is using an AMD IGPU connected to a display with an NVidia GPU used to render games with prime-run, adaptive sync gets stuck on or stops working altogether.

Example 1: If i have adaptive sync set to automatic then run VRRTEST (https://github.com/Nixola/VRRTest) with or without prime-run then close VRRTEST it freezes with the VRRTEST image stuck on screen. I then have to switch to a virtual terminal and back so i can see my desktop. 

Once back on the desktop my monitor will start flickering and the monitors HUD will show the Hz switching between 240 and 48. If i change the display configuration in system settings to "adaptive sync: never" it will still continue flickering and my monitors HUD still shows the Hz switching between 240 and 48.

I can fix this by loading VRRTEST in gamescope and closing it, that stops the flickering plus the switching between 240 and 48 Hz.

Example 2: If i run a game e.g doom eternal (but it seems to be any game) on steam with proton but without gamescope then VRR stops working completely and i have to log out and back in for it to start working again.

Also VRRTEST no longer freezes when closing once vrr is broken.


STEPS TO REPRODUCE
1.  Launch steam game without gamescope with "prime-run %command%" as launch options.
2.  See adaptive sync isn't working in game and close game.
3.  Launch VRRTEST and see that the monitors refresh rate is no longer changing anymore to match the fps. 

OBSERVED RESULT
adaptive sync not working

EXPECTED RESULT
adaptive sync working

SOFTWARE/OS VERSIONS
KDE Plasma Version:  5.90.0
KDE Frameworks Version: 5.246.0
Qt Version:  6.6.1
Comment 1 kde.oqxcy 2023-12-02 21:31:24 UTC
Sorry i forgot to add that i see this in journalctl

Dec 02 20:59:05 arch kwin_wayland[22961]: kf.windowsystem: static bool KX11Extras::mapViewport() may only be used on X11
Dec 02 20:59:05 arch kwin_wayland[22961]: kwin_core: User timestamp, ASN: 4294967295
Dec 02 20:59:05 arch kwin_wayland[22961]: kwin_core: User timestamp, final: KWin::X11Window(0x560a5e726400, caption="Properties - DOOM Eternal") : 4835757
Dec 02 20:59:05 arch kwin_wayland[22961]: kwin_core: Activation: Belongs to active application
Dec 02 20:59:05 arch kwin_wayland[22961]: kwin_core: Raising: Belongs to active application
Dec 02 20:59:05 arch kwin_wayland[22961]: kwin_scene_opengl: 0x2: GL_INVALID_VALUE in glTexStorage2D(width, height or depth < 1)
Dec 02 20:59:05 arch kwin_wayland[22961]: kwin_scene_opengl: 0x4: FBO incomplete: color attachment incomplete [0]
Dec 02 20:59:05 arch kwin_wayland[22961]: kwin_scene_opengl: Invalid framebuffer status:  "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"
Dec 02 20:59:05 arch kwin_wayland[22961]: kwin_scene_opengl: Can't enable invalid framebuffer object!
Dec 02 20:59:05 arch kwin_wayland[22961]: kwin_scene_opengl: 0x2: GL_INVALID_FRAMEBUFFER_OPERATION in glClear(incomplete framebuffer)
Comment 2 Nate Graham 2023-12-12 23:12:54 UTC
Are you using X11 or Wayland?