Dota-2 icon indicating copy to clipboard operation
Dota-2 copied to clipboard

Dota on wayland with SDL_VIDEO_DRIVER=wayland

Open konstantinblaesi opened this issue 9 years ago • 55 comments

Is it possible to run dota natively on wayland by exporting SDL_VIDEODRIVER=wayland ? I get these errors and the game doesn't start:

Unable to create dummy window for GLMDisplayDB.gl/togl/glmdisplaydb.cpp 792 InitializeDisplayDB(): Unable to create dummy window for GLMDisplayDB.

konstantinblaesi avatar Aug 21 '16 13:08 konstantinblaesi

It doesn't look like that works, but assigning to the SDL dev.

gdrewb-valve avatar Aug 21 '16 16:08 gdrewb-valve

@rcgordon Is it possible? Are there plans to make it possible in the near future?

konstantinblaesi avatar Aug 30 '16 19:08 konstantinblaesi

From what I can gather over at the togl repo, togl assumes it can enumerate displays with glx stuff, but glx is not implicitly available with wayland, since it's using egl instead of glx for those kind of things. I could be wildly wrong here as the referenced function does not exist on github, but that's the general feel of what is there.

Tele42 avatar Sep 01 '16 15:09 Tele42

The particular call failing here is SDL_CreateWindow so the failure is inside of SDL. I believe the issue is that the SDL shipped with Dota doesn't have Wayland support but I'm not sure if that's an oversight or a limitation of the Steam runtime, thus this is assigned to the SDL dev to work out.

gdrewb-valve avatar Sep 01 '16 18:09 gdrewb-valve

@gdrewb-valve, thanks for the insight. With that information, I got the game running in weston (with SDL_VIDEODRIVER=wayland).

I had to remove the game-bundled libSDL2 and built libSDL2-2.0.4 with wayland and gles among the other common build options. As always, I'm using Gentoo linux w/o the steam runtime.

This confirms your hypothesis that the steam runtime and/or .../common/dota 2 beta/game/bin/linuxsteamrt64/libSDL2-2.0.so.0 is missing wayland support.

As a side note, my wayland test hardware is hopelessly underpowered for this task and I can not do a comprehensive test, but the main menu and watching a match work.

Tele42 avatar Sep 01 '16 21:09 Tele42

Togl isn't used in Reborn, btw.

Plagman avatar Sep 02 '16 01:09 Plagman

@Plagman, right, I had momentarily forgotten, then was mislead by this part of the terminal output:

gl/togl/glmdisplaydb.cpp 792 InitializeDisplayDB():

Tele42 avatar Sep 02 '16 01:09 Tele42

@Tele42 is STEAM_RUNTIME=0 required? If yes, can you explain how to do this on gentoo? I use gentoo as well, but with STEAM_RUNTIME=0 steam crashes because of missing libraries. If you have a list of libraries that need abi_x86_32 USE that would be nice.

konstantinblaesi avatar Sep 02 '16 21:09 konstantinblaesi

@elxa, STEAM_RUNTIME=0 is most likely is not required, but loading a version of libSDL2-2.0.so.0 that has wayland support built into it is required.

If you want to use steam without the steam runtime on Gentoo, set USE="-steamruntime" in the various packages from the overlay. If that is not available, switch to the steam-overlay package overlay. This will pull in the needed dependencies. NOTE: Using steam without the steam runtime means that all dependency issues have to be handled by the package maintainer, not valve.

Tele42 avatar Sep 02 '16 21:09 Tele42

@Tele42 how do you load that library? I was already using the steam-overlay and just rebuilt with USE=-steamruntime, but that didn't make a difference. In ~/steam/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64 I created this symlink:

libSDL2-2.0.so.0 -> /usr/lib64/libSDL2-2.0.so.0

Do you LD_PRELOAD it ?

