Bug 475413

Summary: [Feature request] Window-level upscale similar to Lossless Scaling/Magpie on Windows
Product: [Plasma] kwin Reporter: unblended_icing552
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: REPORTED ---    
Severity: wishlist CC: unblended_icing552
Priority: NOR    
Version First Reported In: 5.27.8   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description unblended_icing552 2023-10-10 05:08:42 UTC
SUMMARY
When running a modern game on a under-power GPU it's common to set the game to a lower resolution then upscale it to native resolution for FPS boost. Currently on Linux this can be done:

- through Proton with `WINE_FULLSCREEN_FSR=1` environment variable
- through gamescope with `-F fsr` option

However, both comes with their limitations:

- Proton only works with Windows games, not native Linux games.
- Proton's upscale only activates when a wine window is declared as real full-screen with a lower resolution. Some games run as seamless full-screen with their own up-scaling implementation which is sometimes worse than FSR.
- gamescope cannot attach to a running game. You cannot upscale an existing running game with gamescope.
- gamescope does not handle multi-window properly. Sometimes custom proprietary game launcher are used prior to game launch and this can confuse the gamescope.
- gamescope is not zero-copy.
- Mouse movement speed in gamescope is not consistent with the desktop environment
- The fact gamescope being a full-fledged compositor that makes it more instructive (eg.. input method, screen scaling, keyboard layout handling) and resource-heavy than alternate solutions commonly seen on Windows
- Both solutions up-scales the actual window resolution, so capturing software records them at unnecessarily-higher resolution.

Some limitations are expected to address and fix (some already has pull request) but IMO this is better implemented compositor-level (as this is the least instructive approach) so that:

- It can be integrated into KDE Plasma (eg.. Right click on titlebar -> More Actions -> Upscale, Global Shortcuts, Window Rules)
- It doesn't intervene with recording software (eg.. OBS Studio can record game at its original resolution)
- It works with games that use custom launcher
- It works with applications that's not game (Firefox is broken in gamescope)
- It doesn't care if the game is running in Flatpak or natively
- Mouse movement speed can be consistent

ADDITIONAL INFORMATION
Common solutions on Windows:
Magpie (FOSS): https://github.com/Blinue/Magpie
Lossless Scaling (Paid): https://store.steampowered.com/app/993090/Lossless_Scaling/
Excluding the "It only works with Windows games" part, these solutions don't have any limitations listed above.