flathub / org.freedesktop.Platform.VulkanLayer.gamescope

https://flathub.org/apps/details/org.freedesktop.Platform.VulkanLayer.gamescope
15 stars 2 forks source link

Gamescope CreateSwapchain fails for non-native linux games. #199

Open LostWarriorr opened 1 month ago

LostWarriorr commented 1 month ago

Title is pretty vague but not sure how else to list this.

Certain games when launched using gamescope flatpak inside the steam flatpak fail to actually initialize gamescope due to a hooking error / swapchain error.

This does NOT happen on native steam with gamescope.

The first of these errors is as follows:

Error 1 Screenshot_20240529_191304

With the second one being this after closing the first one:

Error 2 Screenshot_20240529_191022

These errors appeared on the following games that I have tested so far:

Game: Abiotic Factor Engine: Unreal Engine 5 Release: 2024

Game: Risk of Rain 2 Engine: Unity Release: 2020

Game: Risk of Rain Returns Engine: Unknown (Custom?) Release: 2023

All the logs look fairly similar but here is just the one from Abiotic Factor:

No CAP_SYS_NICE, falling back to regular-priority compute and threads. Performance will be affected. Your Wayland compositor does NOT support wp_presentation/presentation-time which is required for VK_KHR_present_wait and VK_KHR_present_id. Please complain to your compositor vendor for support. Falling back to X11 window with less accurate present wait. xdg_backend: Couldn't create Wayland objects. vulkan: selecting physical device 'AMD Radeon RX 6800 XT (RADV NAVI21)': queue family 1 (general queue family 0) vulkan: physical device supports DRM format modifiers Fossilize INFO: Overriding serialization path: "/media/USER/Corsair MP510 NVME/SteamLibrary/steamapps/shadercache/427410/fozpipelinesv6/steamapprun_pipeline_cache". wlserver: [backend/headless/backend.c:67] Creating headless backend vulkan: supported DRM formats for sampling usage: vulkan: AR24 (0x34325241) vulkan: XR24 (0x34325258) vulkan: AB24 (0x34324241) vulkan: XB24 (0x34324258) vulkan: RG16 (0x36314752) vulkan: NV12 (0x3231564E) vulkan: AB4H (0x48344241) vulkan: XB4H (0x48344258) vulkan: AB48 (0x38344241) vulkan: XB48 (0x38344258) vulkan: AB30 (0x30334241) vulkan: XB30 (0x30334258) vulkan: AR30 (0x30335241) vulkan: XR30 (0x30335258) vulkan: Creating Gamescope nested swapchain with format 44 and colorspace 0 wlserver: Using explicit sync when available wlserver: Running compositor on wayland display 'gamescope-0' wlserver: [backend/headless/backend.c:17] Starting headless backend wlserver: Successfully initialized libei for input emulation! wlserver: [xwayland/sockets.c:64] Failed to bind socket @/tmp/.X11-unix/X0: Address already in use wlserver: [xwayland/sockets.c:64] Failed to bind socket @/tmp/.X11-unix/X1: Address already in use wlserver: [xwayland/server.c:107] Starting Xwayland on :2 ERROR: ld.so: object '/home/USER/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ERROR: ld.so: object '/home/USER/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. ERROR: ld.so: object '/home/USER/.var/app/com.valvesoftware.Steam/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored. wlserver: [types/wlr_compositor.c:771] New wlr_surface 0x55a301646a70 (res 0x55a301647360) wlserver: [xwayland/server.c:272] Xserver is ready pipewire: pw_context_connect failed Warning: failed to setup PipeWire, screen capture won't be available vblank: Using timerfd. vulkan: Creating Gamescope nested swapchain with format 44 and colorspace 0 ProtonFixes[1907] INFO: Running protonfixes ProtonFixes[1907] INFO: Running checks ProtonFixes[1907] INFO: All checks successful ProtonFixes[1907] INFO: Using global defaults for "Abiotic Factor" (427410) ProtonFixes[1907] INFO: No global protonfix found for "Abiotic Factor" (427410) wine: using kernel write watches, use_kernel_writewatch 1. fsync: up and running. wine: using kernel write watches, use_kernel_writewatch 1. wine: using kernel write watches, use_kernel_writewatch 1. wine: using kernel write watches, use_kernel_writewatch 1. wine: using kernel write watches, use_kernel_writewatch 1. wine: using kernel write watches, use_kernel_writewatch 1. wine: using kernel write watches, use_kernel_writewatch 1. wine: using kernel write watches, use_kernel_writewatch 1. wine: using kernel write watches, use_kernel_writewatch 1. wine: using kernel write watches, use_kernel_writewatch 1. Setting breakpad minidump AppID = 427410 Steam_SetMinidumpSteamID: Caching Steam ID: 76561198040963151 [API loaded no] wine: using kernel write watches, use_kernel_writewatch 1. wine: using kernel write watches, use_kernel_writewatch 1. [Gamescope WSI] Forcing on VK_EXT_swapchain_maintenance1. Fossilize INFO: Overriding serialization path: "/media/USER/Corsair MP510 NVME/SteamLibrary/steamapps/shadercache/427410/fozpipelinesv6/steamapprun_pipeline_cache". [Gamescope WSI] Forcing on VK_EXT_swapchain_maintenance1. Fossilize INFO: Overriding serialization path: "/media/USER/Corsair MP510 NVME/SteamLibrary/steamapps/shadercache/427410/fozpipelinesv6/steamapprun_pipeline_cache". (zenity:2072): WARNING : 19:08:06.710: atk-bridge: get_device_events_reply: unknown signature

