Open flying-sheep opened 2 years ago
I guess it can be done using window rules (kcmshell5 kwinrules
):
A feature like this would be much appreciated; some games don't allow you to select a specific display which can be a hassle.
I was also looking for a way to do this.
gamescope --help
Shows this as one of the options:
-O, --prefer-output list of connectors in order of preference
From my understanding of this (#211) issue I should be able to get a list of available connectors with: ls /sys/class/drm/card0/
and then gamescope -O card0-DP-3
, for example. But I must be misunderstanding what connectors mean, because it doesn't work for me.
It's also mentioned on that issue that The list of available connectors is printed on startup
. If we take a look at older issues (for example #508) we see that the list of connectors indeed was printed on startup, but at least for the version available on Fedora 37 (gamescope-3.11.49-1)
, that's not the case. Here's my output:
No CAP_SYS_NICE, falling back to regular-priority compute and threads.
Performance will be affected.
wlserver: [backend/headless/backend.c:82] Creating headless backend
vulkan: selecting physical device 'AMD Radeon RX 5700 XT (RADV NAVI10)': queue family 1
vulkan: physical device supports DRM format modifiers
vulkan: supported DRM formats for sampling usage:
vulkan: 0x34325241
vulkan: 0x34325258
vulkan: 0x3231564E
wlserver: Running compositor on wayland display 'gamescope-0'
wlserver: [backend/headless/backend.c:18] Starting headless backend
wlserver: [xwayland/server.c:92] Starting Xwayland on :2
wlserver: [types/wlr_surface.c:748] New wlr_surface 0x55fb7252e560 (res 0x55fb72531330)
wlserver: [xwayland/server.c:250] Xserver is ready
pipewire: stream state changed: connecting
pipewire: stream state changed: paused
pipewire: stream available on node ID: 64
pipewire: renegotiating stream params (size: 1280x720)
Am I right in believing that the -O
parameter should allow us to select a specific monitor or did I misunderstood what it means ?
@Vitorvlv I believe the help output is of use here.
-O is under the header for Embedded mode. This means running without X11 or Wayland, so basically pure framebuffer from a TTY. The -O would be needed because at that point there's no concept of monitors or screens, just connectors.
Ah, I see. Thank you!!
For reference here's the option being used on TTY on a Steam Deck
It does exactly what I would like it to do. Shame it can only done while in embedded mode, hopefully this feature can be implemented at some point.
Thanks for showing me!
It does exactly what I would like it to do. Shame it can only done while in embedded mode, hopefully this feature can be implemented at some point.
It doesn' t make sense to be implemented in nested mode since in that case the parent compositor is the one that manages windows and monitors. You should be able to select in which monitor to show gamescope window in the settings of your desktop environment.
You should be able to select in which monitor to show gamescope window in the settings of your desktop environment.
While that does seems to be the case for plasma, using kwin's window rules, I couldn't find a way to do it in gnome (wayland), the DE i'm using. If anyone has any ideas I would be grateful to be pointed in the right direction.
I'll also add an additional edge case where the output flag does not work.
I have two GPU/DRM one is a Nvidia 4060 which I am using for Scanout over HDMI and the other is my Primary GPU (6800XT) which I want to use as a renderer.
In either situation (without an existing compositor i.e plasma) gamescope does not honor the output connector. Nor given that the only way to get nvidia and amd working is to ensure that a panel is connected to the amd gpu at boot (i.e DP-1). The HDMI-A-3 that shows as connected in Plasma wayland via nvidia never gets probed as nvidia drm modeset is not handling the tty/console - the amdgpu is. And so even with an approprite invoation of gamescope i.e :
gamescope --hdr-enabled -W 3840 -H 2160 --prefer-vk-device 1002:73bf -O HDMI-A-3 steam
results in the DP-1 output being selected.
Ideally being able to launch gamescope from either nested mode using the existing amdgpu compositor and using the second gpu as scanout should be possible. I guess this would require some probing to check to see if a connector is claimed already?
The first instance should also work without an existing compositor, but doesn't due to expectation render and scanout will be the same device which is often not that case.
Workaround for wayland/sway users:
>>> ~/.config/sway/config
for_window [ app_id="gamescope" ] 'move output current ; focus parent ; focus child'
It moves gamescope window to the current monitor and acquire focus.
More viable solution. Place this line before running gamescope (not in config)
swaymsg "for_window [ app_id=gamescope ] 'move output current ; workspace back_and_forth ; workspace back_and_forth'"
Moving back and forth needed to gain focus back.
not sure when it was added but --display-index
seems to work for me
not sure when it was added but
--display-index
seems to work for me
https://github.com/ValveSoftware/gamescope/commit/1bd20cebd2980e629161669caec5c5306c63da70
not sure when it was added but
--display-index
seems to work for me
hey man, how did you use it in a command?
i tried this: gamescope -W 3840 -H 2160 -e --display-index 2 -- steam -bigpicture
but this doesnt work, it just launches on my monitor, i want to launch big picture on my TV and still have my monitor plugged in,
I am on CachyOS using KDE Plasma with Wayland
Fwiw --display-index does nothing on the Wayland backend.
Can we even do anything there? I am not sure. Maybe pass an output to set_fullscreen? I'll look into it
Fwiw --display-index does nothing on the Wayland backend.
Can we even do anything there? I am not sure. Maybe pass an output to set_fullscreen? I'll look into it
oh i see, sorry im really new on linux :D
--display-index
works fine for me, only problem is that the index seems to change randomly
I’m on Wayland (kwin) and have the same issue as @Visne: the index isn’t stable per output, but changes based on what outputs are currently connected.
It would be great to have an alternative way of specifying. E.g. the following script returns for me:
0: DP-1 34"
So being able to specify --display=DP-1
would be nice!
I don’t know why SDL adds the 34"
here, on linux the adapter is /sys/class/drm/card1-DP-1
, so the information would be there I guess.
#!/usr/bin/env run-cargo-script
//! Get all display names
//!
//! ```cargo
//! [dependencies]
//! color-eyre = "0.6"
//! sdl2 = "0.36.0"
//! ```
extern crate color_eyre;
extern crate sdl2;
use color_eyre::eyre::{Result, eyre};
fn main() -> Result<()> {
color_eyre::install()?;
let sdl = sdl2::init().map_err(|e| eyre!(e))?;
let video = sdl.video().map_err(|e| eyre!(e))?;
for d in 0..video.num_video_displays().map_err(|e| eyre!(e))? {
println!("{d}: {}", video.display_name(d).map_err(|e| eyre!(e))?);
}
Ok(())
}
Fwiw --display-index does nothing on the Wayland backend.
Can we even do anything there? I am not sure. Maybe pass an output to set_fullscreen? I'll look into it
I am not sure how it works, but some (Windows) games (that I run via Proton) allow me to select the monitor, even when they run fullscreen. (I am running KDE Plasma Wayland.)
I would mainly want to use gamescope to move the games that do not include multi monitor support to my second monitor.
--display-index
seems to work for me. The only way I've been able to reliably determine which display gets which index, however, is by compiling the SDL2 test utilities and using testdisplayinfo
. It doesn't seem consistent, at least I haven't looked deeply enough to determine if there's something that can be configured to ensure consistency.
I cannot get it to work in my multi monitor setup. With gamescope -f -w 2560 -h 1440 --display-index 2 --hdr-enabled %command%
System Shock (2023) still starts on the primary screen. (I tried --display-index 0
, 1
, 2
and 3
.)
I do get an error dialogue, though (appears a 2nd time, when I press "Ok"):
CreateSwapchainKHR: Creating swapchain for non-Gamescope swapchain.
Hooking has failed somewhere!
You may have a bad Vulkan layer interfering.
Press OK to try to power through this error, or Cancel to stop.
Steam:
❯ flatpak info com.valvesoftware.Steam
Valve Corporation - Launcher for the Steam software distribution service
ID: com.valvesoftware.Steam
Ref: app/com.valvesoftware.Steam/x86_64/stable
Arch: x86_64
Branch: stable
Version: 1.0.0.79
License: LicenseRef-proprietary
Origin: flathub
Collection: org.flathub.Stable
Installation: system
Installed: 45,5 MB
Runtime: org.freedesktop.Platform/x86_64/23.08
Sdk: org.freedesktop.Sdk/x86_64/23.08
Commit: 173cd565d98d4951bd858bad290e8481a9e72dbf5f7c9c980165a060666184b1
Parent: 98f034b154eed70b957bedcba0a5ce3785e70999b4aef85e1f6dd66f2eb15ff7
Subject: Add pressure-vessel's overrides data dir to XDG_DATA_DIRS (ee358536)
Date: 2024-04-03 13:45:40 +0000
Gamescope:
❯ flatpak info org.freedesktop.Platform.VulkanLayer.gamescope
gamescope - The micro-compositor formerly known as steamcompmgr
ID: org.freedesktop.Platform.VulkanLayer.gamescope
Ref: runtime/org.freedesktop.Platform.VulkanLayer.gamescope/x86_64/23.08
Arch: x86_64
Branch: 23.08
Version: 3.14.24
License: BSD-2-Clause
Origin: flathub
Collection: org.flathub.Stable
Installation: system
Installed: 17,0 MB
Commit: 0039e1ddb7c62864450f769b8828ce6b22932c1ce8a1819613638d0c028de84e
Parent: 5087007a6d3cb2e95afdbb68823764e95254f4b5ab693378d5789d2a3a9dab0e
Subject: Update gamescope and xwayland modules (#217) (5202e5a7)
Date: 2024-07-10 17:26:32 +0000
System:
Operating System: NixOS 24.05
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.2
Kernel Version: 6.10.1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 9 6900HS with Radeon Graphics
Memory: 30,6 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Window manager: https://invent.kde.org/-/snippets/3190
For me (Fedora 40, Nvidia driver 560), I can only get an image from a TTY, if the -O HDMI-A-1,HDMI-A-2
parameter is paired with using --backend sdl
. Otherwise the same value for -O
will not result in an image once I have more than 1 display connected, but I can hear the Steam BP sound in the speakers. It even receives input from my gamepad. But it doesn't work right with the default backend (drm, I guess?).
I'm pretty desperate for this feature too. I have two ultrawide monitors connected to my AMD GPU via DPs and I use gamescope to span them both with -W 6880 -H 1440. It works great, but I have to use the HDMI port on the GPU for 5.1 audio to the soundbar. This causes Wayland to see the soundbar as another 'display'. I have no choice but to set the resolution of the 'display' to the lowest value and connect it to the right,left,up, or down of my monitors in the display settings. Now gamescope will try to span 3 displays, including the nonexistant HDMI.
I need to command gamescope to only use the DP-1 and DP-2 displays for rendering the window, as i've been unable to exclude it from the overall desktop space that Wayland presents. I do not want to use HDMI Passthrough (ARC) from the soundbar on the second monitor because frame rate is drastically reduced and a 3440x1440 resolution is not an option in Display Settings.
FWIW I did try to mirror the HDMI display to one of the DP monitors, but that introduces a lot of anomalies. Sometimes instead of spanning the monitors, I will see the game mirrored on the two monitors (even though only one of the monitors is mirrored to HDMI), and sometimes the gamescope window will simply not be visible at all.
Might depend on the response to https://github.com/libsdl-org/SDL/issues/4827
I’m using KDE Plasma, which supports selecting a primary monitor for both X11 and Wayland.
Therefore everything that doesn’t place itself on some specific monitor will appear on my primary (office) monitor.
I want gamescope to appear on my projector instead, but there seems to be no flag to select any monitor. Is there another way or can you implement such a flag?