media-libs/libsdl2-2.0.4::gentoo was built with the following:
USE="X dbus gles joystick opengl pulseaudio sound threads udev video wayland xinerama -alsa (-altivec) (-custom-cflags) (-fusionsound) -haptic -nas -oss -static-libs -tslib -xscreensaver" ABI_X86="32 64 -x32" CPU_FLAGS_X86="mmx sse sse2 -3dnow"
CFLAGS="-pipe -march=native -O2"
CXXFLAGS="-pipe -march=native -O2"

I am still getting the same error from the first post. Do you think me using gnome 3 instead of pure wayland might complicate things?

konstantinblaesi avatar Sep 02 '16 22:09 konstantinblaesi

@elxa, on my wayland test system, the system libSDL2-2.0.so.0 is the only one available on that system, so the dynamic loader only had one choice to pick from.

What do you mean by "using gnome 3 instead of pure wayland?" There is no such thing as "pure wayland" as it is a protocol spec, there is no centralized required wayland server software. If the Gnome 3 session is running as a wayland compositor, then it should not be a complication. If the Gnome 3 session is running as the common X11 compositor, then there's nothing for libSDL's wayland backend to talk to.

Tele42 avatar Sep 02 '16 22:09 Tele42

@Tele42 I am running a wayland gnome (3.20) session and was wondering if Xwayland could confuse dota. I added LD_DEBUG=libs to dotas startup options and despite steam saying

STEAM_RUNTIME is disabled by the user

dota seems to load the libSDL from the runtime directory?

      5723: find library=libSDL2-2.0.so.0 [0]; searching
      5723:  search path=/home/konstantin/steam/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64        (RPATH from file /home/konstantin/steam/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64/dota2)
      5723:   trying file=/home/konstantin/steam/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64/libSDL2-2.0.so.0

I created this symlink though, so it shouldn't matter?

/home/konstantin/steam/steamapps/common/dota 2 beta/game/bin/linuxsteamrt64/libSDL2-2.0.so.0' -> /usr/lib64/libSDL2-2.0.so.0

konstantinblaesi avatar Sep 02 '16 23:09 konstantinblaesi

@Tele42 I just made tests from weston/wayland instead of gnome/wayland and it worked! All I needed (as you discovered already) was to swap the libSDL2 build bundled with the game (libSDL2-2.0.so.0 in .../steamapps/common/dota 2 beta/game/bin/linuxsteamrt64 ) against my system libSDL2, which was built as mentioned in https://github.com/ValveSoftware/Dota-2/issues/999#issuecomment-244499081 . When running in gnome/wayland the same steps that work in weston/wayland produce the error message mentioned in https://github.com/ValveSoftware/Dota-2/issues/999#issue-172321163 and a popup with the same error message as displayed in the terminal (The game doesn't start). Until now I was running dota with my IGPU (i7-6700K, Intel® HD Graphics 530, Skylake), but I have an AMD RX 480 waiting to get tested, too. On my IGPU I get stable 59fps (I set "fps_max 60") with gnome/X11. On weston/wayland I got only 30-50fps with and without SDL_VIDEODRIVER=wayland . Now I wonder

  • why I loose that much fps on weston/wayland
  • why I can't run dota on gnome/wayland

konstantinblaesi avatar Sep 03 '16 11:09 konstantinblaesi

Are you guys starting a session using weston or using it trough gnome?

BernardoGO avatar Nov 10 '16 02:11 BernardoGO

Anything wayland wise started via gdm didn't let me run dota.

konstantinblaesi avatar Nov 10 '16 21:11 konstantinblaesi

I tried with the latest GNOME 3.23 release and it is working. However, fonts don't load properly and use a fallback font.

mastercoms avatar Jan 04 '17 23:01 mastercoms

Finally got it working on Fedora 28 From a terminal execute as the user running your steam games:

# Backup the libSDL shipped by steam
mv ~/.steam/root/steamapps/common/dota\ 2\ beta/game/bin/linuxsteamrt64/libSDL2-2.0.so.0 ~/.steam/root/steamapps/common/dota\ 2\ beta/game/bin/linuxsteamrt64/libSDL2-2.0.so.0.backup
# Symlink dota 2 libSDL to the system level libSDL
ln -s /lib64/libSDL2-2.0.so.0 ~/.steam/root/steamapps/common/dota\ 2\ beta/game/bin/linuxsteamrt64/libSDL2-2.0.so.0

