#1123886 wesnoth-1.18: --nogui should explicitly select offscreen or dummy driver

#1123886#5
Date:
2025-12-20 16:21:58 UTC
From:
To:
After discussion with SDL upstream, I'm looking into what needs to
happen for Debian (and indirectly Ubuntu) to replace "classic" SDL2 with
sdl2-compat, following in the footsteps of other distros like Arch and
Fedora. sdl2-compat is a reimplementation of the SDL 2 API using SDL 3.

One issue that I've noticed is that the autopkgtest for wesnoth-1.18 has
regressed. This seems to be because "classic" SDL2 will automatically
use the `offscreen` video driver if neither X11 nor Wayland works, but
there was an upstream change in SDL3 to make the `offscreen` video
driver only work if explicitly requested, similar to the behaviour that
the `dummy` video driver already had. The result is that on a CI system
with no X11 display or Wayland compositor, this test fails to initialize
SDL video when SDL is really sdl2-compat.

The upstream change seems reasonable to me - by default, games should
only use video drivers that actually display some pixels to the user! -
but I've opened https://github.com/libsdl-org/sdl2-compat/issues/561 to
query whether sdl2-compat should be bug-for-bug compatible with
"classic" SDL2 on this point. So I think this is really an issue in
wesnoth-1.18, more than an issue in sdl2-compat.

A workaround that I have confirmed does work is to run the test with
SDL_VIDEODRIVER="offscreen" (or "dummy" or "offscreen,dummy"), so in the
short term please consider applying the attached patch.

The xauth and xvfb dependencies can probably also be dropped, although I
haven't verified that.

In the longer term, for consideration upstream:

wesnoth --nogui still calls SDL_InitSubSystem(SDL_INIT_VIDEO), even
though it has been asked not to have a GUI. Perhaps ideally it wouldn't?
(But perhaps there's some feature of the video subsystem that it is
relying on?)

Or perhaps wesnoth could call SDL_SetHint(SDL_HINT_VIDEODRIVER, "offscreen")
(or "dummy", or "offscreen,dummy") when invoked with --nogui or equivalent?

Thanks,
    smcv

#1123886#10
Date:
2025-12-20 16:32:00 UTC
From:
To:
Sorry, this was insufficiently tested. SDL_VIDEODRIVER=offscreen or
SDL_VIDEODRIVER=dummy does work, but SDL_VIDEODRIVER=offscreen,dummy
does not. Fixed patch attached.

Similarly this would have to choose either offscreen or dummy, it cannot
easily try both.

     smcv

#1123886#15
Date:
2025-12-23 14:46:31 UTC
From:
To:
Control: clone -1 -2
Control: retitle -2 wesnoth-1.18: --nogui should explicitly select offscreen or dummy driver
Control: tags -2 = upstream
Control: severity -2 wishlist

On https://github.com/libsdl-org/sdl2-compat/issues/561, SDL upstream
confirms that this would be a good idea. Please could a wesnoth-1.18
maintainer forward this suggestion to wesnoth's upstream?

Thanks,
     smcv