c82cefbdee
The size argument must not include the `long msg_type` field. Fixes the following ASan error: ================================================================= ==25745==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55cb6beea08a at pc 0x7f118e89525d bp 0x7f117620a8a0 sp 0x7f117620a048 READ of size 50 at 0x55cb6beea08a thread T10 #0 0x7f118e89525c in __interceptor_msgsnd /usr/src/debug/gcc/libsanitizer/sanitizer_common/sanitizer_c ommon_interceptors.inc:3138 #1 0x55cb6b6518ed in mangoapp_update(unsigned long, unsigned long, unsigned long) ../src/mangoapp.cpp: 48 #2 0x55cb6b484dde in imageWaitThreadMain() ../src/steamcompmgr.cpp:521 #3 0x55cb6b538298 in void std::__invoke_impl<void, void (*)()>(std::__invoke_other, void (*&&)()) /usr /include/c++/11.2.0/bits/invoke.h:61 #4 0x55cb6b5381b3 in std::__invoke_result<void (*)()>::type std::__invoke<void (*)()>(void (*&&)()) /u sr/include/c++/11.2.0/bits/invoke.h:96 #5 0x55cb6b538063 in void std:🧵:_Invoker<std::tuple<void (*)()> >::_M_invoke<0ul>(std::_Index_t uple<0ul>) /usr/include/c++/11.2.0/bits/std_thread.h:253 #6 0x55cb6b537f23 in std:🧵:_Invoker<std::tuple<void (*)()> >::operator()() /usr/include/c++/11. 2.0/bits/std_thread.h:260 #7 0x55cb6b537ae9 in std:🧵:_State_impl<std:🧵:_Invoker<std::tuple<void (*)()> > >::_M_run () /usr/include/c++/11.2.0/bits/std_thread.h:211 #8 0x7f118e0a34d3 in execute_native_thread_routine /usr/src/debug/gcc/libstdc++-v3/src/c++11/thread.cc :82 #9 0x7f118d3d75c1 in start_thread (/usr/lib/libc.so.6+0x8d5c1) #10 0x7f118d45c583 in __clone (/usr/lib/libc.so.6+0x112583) 0x55cb6beea08a is located 0 bytes to the right of global variable 'mangoapp_msg_v1' defined in '../src/mangoapp.cpp:27:27' (0x55cb6beea060) of size 42 |
||
---|---|---|
.github/workflows | ||
protocol | ||
src | ||
subprojects | ||
.editorconfig | ||
.gitmodules | ||
LICENSE | ||
meson.build | ||
meson_options.txt | ||
README.md |
gamescope: the micro-compositor formerly known as steamcompmgr
In an embedded session usecase, gamescope does the same thing as steamcompmgr, but with less extra copies and latency:
- It's getting game frames through Wayland by way of Xwayland, so there's no copy within X itself before it gets the frame.
- It can use DRM/KMS to directly flip game frames to the screen, even when stretching or when notifications are up, removing another copy.
- When it does need to composite with the GPU, it does so with async Vulkan compute, meaning you get to see your frame quick even if the game already has the GPU busy with the next frame.
It also runs on top of a regular desktop, the 'nested' usecase steamcompmgr didn't support.
- Because the game is running in its own personal Xwayland sandbox desktop, it can't interfere with your desktop and your desktop can't interfere with it.
- You can spoof a virtual screen with a desired resolution and refresh rate as the only thing the game sees, and control/resize the output as needed. This can be useful in exotic display configurations like ultrawide or multi-monitor setups that involve rotation.
It runs on Mesa + AMD or Intel, and could be made to run on other Mesa/DRM drivers with minimal work. AMD requires Mesa 20.3+, Intel requires Mesa 21.2+. Can support NVIDIA if/when they support atomic KMS + accelerated Xwayland + Vulkan DMA-BUF extensions.
If running RadeonSI clients with older cards (GFX8 and below), currently have to set R600_DEBUG=nodcc
, or corruption will be observed until the stack picks up DRM modifiers support.
Building
git submodule update --init
meson build/
ninja -C build/
build/gamescope -- <game>
Install with:
meson install -C build/ --skip-subprojects
Keyboard shortcuts
- Super + F : Toggle fullscreen
- Super + N : Toggle integer scaling
- Super + U : Toggle FSR upscaling
- Super + I : Increase FSR sharpness by 1
- Super + O : Decrease FSR sharpness by 1
- Super + S : Take screenshot (currently goes to
/tmp/gamescope_$DATE.png
)
Examples
On any X11 or Wayland desktop, you can set the Steam launch arguments of your game as follows:
# Upscale a 720p game to 1440p with integer scaling
gamescope -h 720 -H 1440 -n -- %command%
# Limit a vsynced game to 30 FPS
gamescope -r 30 -- %command%
# Run the game at 1080p, but scale output to a fullscreen 3440×1440 pillarboxed ultrawide window
gamescope -w 1920 -h 1080 -W 3440 -H 1440 -b -- %command%
Options
See gamescope --help
for a full list of options.
-W
,-H
: set the resolution used by gamescope. Resizing the gamescope window will update these settings. Ignored in embedded mode. If-H
is specified but-W
isn't, a 16:9 aspect ratio is assumed. Defaults to 1280×720.-w
,-h
: set the resolution used by the game. If-h
is specified but-w
isn't, a 16:9 aspect ratio is assumed. Defaults to the values specified in-W
and-H
.-r
: set a frame-rate limit for the game. Specified in frames per second. Defaults to unlimited.-o
: set a frame-rate limit for the game when unfocused. Specified in frames per second. Defaults to unlimited.-U
: use AMD FidelityFX™ Super Resolution 1.0 for upscaling-n
: use integer scaling.-b
: create a border-less window.-f
: create a full-screen window.