Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateSwapchain fails for native linux games in flatpak steam #199

Open
LostWarriorr opened this issue May 30, 2024 · 20 comments
Open

CreateSwapchain fails for native linux games in flatpak steam #199

LostWarriorr opened this issue May 30, 2024 · 20 comments

Comments

@LostWarriorr
Copy link

LostWarriorr commented May 30, 2024

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
Copy link

Zalaxx commented May 30, 2024

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:

  • Memory: 16.0 GiB
  • Processor: AMD Ryzen™ 5 5600H with Radeon™ Graphics × 12
  • Graphics: AMD Radeon™ Graphics
  • Graphics 1: AMD Radeon™ RX 6600M

Software Information:

  • OS Name: Fedora Linux 40.20240529.0 (Silverblue)
  • GNOME Version: 46
  • Windowing System: Wayland
  • Kernel Version: Linux 6.8.10-300.fc40.x86_64

@LostWarriorr
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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
Copy link

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
Copy link
Author

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

Screenshot_20240604_105625

@LostWarriorr LostWarriorr changed the title Gamescope "Hooking" fails for certain games Gamescope CreateSwapchain fails for non-native linux games. Jun 4, 2024
@LostWarriorr
Copy link
Author

LostWarriorr commented Jun 9, 2024

@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
Copy link
Collaborator

ColinKinloch commented Jun 10, 2024

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

@LostWarriorr
Copy link
Author

LostWarriorr commented Jun 10, 2024

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
Copy link

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
Copy link

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
Copy link
Author

LostWarriorr commented Jul 2, 2024

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.

@navkaran0305
Copy link

IT'S FIXED!!!

I got an update 3 days ago for Nvidia drivers v555.58.02 on Fedora KDE-spin and it fixed all graphics related issues for me. I have been testing multiple games since the update and Steam and local copies of multiple games work great on Wayland session

I believe @LostWarriorr has an AMD GPU, so I cannot chalk it up to simple driver issues. Maybe there is something to do with the GPU configuration on KDE?

@rowbawts
Copy link

IT'S FIXED!!!

I got an update 3 days ago for Nvidia drivers v555.58.02 on Fedora KDE-spin and it fixed all graphics related issues for me. I have been testing multiple games since the update and Steam and local copies of multiple games work great on Wayland session

I believe @LostWarriorr has an AMD GPU, so I cannot chalk it up to simple driver issues. Maybe there is something to do with the GPU configuration on KDE?

Are you saying what is fixed is the complaint from the original issue? If so I'd like to mention I am still encountering this issue on AMD.

@navkaran0305
Copy link

IT'S FIXED!!!
I got an update 3 days ago for Nvidia drivers v555.58.02 on Fedora KDE-spin and it fixed all graphics related issues for me. I have been testing multiple games since the update and Steam and local copies of multiple games work great on Wayland session
I believe @LostWarriorr has an AMD GPU, so I cannot chalk it up to simple driver issues. Maybe there is something to do with the GPU configuration on KDE?

Are you saying what is fixed is the complaint from the original issue? If so I'd like to mention I am still encountering this issue on AMD.

Yes, the difference is I am on an Nvidia GPU and the recent driver update fixed all the CreateSwapChainForHwnd: Failed to create swap chain issues mentioned in this thread. (More details about my issue here bottlesdevs/Bottles#3268 )

@LostWarriorr also has an AMD GPU so I can't just blame the drivers for this issue. Seems to be an issue in the vein of Proton/Wayland combination but it's just a rough guess for now

Also will it be possible for you to try running the games in the x11 session provided by your distro? It was a workaround I used to play games before the update fixed this issue for me

@LostWarriorr
Copy link
Author

IT'S FIXED!!!
I got an update 3 days ago for Nvidia drivers v555.58.02 on Fedora KDE-spin and it fixed all graphics related issues for me. I have been testing multiple games since the update and Steam and local copies of multiple games work great on Wayland session
I believe @LostWarriorr has an AMD GPU, so I cannot chalk it up to simple driver issues. Maybe there is something to do with the GPU configuration on KDE?

Are you saying what is fixed is the complaint from the original issue? If so I'd like to mention I am still encountering this issue on AMD.

Yes, the difference is I am on an Nvidia GPU and the recent driver update fixed all the CreateSwapChainForHwnd: Failed to create swap chain issues mentioned in this thread. (More details about my issue here bottlesdevs/Bottles#3268 )

@LostWarriorr also has an AMD GPU so I can't just blame the drivers for this issue. Seems to be an issue in the vein of Proton/Wayland combination but it's just a rough guess for now

Also will it be possible for you to try running the games in the x11 session provided by your distro? It was a workaround I used to play games before the update fixed this issue for me

I've switched to a clean install of XFCE on Debian Sid and it doesn't even work for me anymore on native games so its not just a wayland issue.

I'm honestly just going to chalk it up to the major transition in gamescope that is currently happening.

@navkaran0305
Copy link

I've switched to a clean install of XFCE on Debian Sid and it doesn't even work for me anymore on native games so its not just a wayland issue.

I'm honestly just going to chalk it up to the major transition in gamescope that is currently happening.

Most probably. I had vastly different experiences with different distros and configurations. Some distros work great, some need to have the game run the second time and the one I'm using now (Fedora-KDE) had this weird issue resolved out of the blue by driver updates

@Eoin-ONeill-Yokai
Copy link

I'm having this as well on flatpak steam w/ gamescope in a sway session.

Also will it be possible for you to try running the games in the x11 session provided by your distro? It was a workaround I used to play games before the update fixed this issue for me

Am I misunderstanding something? I believed that gamescope only supported Wayland sessions. Has this changed recently?

@ColinKinloch ColinKinloch changed the title Gamescope CreateSwapchain fails for non-native linux games. CreateSwapchain fails for native linux games in flatpak steam Sep 16, 2024
@FaridZelli
Copy link

RDNA2 user here, I was previously using a ProtonGE runner which I had copied over to compatibilitytools.d
Switching to the ProtonGE Flatpak solved the CreateSwapchain error for me

@LostWarriorr
Copy link
Author

LostWarriorr commented Sep 16, 2024

RDNA2 user here, I was previously using a ProtonGE runner which I had copied over to compatibilitytools.d Switching to the ProtonGE Flatpak solved the CreateSwapchain error for me

The issue with the flatpak Proton GE is it is no longer receiving updates and is deprecated.

EDIT: Appears someone else picked up the project and is updating it again. Good to know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants