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

Steel Storm Burning Retribution demo: can crash with BadWindow, workaround: SDL12COMPAT_ALLOW_SYSWM=0 #290

Closed
smcv opened this issue May 19, 2023 · 10 comments
Milestone

Comments

@smcv
Copy link
Contributor

smcv commented May 19, 2023

To reproduce:

  • Ubuntu 22.04, NVIDIA GPU with default proprietary driver v510.108.03, default Ubuntu desktop (modified GNOME) in either Xorg or Wayland mode
  • Run Steam (I'm using the client beta, if it matters)
  • Install the free demo of https://store.steampowered.com/app/96200/Steel_Storm_Burning_Retribution/ (full game not tested)
  • Run the game with legacy SDL 1.2 (I used the version from the 'scout' Steam Runtime, version 1.2.15-5+steamrt1.2)
  • Repeat with sdl12-compat in the LD_LIBRARY_PATH (I used a modified Steam Runtime replacing its bundled legacy SDL 1.2 with a backport of 1.2.62, based on 1.2.62-1 in Debian experimental)
  • Repeat with sdl12-compat, and SDL12COMPAT_ALLOW_SYSWM=0 additionally in the environment

Expected result: all runs succeed

Actual result:

  • legacy SDL 1.2: OK
  • sdl12-compat, no workarounds: crashes, output below
  • sdl12-compat, SDL12COMPAT_ALLOW_SYSWM=0: OK
ERROR: ld.so: object '/home/desktop/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
Game is Steel-Storm using base gamedir gamedata
Steel-Storm Linux 17:34:16 Jun 25 2013 11958M release
Current nice level is below the soft limit - cannot use niceness
Playing shareware version.
Skeletal animation uses SSE code path
DPSOFTRAST available (SSE2 instructions detected)
Failed to init SDL joystick subsystem: Failed loading udev_device_get_action: /home/desktop/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so: undefined symbol: _udev_device_get_action
execing quake.rc
execing default.cfg
execing config.cfg
couldn't exec autoexec.cfg
Client using an automatically assigned port
Client opened a socket on address 0.0.0.0:0
Linked against SDL version 1.2.14
Using SDL library version 1.2.62
This XPM's palette is either huge or idiotically unoptimized. It's key size is 2
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: NVIDIA GeForce GTX 1080/PCIe/SSE2
GL_VERSION: 4.6.0 NVIDIA 510.108.03
vid.support.arb_multisample 1
vid.support.gl20shaders 1
NOTE: requested 1x AA, got 0x AA
Video Mode: fullscreen 1920x1080x32x0.00hz
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  18 (X_ChangeProperty)
  Resource id in failed request:  0x0
  Serial number of failed request:  353
  Current serial number in output stream:  354
@smcv
Copy link
Contributor Author

smcv commented May 19, 2023

This appears to be a game based on darkplaces (modified Quake).

The same versions work well on a different test machine with: Debian 12 prerelease, AMD vega10, Mesa; and either GNOME (Wayland) or Xfce (Xorg). At this stage I'm unsure whether it's Ubuntu vs Debian or NVIDIA vs AMD/Mesa that is significant.

@smcv
Copy link
Contributor Author

smcv commented May 19, 2023

For an apples-to-apples comparison, I booted both test machines into Debian 11 stable with GNOME (Xorg) and the same game works fine there; so this might be Ubuntu-specific or NVIDIA-driver-version-specific.

I won't be able to test Ubuntu 22.04 on AMD or Debian 12 on NVIDIA until I've installed the relevant operating systems, which will take a while.

@smcv smcv changed the title Steel Storm Burning Retribution demo: can crash with BadWindow without SDL12COMPAT_ALLOW_SYSWM=0 Steel Storm Burning Retribution demo: can crash with BadWindow, workaround: SDL12COMPAT_ALLOW_SYSWM=0 May 19, 2023
@sulix
Copy link
Contributor

sulix commented May 19, 2023

So, interestingly, I couldn't reproduce this (with the full game, not the demo) just running the game through Steam (both with and without the pressure-vessel 'Steam Linux Runtime') on openSUSE Tumbleweed with nVidia/KDE/Wayland.

However, if I ran the game directly (instead of via Steam), I get the same BadWindow error.

It looks like the game is trying to set a window icon, and is passing NULL as the Window:

(gdb) bt
#0  XChangeProperty (dpy=0x2894c30, w=0, property=331, type=6, format=32, mode=0, data=0x797c00 "", nelements=65538) at /usr/src/debug/libX11-1.8.4/src/ChProp.c:42
#1  0x0000000000404441 in ?? ()
#2  0x0000000000408202 in ?? ()
#3  0x0000000000678135 in ?? ()
#4  0x000000000067be17 in ?? ()
#5  0x0000000000543b7b in ?? ()
#6  0x000000000047948d in ?? ()
#7  0x0000000000541267 in ?? ()
#8  0x0000000000542b63 in ?? ()
#9  0x0000000000404053 in ?? ()
#10 0x00007ffff7b3cbb0 in __libc_start_call_main (main=main@entry=0x403fe0, argc=argc@entry=1, argv=argv@entry=0x7fffffffd838) at ../sysdeps/nptl/libc_start_call_main.h:58
#11 0x00007ffff7b3cc79 in __libc_start_main_impl (main=0x403fe0, argc=1, argv=0x7fffffffd838, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd828)
    at ../csu/libc-start.c:360
#12 0x0000000000403c59 in ?? ()
#13 0x00007fffffffd828 in ?? ()
#14 0x0000000000000038 in ?? ()
#15 0x0000000000000001 in ?? ()
#16 0x00007fffffffdd40 in ?? ()
#17 0x0000000000000000 in ?? ()
(gdb) call XGetAtomName((Display*)0x2894c30, 331)
$1 = 0x30ad9d0 "_NET_WM_ICON"

Using either SDL12COMPAT_ALLOW_SYSWM=0 or forcing the game to use wayland with SDL_VIDEODRIVER=wayland both fixed it.

@smcv
Copy link
Contributor Author

smcv commented May 19, 2023

both with and without the pressure-vessel 'Steam Linux Runtime'

FYI, I wasn't using the container/pressure-vessel "Steam Linux Runtime" for this testing, only the legacy LD_LIBRARY_PATH-based runtime. Currently the container runtime is the default on Steam Deck, and the legacy LD_LIBRARY_PATH-based runtime is the default everywhere else.

@sulix
Copy link
Contributor

sulix commented May 19, 2023

I think openSUSE does some nasty patching to force Steam to use the distro versions of some libraries, rather than the Steam Runtime versions, so that might explain some of the differences.

/proc/pid/maps definitely gives the distro version of sdl12-compat by default when launching through Steam, and it's exactly the same library running when I get BadWindow locally. Swapping out a self-compiled sdl12-compat doesn't change anything.

(There are a bunch of other libraries which come from the steam runtime when run via Steam, and the distro otherwise, but SDL doesn't seem to be one of them. Just: libnettle.so.6.2, libhogweed.so.4.2, librtmp.so.0, libidn.so.11.6.15, libcurl.so.4.2.0. None of which seem likely to be related.)

sulix added a commit to sulix/sdl12-compat that referenced this issue May 19, 2023
Steel Storm (and presumably other darkplaces, SDL 1.2-based games)
expect x11.wmwindow to be valid if they've created a window and are
running under X11. Just pass the same game window like we do for
x11.window.

See the old darkplaces code here:
https://github.com/xonotic/darkplaces/blob/a0465ad2ee16719587b0b7a80d4c1c2f7df1ac0e/vid_sdl.c#L2334

This should fix the BadWindow errors on Steel Storm Burning Retribution
(issue libsdl-org#290)
@sulix
Copy link
Contributor

sulix commented May 19, 2023

I managed to track down the darkplaces code that causes the issue:
https://github.com/xonotic/darkplaces/blob/a0465ad2ee16719587b0b7a80d4c1c2f7df1ac0e/vid_sdl.c#L2334

It's using the x11.wmwindow field, which sdl12-compat never sets (as there's no SDL2 equivalent). Just setting it to be the same as x11.window fixes it for me (see PR #292), and is only slightly incorrect. (I did the same for x11.fswindow as well, just in case).

Otherwise, adding a quirk to disable SDL12COMPAT_ALLOW_SYSWM seems like the other valid solution: the game has decent fallbacks if SysWM is unavailable.

@icculus
Copy link
Collaborator

icculus commented May 19, 2023

This appears to be a game based on darkplaces (modified Quake).

Being GPL'd code, you'll find this in your Steam install, too, fwiw:

$HOME/.local/share/Steam/steamapps/common/steelstorm/engine_source.zip

@icculus
Copy link
Collaborator

icculus commented May 19, 2023

It's using the x11.wmwindow field, which sdl12-compat never sets (as there's no SDL2 equivalent). Just setting it to be the same as x11.window fixes it for me (see PR #292), and is only slightly incorrect. (I did the same for x11.fswindow as well, just in case).

I think this is the correct fix. There's no need to turn off sywm with a quirk, as it uses the API correctly, including when not running on X11, and doesn't do anything that seems to upset things if available.

icculus pushed a commit that referenced this issue May 19, 2023
Steel Storm (and presumably other darkplaces, SDL 1.2-based games)
expect x11.wmwindow to be valid if they've created a window and are
running under X11. Just pass the same game window like we do for
x11.window.

See the old darkplaces code here:
https://github.com/xonotic/darkplaces/blob/a0465ad2ee16719587b0b7a80d4c1c2f7df1ac0e/vid_sdl.c#L2334

This should fix the BadWindow errors on Steel Storm Burning Retribution
(issue #290)
@icculus
Copy link
Collaborator

icculus commented May 19, 2023

Okay, this is fixed by 32a06ea, thanks!

@icculus icculus closed this as completed May 19, 2023
@icculus icculus added this to the 1.2.64 milestone May 19, 2023
@smcv
Copy link
Contributor Author

smcv commented Jun 2, 2023

Confirmed fixed with 1.2.64 + 2.26.5.

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

3 participants