ValveSoftware / csgo-osx-linux

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

can no longer run cs2 under wayland with the latest update 4/10/2023 #3402

Closed polluxau closed 1 year ago

polluxau commented 1 year ago

Your system information

Please describe your issue in as much detail as possible:

Describe what you expected should happen and what did happen. Please link any large pastes as a Github Gist.

Steps for reproducing this issue:

  1. install cs2
  2. try to launch cs2 under wayland kwin on the latest kde plasma desktop
  3. closes after a wayland shortcut comes up for a few seconds

⚠️⚠️WE ADVICE USERS TO USE THIS AS A LAST RESORT BEFORE TRYING EVERYTHING ELSE TO GET CS2 WORKING⚠️⚠️

⚠️⚠️WHEN THIS IS FIXED, REMOVE THESE LAUNCH COMMANDS TO RUN CS PROPERLY UNDER WAYLAND ⚠️⚠️

For Wayland to work use this environment variable

SDL_VIDEO_DRIVER=x11 %command%

Or this one aswell

WAYLAND_DISPLAY= %command%

This will force sdl into thinking that cs2 or dota 2 is in x11

If you're using flatpak steam just disable Wayland socket in flatseal

Etaash-mathamsetty commented 1 year ago

Segfault is a red herring here - there's a bug in libsdl3 where a return value from fgets is not checked for NULL, and passed to strtol, which causes segfault, here: libsdl-org/SDL@f30392d/src/video/wayland/SDL_waylandmessagebox.c#L96

But this procedure is just trying to display message (at least in my case)

CreateSwapChain(): FailedToCreate VkSurfaceKHR

I never played with wayland/vulkan APIs, so not sure how to debug it, but all in all, removing the cause of segfault didn't help much in my case

with the fix, the segfault moved to segfault at 0 ip 00007ffa51377646 sp 00007fff7683f4b0 error 6 in libtier0.so[7ffa512bf000+2f3000] likely on CPU 11 (core 3, socket 0) rather than libc6

robertswiecki commented 1 year ago

I made the PR, could you check if it's correct?

It solves the immediate problem, though IMO either run_zenity() should fail, or fgets() should succeed.

Edit: ok, I see it in strace, zenity fails with exit_code=127 if it doesn't have access to some libs, which are not there in the pressure-vessel namespace of steamrt. And run_zenity() fails only with exit_code>129 (execve error here). Looking at the code, it "should probably" check if zenity returned 0 or not, as that's what zenity --version should return, but I didn't check what other callers to run_zenity expect.

14709 writev(2, [{iov_base="zenity", iov_len=6}, {iov_base=": ", iov_len=2}, {iov_base="symbol lookup error", iov_len=19}, {iov_base=": ", iov_len=2}, {iov_base="/lib/x86_64-linux-gnu/libgtk-3.so.0", iov_len=35}, {iov_base=": ", io
v_len=2}, {iov_base="undefined symbol: pango_font_family_get_face", iov_len=44}, {iov_base="", iov_len=0}, {iov_base="", iov_len=0}, {iov_base="\n", iov_len=1}], 10 <unfinished ...>
14709 <... writev resumed>)             = 111
14709 exit_group(127 <unfinished ...>
danvilar commented 1 year ago

I just updated the game, and it is working on wayland again.

polluxau commented 1 year ago

I just updated the game, and it is working on wayland again.

Yep same here

polluxau commented 1 year ago

I just updated the game, and it is working on wayland again.

Yep same here

I shall close this if no one else has similar issues

Cruleo commented 1 year ago

Can verify that it works again. Can also confirm that SDL_VIDEO_DRIVER=wayland does not crash the game anymore though, possibly ignored?

rojanDinc commented 1 year ago

So with this new update we don't have to specify X11 as video driver anymore as cs2 is using (prefering) X11 over wayland. Ref: https://www.counter-strike.net/news/updates

robertswiecki commented 1 year ago

More likely 'ignoring' wayland :). With

SDL_VIDEO_DRIVER=wayland DISPLAY=

it doesn't work. We need something like SDL_VIDEO_DRIVER_FOR_REAL now :)

polluxau commented 1 year ago

More likely 'ignoring' wayland :). With

SDL_VIDEO_DRIVER=wayland DISPLAY=