Distro: Debian Sid

DE: KDE Wayland

GPU: AMD 6800xt

CPU: 5800x3D

Monitors: 1080p 144hz and 1080p 60hz

Pipewire is being used and not pulseaudio if that is another factor

Zalaxx commented 1 month ago

I have the same exact problem. I found that native linux game do not have any issue at all (tried Barotrauma, Oxygen Not Included, Rimworld, Europe Universalis IV, Turing Complete, War Thunder, Factorio), but my Windows game all have the error (Cities: Skylines II, Cyberpunk 2077, Timberborn, Factorio via Proton, EU4 via Proton). I have not tried with native steam, only the flatpak version.

Every game is launched with this command: gamescope --mangoapp -f -W 1920 -H 1080 -o 15 -- %command%. Tried with both Proton Experimental and GE-Proton 9-5.

I can press Ok on the two popups and the game will launch, albeit without gamescope. If I add the envrionment variable ENABLE_GAMESCOPE_WSI=0, games also launch, again without gamescope.

I also tried with Genshin Impact (via An Anime Game Launcher), and it worked fine, although mangohud did not show up.

System Details Report

Hardware Information:

Software Information:

LostWarriorr commented 1 month ago

I found that native linux game do not have any issue at all (tried Barotrauma, Oxygen Not Included, Rimworld, Europe Universalis IV, Turing Complete, War Thunder, Factorio), but my Windows game all have the error (Cities: Skylines II, Cyberpunk 2077, Timberborn, Factorio via Proton, EU4 via Proton).

This does appear to be the case. Although, at first I didn't think so since I swear there was some non-native game that worked correctly.

Interestingly Sven-Coop does not have the error popup when using the windows version. Gamescope however still does not initialize correctly.

LostWarriorr commented 1 month ago

Further investigation appears this is a repeat of a long standing issue as referenced in #6 and #138 . So this might actually not be fixed which is somewhat annoying as the steam flatpak works more consistently for me than the native version even if I do have some minor issues with it; its at least more consistent.

LostWarriorr commented 1 month ago

Running gamescope in bottles gives a potentially different error but with more details at what is happening.

Gamescope appears to start correctly on :2 but for some reason gets killed and then the program is obviously unable to use it.

