ValveSoftware / gamescope

SteamOS session compositing window manager
Other
2.82k stars 186 forks source link

Gamescope performance #1204

Open ghost opened 3 months ago

ghost commented 3 months ago

Hi, leaving feedback: 1 - With gamescope active, game performance dropped significantly. I tested Horizon Chase Turbo 2 - When I switch to big picture, and I exit big picture mode by clicking on the option to switch to the desktop, it stays in an infinite loop and does not change to normal steam mode. 3 - The games' fps do not appear, I use Steam's native option to show the fps.

I only used the command in the terminal: gamescope -w 1920 -h 1080 -W 1920 -H 1080 -f -b -r 30 -e -- steam

and I started the games through the normal Steam interface, and through the big picture, alternating between 60fps and 30fps.

Then I opened Steam without the gamescope to see the performance too.

Did I do something wrong? 🤔

Lenovo ideapad 3 15itl6 82md intel i3 1115g4 Kubuntu 23.10 (wayland) Ram 4gb swap 20gb 1920x1080p 60hz btrfs abnt2, ptbr utf8

sharkautarch commented 3 months ago

I only used the command in the terminal: gamescope -w 1920 -h 1080 -W 1920 -H 1080 -f -b -r 30 -e -- steam

When you say command in the terminal, are you starting gamescope from a tty terminal (wherein, your screen is only showing a terminal before you start gamescope)?

I see you are using -r 30 That makes gamescope run at 30 fps... do you intend to run gamescope at 30fps? Since your display is 60hz, does gamescope behave better if you run it at 60fps (so just remove the -r 30): gamescope -w 1920 -h 1080 -W 1920 -H 1080 -f -b -e -- steam

Also, what gpu(s) do you have on your computer? Is it just an intel integrated graphics card, a discrete graphics card or both? If you're unsure, you can run: lspci -nn | grep -iE 'VGA|3D'

If you have both an integrated gpu and discrete gpu, gamescope should be selecting the discrete gpu automatically, but you can double check which gpu it chooses if you look at the line of gamescope's terminal output that starts with: vulkan: selecting physical device ...

ghost commented 3 months ago

hello, yes through kde terminal konsole starts with the command.

I wanted 30 fps at times, for when I use the laptop's battery

The PC has 1 video card, onboard from Intel

sharkautarch commented 3 months ago

hello, yes through kde terminal konsole starts with the command.

Ah, so you're using gamescope in the nested mode (where it runs ontop of a desktop session like kde) the way that you've been using gamescope is really only supposed to be used for embedded gamescope sessions

In case you're unfamiliar, the embedded mode is where you switch to another tty w/ either ctrl+alt+f<number> or ctrl+alt+fn+f<number>, login to the graphics-less terminal, then start gamescope from said terminal. This is a different sort of terminal compared to a terminal emulator like kde terminal konsole, because the kde terminal konsole is a terminal inside of a window managed by kde, whereas the tty terminal has no desktop session running it.

For nested sessions, you'll want to launch gamescope by setting your games' steam launch options to either: fullscreen: gamescope -w 1920 -h 1080 -W 1920 -H 1080 -f -r 30 -- %command% borderless fullscreen window: gamescope -w 1920 -h 1080 -W 1920 -H 1080 -b -r 30 -- %command%

the thing where you were launching the whole steam session under gamescope w/ gamescope ... -e -- steam is more meant to be done w/ embedded sessions

The PC has 1 video card, onboard from Intel

Since you're using an integrated gpu, you might still get poor performance. I do have a forked gamescope branch test_w_no_lut that has a bunch of tweaks, which I've found to help with performance, especially on integrated gpus. Do note that this test_w_no_lut branch disables color-management done during composition, in order to reduce composition duration by (from tests done on my intel igpu) ~1ms (and lowers gpu usage so should also reduce battery drain). The only issue is that I'm on archlinux, so I only have a pkgbuild for building a custom package w/ my branch, whereas you are on ubuntu.

Two options for how to install my custom branch:

git clone https://github.com/sharkautarch/gamescope.git
cd gamescope
git checkout test_w_no_lut
git submodule update --init
meson subprojects download
meson setup build --reconfigure --buildtype=debugoptimized -Db_lto=true -Db_ndebug=true -Denable_openvr_support=false -Dc_args="-g1 -Wno-error=unused-but-set-variable -Wno-error=unused-variable -fipa-pta -fdelete-dead-exceptions -march=native -Wno-error=stringop-overflow -fno-omit-frame-pointer" -Dc_link_args="-g1 -Wno-error=unused-but-set-variable -Wno-error=unused-variable -fdelete-dead-exceptions -fipa-pta -march=native -Wl,--strip-discarded,--gc-sections,--relax,-z,start-stop-gc,-z,pack-relative-relocs,-O1 -Wno-error=stringop-overflow -fno-omit-frame-pointer" -Dcpp_args="-g1 -fnothrow-opt -fno-threadsafe-statics -fimplicit-constexpr -fno-enforce-eh-specs -fno-check-new -Wno-error=unused-but-set-variable -Wno-error=unused-variable -fdelete-dead-exceptions -fipa-pta -march=native -fno-omit-frame-pointer" -Dcpp_link_args="-g1 -fno-threadsafe-statics -fimplicit-constexpr -fnothrow-opt -fno-check-new -fno-enforce-eh-specs -Wno-error=unused-but-set-variable -Wno-error=unused-variable -fdelete-dead-exceptions -march=native -fipa-pta -Wl,--strip-discarded,--gc-sections,--relax,-z,start-stop-gc,-z,pack-relative-relocs,-O1 -fno-omit-frame-pointer"
meson compile -C build
meson install -C build

install makedeb:

wget -qO - 'https://proget.makedeb.org/debian-feeds/makedeb.pub' | gpg --dearmor | sudo tee /usr/share/keyrings/makedeb-archive-keyring.gpg 1> /dev/null
echo 'deb [signed-by=/usr/share/keyrings/makedeb-archive-keyring.gpg arch=all] https://proget.makedeb.org/ makedeb main' | sudo tee /etc/apt/sources.list.d/makedeb.list
sudo apt update
sudo apt install makedeb

(attempt to) build and install my PKGBUILD into a ubuntu compatible package:

mkdir gamescope
cd gamescope
wget https://gist.githubusercontent.com/sharkautarch/2ddc9a1c9eed3306fde8375659032d3f/raw/49541648569c3375ca7f46b052bb8404d63b1c96/PKGBUILD
makedeb -si

Oh also, if you end up using my forked branch of gamescope, make sure to run sudo setcap 'cap_sys_nice=eip' $(which gamescope) after installing, to ensure gamescope is able to run w/ realtime perms