it doesn't work.

so cs2 is still running in x11 under wayland we just dont have to use the launch command anymore? welp not closing this till wayland is enabled by default for wayland (no cheating valve)

rojanDinc commented 1 year ago

Before this update I was able to run 4:3 ratio with 144hz now with X11 it only supports up to 75hz :/

robertswiecki commented 1 year ago

so cs2 is still running in x11 under wayland we just dont have to use the launch command anymore?

Yup, it forces x11 in cs2.sh

# Remove when Source 2 supports Wayland
export SDL_VIDEO_DRIVER=x11
polluxau commented 1 year ago

More likely 'ignoring' wayland :). With SDL_VIDEO_DRIVER=wayland DISPLAY= it doesn't work.

so cs2 is still running in x11 under wayland we just dont have to use the launch command anymore?

so cs2 is still running in x11 under wayland we just dont have to use the launch command anymore?

Yup, it forces x11 in cs2.sh

# Remove when Source 2 supports Wayland
export SDL_VIDEO_DRIVER=x11

guess its just temporary for now

vaxerski commented 1 year ago

I'd still close this issue, as it's about being unable to run cs2, which is now fixed, and open another one for native Wayland support.

MichaelDeets commented 1 year ago

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

This was an issue with the libsdl2 library CS:GO shipped. It was fixed with the git version of libsdl2 (provided in official releases since). You just had to preload the libsdl2 git version, and 8KHz would run perfect. You can read more about it here.

Before the libsdl2 update, I would just use m_rawinput "0", which had its own issues, but was just about "usable".

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

Why was this disliked? It was a snippet directly from cs2.sh, which I'd assume would take priority over envvars in the launch options, meaning SDL_VIDEO_DRIVER=wayland in the launch options would start CS2 but it was actually using SDL_VIDEO_DRIVER=x11

The comment I'm replying to is completely correct.

Etaash-mathamsetty commented 1 year ago

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

FYI ... CS2 uses SDL3 not SDL2. The raw input stuff you are talking about likely doesn't apply, since it has probably been long fixed

MichaelDeets commented 1 year ago

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

FYI ... I was replying to someone talking about CS:GO, even said "CS:GO" in my comment, and linked to a git issue for CS:GO.

aarshparashar commented 1 year ago

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

FYI ... CS2 uses SDL3 not SDL2. The raw input stuff you are talking about likely doesn't apply, since it has probably been long fixed

SDL3? Really? How do you know? Btw is it still possible to run it natively with Wayland? Can someone guide me?

pseudophia commented 1 year ago

My system: Ubuntu 20.04 & Quadro T1000 Mobile Card.

I had an issue where the shaders did not work properly so the game was all bright and white: image https://ibb.co/gdH7cYS

I solved this by installing: https://developer.nvidia.com/vulkan-driver

and to install it I needed to disable Nouveau: https://docs.nvidia.com/ai-enterprise/deployment-guide-vmware/0.1.0/nouveau.html

Then I added -vulkan -autoconfig to the launch options in steam/cs2

WARNING: Because the VCard I have is not really used for gaming, the fan went off like crazy. I believe that it is recommended to have at least 6GB VRAM but in my case I had 4VRAM.

robertswiecki commented 1 year ago

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

FYI ... CS2 uses SDL3 not SDL2. The raw input stuff you are talking about likely doesn't apply, since it has probably been long fixed

SDL3? Really? How do you know? Btw is it still possible to run it natively with Wayland? Can someone guide me?

I don't think so - I tried compiling my own SDL3, enabling all relevant options, but it still doesn't work. I suspect that either

a). support for wayland in SDL3 is not yet fully complete b). there're some hard-coded X11isms inside CS2 Linux code

spazziale commented 10 months ago

Yup, it forces x11 in cs2.sh

# Remove when Source 2 supports Wayland
export SDL_VIDEO_DRIVER=x11

Can it be removed manually or will anticheat ban me?

robertswiecki commented 10 months ago

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

Unlikely ban - bans are rather for known bad behavior (based on analysis of loaded libraries and such).

But it simply doesn't seem to work (vulkan surface creation problems) - I didn't play with it much but it's not as easy as with CSGO where it was possible to LD_PRELOAD sth.