Not sure if this is similar to the issues mentioned above or a different one.

No CAP_SYS_NICE, falling back to regular-priority compute and threads. Performance will be affected. Your Wayland compositor does NOT support wp_presentation/presentation-time which is required for VK_KHR_present_wait and VK_KHR_present_id. Please complain to your compositor vendor for support. Falling back to X11 window with less accurate present wait. xdg_backend: Couldn't create Wayland objects. vulkan: selecting physical device 'AMD Radeon RX 6800 XT (RADV NAVI21)': queue family 1 (general queue family 0) vulkan: physical device supports DRM format modifiers wlserver: [backend/headless/backend.c:67] Creating headless backend vulkan: supported DRM formats for sampling usage: vulkan: AR24 (0x34325241) vulkan: XR24 (0x34325258) vulkan: AB24 (0x34324241) vulkan: XB24 (0x34324258) vulkan: RG16 (0x36314752) vulkan: NV12 (0x3231564E) vulkan: AB4H (0x48344241) vulkan: XB4H (0x48344258) vulkan: AB48 (0x38344241) vulkan: XB48 (0x38344258) vulkan: AB30 (0x30334241) vulkan: XB30 (0x30334258) vulkan: AR30 (0x30335241) vulkan: XR30 (0x30335258) vulkan: Creating Gamescope nested swapchain with format 44 and colorspace 0 wlserver: Using explicit sync when available wlserver: Running compositor on wayland display 'gamescope-0' wlserver: [backend/headless/backend.c:17] Starting headless backend wlserver: Successfully initialized libei for input emulation! wlserver: [xwayland/sockets.c:64] Failed to bind socket @/tmp/.X11-unix/X0: Address already in use wlserver: [xwayland/sockets.c:64] Failed to bind socket @/tmp/.X11-unix/X1: Address already in use wlserver: [xwayland/server.c:107] Starting Xwayland on :2 wlserver: [types/wlr_compositor.c:771] New wlr_surface 0x55ab3aebcfb0 (res 0x55ab3ae984c0) wlserver: [xwayland/server.c:272] Xserver is ready pipewire: pw_context_connect failed Warning: failed to setup PipeWire, screen capture won't be available vblank: Using timerfd. fsync: up and running. wine: RLIMIT_NICE is <= 20, unable to use setpriority safely vulkan: Creating Gamescope nested swapchain with format 44 and colorspace 0 002c:err:wineboot:process_run_key Error running cmd L"C:\windows\system32\winemenubuilder.exe -r" (2). 0088:err:hid:udev_bus_init UDEV monitor creation failed ATTENTION: default value of option vk_khr_present_wait overridden by environment. ATTENTION: default value of option vk_khr_present_wait overridden by environment. ATTENTION: default value of option vk_khr_present_wait overridden by environment. ATTENTION: default value of option vk_khr_present_wait overridden by environment. ATTENTION: default value of option vk_khr_present_wait overridden by environment. 00e0:err:ole:apartment_getclassobject DllGetClassObject returned error 0x80040111 for dll L"C:\windows\system32\ieframe.dll" ATTENTION: default value of option vk_khr_present_wait overridden by environment. 0170:err:module:hacks_init HACK: setting LIBGL_ALWAYS_SOFTWARE. gamescope: children shut down! terminate called without an active exception ATTENTION: default value of option vk_khr_present_wait overridden by environment. (EE) failed to read Wayland events: Broken pipe X connection to :2 broken (explicit kill or server shutdown). X connection to :2 broken (explicit kill or server shutdown). X connection to :2 broken (explicit kill or server shutdown). X connection to :2 broken (explicit kill or server shutdown). XIO: fatal IO error 22 (Invalid argument) on X server ":2" after 135 requests (135 known processed) with 0 events remaining.

navkaran0305 commented 1 month ago

