Bug 460725 - 5.26 causes poor performance with gamescope's full screen mode when using high scale factor on any displays and "Scaled by the system" KScreen setting
Summary: 5.26 causes poor performance with gamescope's full screen mode when using hig...
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: 5.26.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2022-10-19 18:21 UTC by Andres
Modified: 2023-01-09 00:42 UTC (History)
4 users (show)

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


Attachments
wayland gamescope log (192.66 KB, text/plain)
2022-10-21 17:35 UTC, Andres
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andres 2022-10-19 18:21:14 UTC
SUMMARY
5.26 causes major stuttering in gamescope (also reported here https://github.com/Plagman/gamescope/issues/657) Downgrading back to 5.25.5 fixes the stuttering.


STEPS TO REPRODUCE
1. Upgrade to 5.26
2. Start a game with gamescope
3. notice immediately really bad stuttering in any game

OBSERVED RESULT
really bad stuttering in any game compared to 5.25.5

EXPECTED RESULT
same performance as 5.25.5

SOFTWARE/OS VERSIONS
Operating System: Garuda Linux
KDE Plasma Version: 5.26.1
KDE Frameworks Version: 5.99.0
Qt Version: 5.15.6
Kernel Version: 6.0.1-270-tkg-bmq (64-bit)
Graphics Platform: Wayland
Processors: 12 × AMD Ryzen 5 5600X 6-Core Processor
Memory: 31.3 GiB of RAM
Graphics Processor: AMD Radeon RX 6700 XT
ADDITIONAL INFORMATION
Comment 1 David Edmundson 2022-10-20 14:09:51 UTC
Can you get a log of WAYLAND_DEBUG=1 gamescope... log of when you start gamescope in the stuttering mode.
Comment 2 Nate Graham 2022-10-20 19:55:20 UTC
.
Comment 3 Andres 2022-10-20 20:04:18 UTC
(In reply to David Edmundson from comment #1)
> Can you get a log of WAYLAND_DEBUG=1 gamescope... log of when you start
> gamescope in the stuttering mode.

https://dpaste.com/3RTWU7BMJ
Comment 4 Nate Graham 2022-10-21 15:33:00 UTC
That link doesn't work for me. It says, "We hit an error -- not your fault. Error has been logged, and will be investigated ASAP."

Can you attach the output in a file here?
Comment 5 Andres 2022-10-21 17:35:46 UTC
Created attachment 153093 [details]
wayland gamescope log
Comment 6 Nate Graham 2022-10-24 17:53:48 UTC
Thanks.
Comment 7 Arjen Hiemstra 2022-11-18 12:06:06 UTC
I ran several things through gamescope and didn't notice any stuttering. So this will need some more information, like if you pass any specific arguments to gamescope. Also, I assume you're using the open source AMD drivers?
Comment 8 Andres 2022-11-19 02:24:25 UTC
As i said in the title (and the upstream issue) you need to pass the Fullscreen flag otherwise it works correctly

As for the driver version this was again mentioned in the GitHub and still persists with mesa 22.2.3
Comment 9 Andres 2022-11-19 02:29:45 UTC
My bad in the last reply i said the issue doesn't happen unless you use the Fullscreen flag, but another way to reproduce the issue is to full screen it after the gamescope window is created.
Comment 10 David Edmundson 2022-11-25 11:50:30 UTC
Can you confirm your screen setup?

Gamescope is reporting to it's internal clients:

[3277874.828]  -> wl_output@8.mode(1, 5632, 2376, 75000)
does 5632 x 2376 sound right? It's rather large.

The wayland log you supplied shows traffic from gamescope -> internal clients, but we don't have any wayland traffic from gamescope -> kwin, which is very surprising.
Can you run "xwininfo" and click on gamescope (doesn't have to be fullscreen at this point) and see if there's output?
Comment 11 Nate Graham 2022-11-26 06:03:15 UTC
.
Comment 12 Andres 2022-11-27 03:02:22 UTC
xwininfo

xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x5200002 "gamescope"

  Absolute upper-left X:  5981
  Absolute upper-left Y:  0
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 3840
  Height: 2160
  Depth: 24
  Visual: 0x6b
  Visual Class: DirectColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x5200001 (installed)
  Bit Gravity State: ForgetGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +5981+0  -0+0  -0-216  +5981-216
  -geometry 3840x2160-0+0
Comment 13 Andres 2022-11-27 03:08:59 UTC
sorry didn't see the bit about the screen setup I have two monitors connected one ultrawide 2560x1080 scaled to 125% and a Samsung 4k tv scaled to 275%

here is a kscreen doctor output

kscreen-doctor -o
Output: 1 LG Electronics LG HDR WFHD/14329 enabled connected primary DisplayPort Modes: 0:2560x1080@60*! 1:2560x1080@75 2:2560x1080@50 3:1920x1080@60 4:1920x1080@60 5:1920x1080@60 6:1920x1080@50 7:1680x1050@60 8:1600x900@60 9:1280x1024@75 10:1280x1024@60 11:1440x900@60 12:1280x800@60 13:1152x864@75 14:1280x720@60 15:1280x720@60 16:1280x720@60 17:1280x720@50 18:1024x768@75 19:1024x768@60 20:832x624@75 21:800x600@75 22:800x600@60 23:720x576@50 24:720x480@60 25:720x480@60 26:720x480@60 27:720x480@60 28:640x480@75 29:640x480@60 30:640x480@60 31:640x480@60 Geometry: 0,0 2048x864 Scale: 1.25 Rotation: 1 Overscan: 0 Vrr: incapable RgbRange: unknown primary


Output: 2 Samsung Electric Company SAMSUNG/16780800 enabled connected  HDMI Modes: 0:3840x2160@60*! 1:4096x2160@60 2:4096x2160@60 3:4096x2160@50 4:4096x2160@30 5:4096x2160@30 6:4096x2160@24 7:4096x2160@24 8:3840x2160@60 9:3840x2160@60 10:3840x2160@50 11:3840x2160@30 12:3840x2160@30 13:3840x2160@25 14:3840x2160@24 15:3840x2160@24 16:2560x1440@60 17:1920x1200@60 18:1920x1080@60 19:1920x1080@60 20:1920x1080@60 21:1920x1080@50 22:1920x1080@30 23:1920x1080@30 24:1920x1080@25 25:1920x1080@24 26:1920x1080@24 27:1600x1200@60 28:1680x1050@60 29:1600x900@60 30:1280x1024@75 31:1280x1024@60 32:1440x900@60 33:1280x800@60 34:1152x864@75 35:1280x720@60 36:1280x720@60 37:1280x720@60 38:1280x720@50 39:1024x768@75 40:1024x768@70 41:1024x768@60 42:832x624@75 43:800x600@75 44:800x600@72 45:800x600@60 46:720x576@50 47:720x480@60 48:720x480@60 49:640x480@75 50:640x480@73 51:640x480@67 52:640x480@60 53:640x480@60 54:720x400@70 Geometry: 2175,0 1396x785 Scale: 2.75 Rotation: 1 Overscan: 0 Vrr: incapable RgbRange: unknown
Comment 14 Zamundaaa 2022-12-29 12:21:52 UTC
> one ultrawide 2560x1080 scaled to 125% and a Samsung 4k tv scaled to 275%

That setup is the cause of the problem - KWin scales Xwayland to the largest scale of all outputs, which effectively fakes a very high resolution on those outputs with a smaller scale.
The proper solution would be for gamescope to not go through Xwayland but be a native Wayland client instead, with support for the fractional scaling protocol.
As workarounds you could explicitly specify the resolution you want when you start gamescope, or revert to the old Xwayland behavior by changing the relevant setting ("Legacy Applications (X11): Apply scaling themselves") in the display configuration.
Comment 15 Andres 2023-01-09 00:28:43 UTC
can no longer reproduce on latest gamesope git + kde 5.26.5.


seems to have been fixed upstream?
Comment 16 Nate Graham 2023-01-09 00:42:51 UTC
Saw your comment on https://github.com/Plagman/gamescope/issues/657#issuecomment-1374975076; closing. Thanks for following up!