ValveSoftware / csgo-osx-linux

Counter-Strike: Global Offensive
http://counter-strike.net
787 stars 70 forks source link

Segfault when using SDL_VIDEO_DRIVER=wayland environment variable #3359

Open Dekomoro opened 1 year ago

Dekomoro commented 1 year ago

Your system information

Please describe your issue in as much detail as possible:

Counter Strike 2 Segfaults when running with SDL3's new environment variable for running games with wayland.

Steps for reproducing this issue:

  1. put SDL_VIDEO_DRIVER=wayland %command% in your launch options
  2. run the game
sameer commented 1 year ago

I see Plat_CreateWindow: Could not create SDL window: wayland not available in the logs. But it's not obvious what causes this. There may be a library missing that is not pulled in by sniper

nyabinary commented 1 year ago

Valve should get on this tbh since GNOME is considering dropping x11 lol

SopaDeMacaco-UmaDelicia commented 1 year ago

Looks like they turned off wayland support altogether. Shame.

Root-Core commented 1 year ago

It is not segfaulting on my machine, but it also doesn't work. It is a missing feature, unfortunately.

Looks like they turned off wayland support altogether. Shame.

I wonder it they did that, because the Steam overlay is not compatible with Wayland. If that is the case, they could at least allow it as an opt-in.

EDIT: They actually overwrite the env variable.


If I comment the line out, I am presented with an error message.

image

Etaash-mathamsetty commented 9 months ago

Source 2 needs to add Wayland support to their vulkan renderer probably

CNR0706 commented 9 months ago

Just wanted to mention that the game works perfectly fine for me using native Wayland.

I modified the SDL_VIDEO_DRIVER=x11 line in cs2.sh to SDL_VIDEO_DRIVER=wayland and it just works.

--- System Specs --- 6700XT 5800X3D 32 GiBs DDR4 3600MT/s CL16 dual-rank Mesa 24.1 AMDVLK 2024.Q1.1-1 Kernel 6.8-rc4 Hyprland openSuSE Tumbleweed

Etaash-mathamsetty commented 9 months ago

Replying to https://github.com/ValveSoftware/csgo-osx-linux/issues/3359#issuecomment-1939233712

Sidenote: It might be a good idea to try on RADV as well and maybe even switch to it. Using amdvlk guarantees a crash in many games

CNR0706 commented 9 months ago

I use both ;)

AMDVLK and RADV both work beautifully in CS:2. AMDVLK was actually a lot faster than RADV before the 'A call to arms' update.

I just use whatever performs better at the moment.

tralph3 commented 9 months ago

@CNR0706 I just tried setting the env variable but it just crashes.

By the way, could you ensure the game is actually running through Wayland? With the game open, run hyprctl clients, look for the CS2 entry and make sure you see xwayland: 0.

CNR0706 commented 9 months ago

hyprctl says xwayland: 0

SopaDeMacaco-UmaDelicia commented 9 months ago

Just wanted to mention that the game works perfectly fine for me using native Wayland.

I modified the SDL_VIDEO_DRIVER=x11 line in cs2.sh to SDL_VIDEO_DRIVER=wayland and it just works.

--- System Specs --- 6700XT 5800X3D 32 GiBs DDR4 3600MT/s CL16 dual-rank Mesa 24.1 AMDVLK 2024.Q1.1-1 Kernel 6.8-rc4 Hyprland openSuSE Tumbleweed

Thanks for the great news, it works great!

I want to add that DOTA 2 also works in wayland-native mode! 🎉

tralph3 commented 9 months ago

I am using mesa 23, since 24 hasn't released yet on Arch Linux. Could this be the reason it crashes on my system?

SopaDeMacaco-UmaDelicia commented 9 months ago

I am using mesa 23, since 24 hasn't released yet on Arch Linux. Could this be the reason it crashes on my system?

I also use mesa 23.3 on arch and cs2 works in wayland, but I use KDE. Open steam in terminal and check the output when starting cs2 for clues.

CNR0706 commented 9 months ago

Btw. the game will most likely crash if you move your mouse / use your keyboard while it is frozen (for example in a loading screen) this also happens with Source and GoldSrc titles that run in Wayland.

To avoid crashes don't touch your mouse and keyboard while the game is loading something.

SopaDeMacaco-UmaDelicia commented 9 months ago

Btw. the game will most likely crash if you move your mouse / use your keyboard while it is frozen (for example in a loading screen) this also happens with Source and GoldSrc titles that run in Wayland.

To avoid crashes don't touch your mouse and keyboard while the game is loading something.

Doesn't happen on KDE. But I have another bug, greyed out window that is fixed by alt-tabbing. Also HiDPI (I have a 4k monitor) doesn't work for fullscreen windowed, only for fullscreen and sometimes fullscreen is bugged that game window is bigger than my screen. Had to lower my scaling from 175 to 100, switch from fullscreen to windowed and back and then switch scaling back to 175. 🙂

fudgeu commented 9 months ago

Just wanted to mention that the game works perfectly fine for me using native Wayland.

I modified the SDL_VIDEO_DRIVER=x11 line in cs2.sh to SDL_VIDEO_DRIVER=wayland and it just works.

For what its worth, can confirm this works on Nvidia too (proprietary driver 545)! Running on Hyprland/wlroots, 4K@120hz just fine.

With a Nvidia card, CS2 ran under xwayland, but with insane stuttering and visual rubber banding. Running natively under Wayland so far seems perfect, and I'm not getting any crashes w/ input on loading screens or otherwise.

Not sure if its because I have scaling on, but the game did start super zoomed in the first time, which was fixed easily just by toggling windowed/fullscreen.

SopaDeMacaco-UmaDelicia commented 9 months ago

Not sure if its because I have scaling on, but the game did start super zoomed in the first time, which was fixed easily just by toggling windowed/fullscreen.

Yeah, fullscreen is kinda broken on launch and hi-dpi doesn't work in windowed mode.

Also cs2 works perfectly with a native pipewire backend. SDL_AUDIO_DRIVER=pipewire