Having a similar issue on Fedora 39/40 while using proton for gnome-bottles to run any graphic rendering apps, as mentioned in the above issue by @LostWarriorr . Programs error out with

err: D3D11SwapChain: Failed to recreate swap chain: -13 err: DXGI: CreateSwapChainForHwnd: Failed to create swap chain

Surprisingly works when switched to x11 session for me

LostWarriorr commented 1 month ago

This is the error I get in an X11 session. Gives a bit more detail at the potential issue.

Screenshot_20240604_105625

LostWarriorr commented 3 weeks ago

@ColinKinloch Can you confirm if this is a general flatpak issue due to pressure-vessel? Or is it due to the broad changes between gamescope/flatpak/proton/wayland upstream combination? It seems like people are using it on the steamdeck just fine for flatpaks such as lutris but not sure if it is using the system libraries or not due to the synchronization issues if the flatpak is different than system.

ColinKinloch commented 3 weeks ago

I'm not sure, as I understand it flatpaked gamescope:

You could try reviving the flathub proton builds or maybe compile proton yourself with out pressure vessel?

Here was my attempt, unfortunately it doesn't build on the flathub CI: https://github.com/flathub/com.valvesoftware.Steam.CompatibilityTool.Proton/pull/81

LostWarriorr commented 3 weeks ago

I'm not sure, as I understand it flatpaked gamescope:

* won't work with steams proton due to pressure vessel

* won't work with steam decks game mode due to a mismatch in gamescope versions

* will work with native Linux steam games

* will work with flatpak apps on steam deck in desktop mode

You could try reviving the flathub proton builds or maybe compile proton yourself with out pressure vessel?

Here was my attempt, unfortunately it doesn't build on the flathub CI: flathub/com.valvesoftware.Steam.CompatibilityTool.Proton#81

Is it actually an issue with pressure-vessel still? On my main system I can't get it to work at all on non-native games. On a laptop lying around I used bottles and was able to get it to work under "caffe".

Using "quick launching" applications (at least I assume) such as the EA App Installer I was able to get a few frames of the installer (on the laptop) in a gamescope instance using proton-ge on bottles before it crashed with no error message that I could see outside of "Gamescope: children shutdown/terminated" or similiar.

There is also a user saying he has it working under heroic with Proton-ge.

Is there a way to get a more detailed log of what is actually happening to see if its still pressure-vessel related?

navkaran0305 commented 3 weeks ago

I've also tested local packages of bottles/lutris with native wine build but it is still giving me the same issues, only moving to x11 session solves them

navkaran0305 commented 5 days ago

Okay so I have found some weird behavior with proton game launching.

If I am booted into the Wayland session and try to run any games (from Bottles or Steam) I get the same issues mentioned before.

However, if I log out of the Wayland session -> log in the x11 session -> log out the x11 session -> log back in wayland session, the games work!!

This does not persist with a reboot and I have to log in and out of x11 session each time the system boots up. I am not familiar with x11 and Wayland's internal working but is there a potential daemon or dependency being exposed by logging into the x11 session that helps to run the game in the Wayland session?

LostWarriorr commented 5 days ago

Okay so I have found some weird behavior with proton game launching.

If I am booted into the Wayland session and try to run any games (from Bottles or Steam) I get the same issues mentioned before.

However, if I log out of the Wayland session -> log in the x11 session -> log out the x11 session -> log back in wayland session, the games work!!

This does not persist with a reboot and I have to log in and out of x11 session each time the system boots up. I am not familiar with x11 and Wayland's internal working but is there a potential daemon or dependency being exposed by logging into the x11 session that helps to run the game in the Wayland session?

I can't even get it to work on X11 at all under steam even native games. PrismLauncher works

I switched backed to XFCE due to my problems with KDE. Fresh Install

I figured I would need it to have smooth frames under X11 but I have found other ways to avoid tearing and microstutter. I still really want gamescope/steam as flatpak to succeed but i feel we are a few years off especially due to the major transitions happening in gamescope currently.