Code Monkey home page Code Monkey logo

gamescope's Introduction

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+. For NVIDIA's proprietary driver, version 515.43.04+ is required (make sure the nvidia-drm.modeset=1 kernel parameter is set).

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 nearest neighbour filtering
  • Super + U : Toggle FSR upscaling
  • Super + Y : Toggle NIS 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)
  • Super + G : Toggle keyboard grab
  • Super + C : Update clipboard

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 -S integer -- %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.
  • -F fsr: use AMD FidelityFX™ Super Resolution 1.0 for upscaling
  • -F nis: use NVIDIA Image Scaling v1.0.3 for upscaling
  • -S integer: use integer scaling.
  • -S stretch: use stretch scaling, the game will fill the window. (e.g. 4:3 to 16:9)
  • -b: create a border-less window.
  • -f: create a full-screen window.

Reshade support

Gamescope supports a subset of Reshade effects/shaders using the --reshade-effect [path] and --reshade-technique-idx [idx] command line parameters.

This provides an easy way to do shader effects (ie. CRT shader, film grain, debugging HDR with histograms, etc) on top of whatever is being displayed in Gamescope without having to hook into the underlying process.

There is currently no way to set the value of uniforms/options, they will just be their initializer values currently.

Using Reshade effects will increase latency as there will be work performed on the general gfx + compute queue as opposed to only using the realtime async compute queue which can run in tandem with the game's gfx work.

Using Reshade effects is highly discouraged for doing simple transformations which can be achieved with LUTs/CTMs which are possible to do in the DC (Display Core) on AMDGPU at scanout time, or with the current regular async compute composite path. The looks system where you can specify your own 3D LUTs would be a better alternative for such transformations.

Pull requests for improving Reshade compatibility support are appreciated.

Status of Gamescope Packages

Packaging status

gamescope's People

Contributors

joshua-ashton avatar emersion avatar plagman avatar dadschoorse avatar jeremyselan avatar romangg avatar jbeich avatar ruineka avatar bnieuwenhuizen avatar slouken avatar forthereallys avatar scrumplex avatar flightlessmango avatar hanskristian-work avatar ishitatsuyuki avatar oschowa avatar bjj avatar lolzballs avatar samsagax avatar kylegospo avatar honjow avatar trigg avatar esullivan-nvidia avatar tcoyvwac avatar valentindavid avatar stephanlachnit avatar endlesslyflowering avatar nephyrin avatar jaunkst avatar cubanismo avatar

Stargazers

wizzdom avatar  avatar  avatar luuyiii avatar Lenny Andreu avatar That One Seong avatar  avatar Atapi avatar Karol Bieńkowski avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.