In the steam client set launch options to SDL_VIDEODRIVER=wayland %command%

Question to dota 2 devs: Can you enable wayland support in the shipped libSDL ?

konstantinblaesi avatar May 07 '18 20:05 konstantinblaesi

Another Fedora 28 user reported that he didn't have to do any of the above steps to make it work. I am now wondering whether libSDL wasn't updated by the steam client on my machine?

konstantinblaesi avatar May 08 '18 07:05 konstantinblaesi

On Fedora 28 using Gnome 3.28: When using Alt + Tab to switch focus to another window I cannot get the focus back to Dota 2. When Dota 2 is focused I hear the In-Game sounds, but I don't see anything visually from the client.

konstantinblaesi avatar May 08 '18 16:05 konstantinblaesi

It looks like the Desktop-friendly Fullscreen mode doesn't work. Borderless Window mode doesn't have this issue.

konstantinblaesi avatar May 08 '18 16:05 konstantinblaesi

After switching modes and restarting the dota 2 client the issue disappeared. Not sure why and how long this will last...

konstantinblaesi avatar May 08 '18 16:05 konstantinblaesi

When will you start shipping libSDL with wayland support enabled? A recent dota update once again killed my symlink to the Fedora 29 system level libSDL which has wayland support :( I have been playing using native wayland (no xwayland) without issues for months now. The only thing that's messed up is the steam overlay, but I can (mostly) live with that.

konstantinblaesi avatar Aug 01 '18 17:08 konstantinblaesi

I'm to be honest wondering whether Steam overlay even can work with Wayland. With Wayland there's afaik stricter ownership of surfaces and I wouldn't take it for granted Steam can draw on top of fullscreen apps

nanonyme avatar Sep 05 '18 15:09 nanonyme

@konstantinblaesi does LD_PRELOAD=/path/to/libSDL help as a workaround or do you really need to replace that file?

nanonyme avatar Sep 05 '18 15:09 nanonyme

@nanonyme LD_PRELOAD=/lib64/libSDL2-2.0.so.0 works, too. I've updated my dota 2 start options to LD_PRELOAD=/lib64/libSDL2-2.0.so.0 SDL_VIDEODRIVER=wayland DRI_PRIME=1 %command% (intel iGPU + amd dGPU)

konstantinblaesi avatar Sep 15 '18 16:09 konstantinblaesi

I'm having this issue despite preloading the required libSDL2 system library, not sure why my issue was closed since the issue is referenced here as "use this workaround" when i explicitly pointed out that the workaround did not work.

simvux avatar Jan 26 '19 22:01 simvux

@AlmightyFloppyFish Unlikely, but what if your distributions libSDL is compiled without wayland support? Probably not the right way to check but does the command strings /lib/libSDL2-2.0.so.0 | grep SDL_VIDEODRIVER have a non empty result? I am using Fedora 29 with wayland and dota 2 still works perfectly.

konstantinblaesi avatar Jan 26 '19 22:01 konstantinblaesi

strings /lib64/libSDL2-2.0.so.0 | grep SDL_VIDEODRIVER results in the output SDL_VIDEODRIVER

You sure this is sufficent to check? SDL2 also has Mir support iirc which would probably include that string even if i wasnt compiled with wayland support.

simvux avatar Jan 26 '19 22:01 simvux

No I don't know a proper way to check, but I get the same output as you.

konstantinblaesi avatar Jan 26 '19 22:01 konstantinblaesi

I remembered that I myself have written some SDL2 applications but in Rust, tried to run them and got: thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "wayland not available"

So it does appear that my libSDL2 wasn't packaged with wayland support... Gonna try to manually compile it when i get the time, i'll update once i have in case others run into the same issue.

simvux avatar Jan 26 '19 23:01 simvux