Open konstantinblaesi opened 8 years ago
It doesn't look like that works, but assigning to the SDL dev.
@rcgordon Is it possible? Are there plans to make it possible in the near future?
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.
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, 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.
Togl isn't used in Reborn, btw.
@Plagman, right, I had momentarily forgotten, then was mislead by this part of the terminal output:
gl/togl/glmdisplaydb.cpp 792 InitializeDisplayDB():
@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.
@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 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?
@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 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
@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
Are you guys starting a session using weston or using it trough gnome?
Anything wayland wise started via gdm didn't let me run dota.
I tried with the latest GNOME 3.23 release and it is working. However, fonts don't load properly and use a fallback font.
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 ?
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?
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.
It looks like the Desktop-friendly Fullscreen
mode doesn't work. Borderless Window
mode doesn't have this issue.
After switching modes and restarting the dota 2 client the issue disappeared. Not sure why and how long this will last...
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.
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
@konstantinblaesi does LD_PRELOAD=/path/to/libSDL help as a workaround or do you really need to replace that file?
@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)
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.
@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.
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.
No I don't know a proper way to check, but I get the same output as you.
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.
You can check whether you have a wayland session with loginctl show-session $(loginctl | grep $(whoami) | awk '{print $1}') -p Type
That's not the issue here, I clearly have a wayland session considering I'm running sway, and as viewed in the steam information dump steam is running on xwlc which indicates xwayland (since the steam client does not run natively).
edit: also your command shows "type=tty", probably because I'm not using loginctl but rather runit+elogind and launch sway session from tty. (atleast i think that's how that works).
Manually compiling did not help, but i have discovered some weird behavior. Looking in steam log if i have
/lib/libSDL2-2.0.so.0 preloaded, i get ERROR: ld.so: object '/lib/libSDL2-2.0.so.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
and if i preload /lib32/libSDL2-2.0.so.0, i get ERROR: ld.so: object '/lib32/libSDL2-2.0.so.0' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
So both 64 bit and 32 bit is wrong and therefore both get ignored? I'm unsure how to progress from here.
Not sure if anyone else is as interested as i am but a bit of an update,
Why manually compiling with Wayland support didn't work was because i only compiled for 64bit, but i needed to compile for both 64 bit and cross-compile it for 32 bit and then LD_PRELOADing just the name of the shared library instead of the full path for it to pick up both.
I'll be trying this when I get the time
Yeah, I think Valve pins their own libSDL2 with LD_LIBRARY_PATH, hence why you need LD_PRELOAD. I'm not sure if the pinning makes sense but there's a comment in the steam.sh that it was some bug fix.
Update? Wayland should be able to work without LD_LIBRARY_PATH tomfoolery.
@kisak-valve @Plagman @gdrewb-valve Any update maybe? How is wayland support in the game? Are there any progress?
DOTA2 uses SDL3 now, shipped with the game, for those attempting to replace it.
@icculus So Dota 2 comes with sdl, which is in development? That is, you can say one of the last commits of the source code? It turns out that Wayland has support?
I don't know if wayland is working for everyone, but on fedora 38 with gnome 3 it works fine. I use these start commands to run it on the dGPU SDL_VIDEODRIVER=wayland DRI_PRIME=1 %command%
and according to dota it always uses vulkan.
@icculus So Dota 2 comes with sdl, which is in development? That is, you can say one of the last commits of the source code? It turns out that Wayland has support?
Historically the problem has been that the Steam Runtime doesn't have Wayland support, so when they build SDL against it, it builds without the Wayland backend, so I assume that is happening here too, but I have not checked if this is still true in recent times.
In theory you could replace the libSDL3.so.0 in DOTA2 with one you built from the latest commit to SDL's revision control, but please don't report bugs if doing so causes problems, especially now when SDL3's interfaces are still changing.
SDL_VIDEODRIVER=wayland DRI_PRIME=1 %command%
It's SDL_VIDEO_DRIVER (extra underscore) in SDL3; it likely ignored SDL_VIDEODRIVER and ran under XWayland.
ok with SDL_VIDEO_DRIVER=wayland it still fails
@kisak-valve @gdrewb-valve @Plagman Any update? Will be support of Steam, Dota 2 of native Wayland? Is there work going on in this direction? What exactly is the problem with adding native support?
The problem was solved by the developers, using a few small lines of text in an executable bash startup script. Namely, by adding a hardcoded variable SDL_VIDEO_DRIVER=x11. You can see for yourself. Therefore, the variable in the game launch parameters will simply be ignored. I think that as a short-term solution, it is quite reasonable. But I would like not to use crutches, but full-fledged Wayland support. Let the stable branch of the game and the engine be on X for now, and the one being developed can already be transferred to Wayland and provided for testing to ordinary users. It would be just great! Please, let's develop also in technical terms, and not only in gameplay
Since dota 2 seems to ship libSDL3 (which doesn't seem to be released yet?), maybe they are waiting for that and possibly other developments?
It seems that after a long wait, we have been heard! Added tacit support for Wayland! Simply set the variable in the startup file(dota2.sh) as SDL_VIDEO_DRIVER=wayland and the game will work! (To confirm this, the wayland icon is shown on the icon of the Dota window in the taskbars) I ask you to test it and write here about the results Although the variable is still set to x11 by default
Update from 02/16/2024. After today's patch, the game does not launch on Wayland. It's just that nothing appears after launch. Previously, the game was launched, albeit with some nuances:
Fedora 40 using SDL_VIDEO_DRIVER=wayland DRI_PRIME=1 %command%
works fine! (only steam client has a habit of freezing and suspend to RAM ruins graphics quality and performance)
Fedora 40 using
SDL_VIDEO_DRIVER=wayland DRI_PRIME=1 %command%
works fine! (only steam client has a habit of freezing and suspend to RAM ruins graphics quality and performance)
Setting SDL_VIDEO_DRIVER=wayland
is pointless because it will be reset back to x11
in game/dota.sh
:
# Remove when Source 2 supports Wayland
if [ "$UNAME" == "Linux" ]; then
export SDL_VIDEO_DRIVER=x11
fi
You can, however, edit that file to enforce the use of Wayland. Which - last time I checked - simply crashes the game.
Replying to https://github.com/ValveSoftware/Dota-2/issues/999#issuecomment-2135325101
I modified the script and swaymsg confirmed that it indeed was able to run with Wayland. Didn't encounter any crashes during the game.
With edited dota.sh:
#296: con "Dota 2" (xdg_shell, pid: 1484955, app_id: "dota2")
Without:
#297: con "Dota 2" (xwayland, pid: 1499822, instance: "dota2", class: "dota2", X11 window: 0x6E00238)
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.